FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 12-11-2007, 04:03 AM
Mike Frysinger
 
Default gentoo-x86 commit in net-wireless/hostapd: ChangeLog hostapd-0.4.9.ebuild hostapd-0.6.1.ebuild hostapd-0.6.0.ebuild

On Monday 10 December 2007, Donnie Berkholz wrote:
> {
> ...
> echo "CONFIG_EAP_SAKE=y"
> ...
> } >> ${CONFIG}

cat <<-EOF >> ${CONFIG}
...
CONFIG_EAP_SAKE=y
...
EOF
-mike
 
Old 12-11-2007, 06:58 AM
"Denis Dupeyron"
 
Default gentoo-x86 commit in net-wireless/hostapd: ChangeLog hostapd-0.4.9.ebuild hostapd-0.6.1.ebuild hostapd-0.6.0.ebuild

On Dec 11, 2007 6:03 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Monday 10 December 2007, Donnie Berkholz wrote:
> > {
> > ...
> > echo "CONFIG_EAP_SAKE=y"
> > ...
> > } >> ${CONFIG}
>
> cat <<-EOF >> ${CONFIG}
> ...
> CONFIG_EAP_SAKE=y
> ...
> EOF
> -mike

Mike,

Is what you are suggesting better ? If so, why ?

Denis, clueless.
--
gentoo-dev@gentoo.org mailing list
 
Old 12-11-2007, 07:36 AM
Mike Frysinger
 
Default gentoo-x86 commit in net-wireless/hostapd: ChangeLog hostapd-0.4.9.ebuild hostapd-0.6.1.ebuild hostapd-0.6.0.ebuild

On Tuesday 11 December 2007, Denis Dupeyron wrote:
> On Dec 11, 2007 6:03 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> > On Monday 10 December 2007, Donnie Berkholz wrote:
> > > {
> > > ...
> > > echo "CONFIG_EAP_SAKE=y"
> > > ...
> > > } >> ${CONFIG}
> >
> > cat <<-EOF >> ${CONFIG}
> > ...
> > CONFIG_EAP_SAKE=y
> > ...
> > EOF
>
> Is what you are suggesting better ? If so, why ?

no scoping/subshells and obvious break between content (the stuff between EOF)
and the commands to get it in there (no echos, just one cat)
-mike
 
Old 12-13-2007, 12:48 PM
Steve Long
 
Default gentoo-x86 commit in net-wireless/hostapd: ChangeLog hostapd-0.4.9.ebuild hostapd-0.6.1.ebuild hostapd-0.6.0.ebuild

Mike Frysinger wrote:

> On Tuesday 11 December 2007, Denis Dupeyron wrote:
>> On Dec 11, 2007 6:03 AM, Mike Frysinger <vapier@gentoo.org> wrote:
>> > On Monday 10 December 2007, Donnie Berkholz wrote:
>> > > {
>> > > ...
>> > > echo "CONFIG_EAP_SAKE=y"
>> > > ...
>> > > } >> ${CONFIG}
>> >
>> > cat <<-EOF >> ${CONFIG}
>> > ...
>> > CONFIG_EAP_SAKE=y
>> > ...
>> > EOF
>>
>> Is what you are suggesting better ? If so, why ?
>
> no scoping/subshells and obvious break between content (the stuff between
> EOF) and the commands to get it in there (no echos, just one cat)
++, although the filename should be quoted ("$CONFIG" or "${CONFIG}")
Also, in this case, there are no variables being expanded in the heredoc, so
it makes sense to quote 'EOF':
cat <<-'EOF' >> "$CONFIG"
...
EOF
(take off the - sign to keep indentation)

Personally I prefer using embedded multiline echo:
echo '
CONFIG_FOO
CONFIG_BAR
CONFIG_BLAH
' >> "$CONFIG"
since it avoids the fork of an external binary (double-quotes allow variable
expansion) but it is a bashism iirc.


--
gentoo-dev@gentoo.org mailing list
 
Old 12-13-2007, 06:13 PM
Mike Frysinger
 
Default gentoo-x86 commit in net-wireless/hostapd: ChangeLog hostapd-0.4.9.ebuild hostapd-0.6.1.ebuild hostapd-0.6.0.ebuild

On Thursday 13 December 2007, Steve Long wrote:
> Mike Frysinger wrote:
> > On Tuesday 11 December 2007, Denis Dupeyron wrote:
> >> On Dec 11, 2007 6:03 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> >> > On Monday 10 December 2007, Donnie Berkholz wrote:
> >> > > {
> >> > > ...
> >> > > echo "CONFIG_EAP_SAKE=y"
> >> > > ...
> >> > > } >> ${CONFIG}
> >> >
> >> > cat <<-EOF >> ${CONFIG}
> >> > ...
> >> > CONFIG_EAP_SAKE=y
> >> > ...
> >> > EOF
> >>
> >> Is what you are suggesting better ? If so, why ?
> >
> > no scoping/subshells and obvious break between content (the stuff between
> > EOF) and the commands to get it in there (no echos, just one cat)
>
> ++, although the filename should be quoted ("$CONFIG" or "${CONFIG}")
> Also, in this case, there are no variables being expanded in the heredoc,
> so it makes sense to quote 'EOF':
> cat <<-'EOF' >> "$CONFIG"
> ...
> EOF
> (take off the - sign to keep indentation)
>
> Personally I prefer using embedded multiline echo:
> echo '
> CONFIG_FOO
> CONFIG_BAR
> CONFIG_BLAH
> ' >> "$CONFIG"

the point of using cat with <<- is so that it wont look like crap when you put
it into the ebuild. you can use normal tab indentation. an echo may work in
a script, but not in an ebuild as the indentation is also placed in the
output file.
-mike
 
Old 12-14-2007, 12:28 PM
Steve Long
 
Default gentoo-x86 commit in net-wireless/hostapd: ChangeLog hostapd-0.4.9.ebuild hostapd-0.6.1.ebuild hostapd-0.6.0.ebuild

Mike Frysinger wrote:
>> Personally I prefer using embedded multiline echo:
>> echo '
>> CONFIG_FOO
>> CONFIG_BAR
>> CONFIG_BLAH
>> ' >> "$CONFIG"
>
> the point of using cat with <<- is so that it wont look like crap when you
> put
> it into the ebuild. you can use normal tab indentation. an echo may work
> in a script, but not in an ebuild as the indentation is also placed in the
> output file.

Fair enough, I didn't realise indentation was so important in ebuilds. I
regularly use that for eg awk or ed scriptlets, and the indent breaks for
as long as the quotes are in scope (ie it gets left-justified.) Doesn't
matter in ebuild context, I guess, you're right: much more time is spent on
compiling the software. Just you brought up subshells wrt a fork to an
external binary.


--
gentoo-dev@gentoo.org mailing list
 

Thread Tools




All times are GMT. The time now is 10:23 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org