Mailing List Archive

variable quoting, setting optional variables to "", and depending on virtual/libc
What is the proper quoting style for using epatch? In the tree there
are about 3 different styles...

epatch ${FILESDIR}/some-fix.patch # used by 7326 ebuilds
epatch "${FILESDIR}"/some-fix.patch # used by 3092 ebuilds
epatch "${FILESDIR}/some-fix.patch" # used by 1434 ebuilds

What is the proper quoting style for defining the S variable? In the
tree there are about 3 different styles...

S=${WORKDIR}/${MY_P} # used by 5270 ebuilds
S="${WORKDIR}"/${MY_P} # used by 43 ebuilds
S="${WORKDIR}/${MY_P}" # used by 2259 ebuilds

What is the purpose of setting DEPEND and RDEPEND to "" if DEPEND and
RDEPEND are optional[1][2]? Isn't that just a waste of disk space /
bandwidth? DEPEND="virtual/libc" seems like a waste too as it is an
implicit system dependency[3], any reason for using it?

DEPEND="" # used by 1479 ebuilds
RDEPEND="" # used by 884 ebuilds
DEPEND="virtual/libc" # used by 809 ebuilds

[1] http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml?part=2&chap=1#doc_chap_pre2
[2] http://devmanual.gentoo.org/ebuild-writing/variables/index.html#optional-variables
[3] http://devmanual.gentoo.org/general-concepts/dependencies/index.html#implicit-system-dependency
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
Thomas Cort wrote:
> What is the proper quoting style for using epatch? In the tree there
> are about 3 different styles...
>
> epatch ${FILESDIR}/some-fix.patch # used by 7326 ebuilds
> epatch "${FILESDIR}"/some-fix.patch # used by 3092 ebuilds
> epatch "${FILESDIR}/some-fix.patch" # used by 1434 ebuilds
>
2 and 3 are fine.
> What is the proper quoting style for defining the S variable? In the
> tree there are about 3 different styles...
>
> S=${WORKDIR}/${MY_P} # used by 5270 ebuilds
> S="${WORKDIR}"/${MY_P} # used by 43 ebuilds
> S="${WORKDIR}/${MY_P}" # used by 2259 ebuilds
>
ditto
> What is the purpose of setting DEPEND and RDEPEND to "" if DEPEND and
> RDEPEND are optional[1][2]? Isn't that just a waste of disk space /
> bandwidth? DEPEND="virtual/libc" seems like a waste too as it is an
> implicit system dependency[3], any reason for using it?
>
> DEPEND="" # used by 1479 ebuilds
> RDEPEND="" # used by 884 ebuilds
> DEPEND="virtual/libc" # used by 809 ebuilds
>
If the package don't have dependencies, then don't set *DEPEND.
virtual/libc dependency is probably futile, unless the package is part
of the system class or is a dependency of a package which is part of the
system class.
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
Thomas Cort wrote:
> What is the proper quoting style for using epatch? In the tree there
> are about 3 different styles...
>
> epatch ${FILESDIR}/some-fix.patch # used by 7326 ebuilds
> epatch "${FILESDIR}"/some-fix.patch # used by 3092 ebuilds
> epatch "${FILESDIR}/some-fix.patch" # used by 1434 ebuilds
>
> What is the proper quoting style for defining the S variable? In the
> tree there are about 3 different styles...
>
> S=${WORKDIR}/${MY_P} # used by 5270 ebuilds
> S="${WORKDIR}"/${MY_P} # used by 43 ebuilds
> S="${WORKDIR}/${MY_P}" # used by 2259 ebuilds

The reasoning for quoting here is at least twofold:

1) There may be spaces in paths (e.g. PORTDIR and PORTAGE_TMPDIR), so
you need to use quotes.
2) When you set a variable to a string, you should use quotes.

Older ebuilds probably mostly lack quoting around uses of $FILESDIR, $S
and $D in the ebuild.

Thanks,
Donnie
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
On Sat, 17 Jun 2006, Thomas Cort wrote:

> What is the proper quoting style for using epatch? In the tree there
> are about 3 different styles...
>
> epatch ${FILESDIR}/some-fix.patch # used by 7326 ebuilds
> epatch "${FILESDIR}"/some-fix.patch # used by 3092 ebuilds
> epatch "${FILESDIR}/some-fix.patch" # used by 1434 ebuilds

The second and third are fine. The quoting is needed since FILESDIR
is user-set and could contain a space.

> What is the proper quoting style for defining the S variable? In the
> tree there are about 3 different styles...
>
> S=${WORKDIR}/${MY_P} # used by 5270 ebuilds
> S="${WORKDIR}"/${MY_P} # used by 43 ebuilds
> S="${WORKDIR}/${MY_P}" # used by 2259 ebuilds

The first is correct. The second and third have unnecessary quoting.

Michael Sterrett
-Mr. Bones.-
mr_bones_@gentoo.org
--
gentoo-dev@gentoo.org mailing list
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
On Sat, Jun 17, 2006 at 12:35:30AM -0400, Thomas Cort wrote:
> What is the proper quoting style for using epatch? In the tree there
> are about 3 different styles...
>
> epatch ${FILESDIR}/some-fix.patch # used by 7326 ebuilds
> epatch "${FILESDIR}"/some-fix.patch # used by 3092 ebuilds
> epatch "${FILESDIR}/some-fix.patch" # used by 1434 ebuilds

${FILESDIR} should be quoted, but as long as there are no wildcards in
the "/some-fix.patch", it doesn't matter whether that is.

> What is the proper quoting style for defining the S variable? In the
> tree there are about 3 different styles...
>
> S=${WORKDIR}/${MY_P} # used by 5270 ebuilds
> S="${WORKDIR}"/${MY_P} # used by 43 ebuilds
> S="${WORKDIR}/${MY_P}" # used by 2259 ebuilds

Any is fine, there is no word splitting or wildcard expansion in
shell variable assignments.

> What is the purpose of setting DEPEND and RDEPEND to "" if DEPEND and
> RDEPEND are optional[1][2]? Isn't that just a waste of disk space /
> bandwidth?

RDEPEND defaults to DEPEND (in ebuilds), so if DEPEND is set, and
RDEPEND should be empty, then RDEPEND must be set to "" explicitly.
As for DEPEND="", that's mostly a stylistic issue, I think.

> DEPEND="virtual/libc" seems like a waste too as it is an
> implicit system dependency[3], any reason for using it?

Not really.
--
gentoo-dev@gentoo.org mailing list
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
Thomas Cort <tcort@gentoo.org> wrote:
> What is the proper quoting style for using epatch? In the tree there
> are about 3 different styles...
<snip>
> What is the proper quoting style for defining the S variable? In the
> tree there are about 3 different styles...
It might be prudent to quote the variables, in case somebody, for
whatever reason, has strange characters in assorted paths.

> What is the purpose of setting DEPEND and RDEPEND to "" if DEPEND and
> RDEPEND are optional[1][2]? Isn't that just a waste of disk space /
> bandwidth? DEPEND="virtual/libc" seems like a waste too as it is an
> implicit system dependency[3], any reason for using it?
>
> DEPEND="" # used by 1479 ebuilds
> RDEPEND="" # used by 884 ebuilds
These two are probably not necessary, but some devs might prefer to use
them in their ebuilds for the sake of explicitly stating the implied.

> DEPEND="virtual/libc" # used by 809 ebuilds
There are opinions on both sides of this subject, but I think that most
devs are starting to see the value in this. If a package requires some
other package, say so. It may be a bit more work (twelve keystrokes),
but it's worth the extra effort (twelve keystrokes) to be complete.

--
twelve keystrokes
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
Harald van D??k <truedfx@gentoo.org> wrote:
> Any is fine, there is no word splitting or wildcard expansion in
> shell variable assignments.

$ foo="bar * baz"
$ wombat=$foo
$ echo $wombat
bar somedir somefile baz


--
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^ A unix signature isn't a return address, it's the ASCII equivalent of ^
^ a black velvet clown painting. It's a rectangle of carets surrounding ^
^ a quote from a literary giant of weeniedom like Heinlein or Dr. Who. ^
^ -- Chris Maeda ^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
On Fri, Jun 16, 2006 at 11:31:27PM -0700, Drake Wyrm wrote:
> Harald van D??k <truedfx@gentoo.org> wrote:
> > Any is fine, there is no word splitting or wildcard expansion in
> > shell variable assignments.
>
> $ foo="bar * baz"
> $ wombat=$foo
> $ echo $wombat
> bar somedir somefile baz

The wildcard expansion is not during the variable assignment, it's
during the expansion of $wombat. Just try echo "$wombat" instead.
--
gentoo-dev@gentoo.org mailing list
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
On Fri, Jun 16, 2006 at 11:02:27PM -0700, Drake Wyrm wrote:
> Thomas Cort <tcort@gentoo.org> wrote:
> > What is the proper quoting style for using epatch? In the tree there
> > are about 3 different styles...
> <snip>
> > What is the proper quoting style for defining the S variable? In the
> > tree there are about 3 different styles...
> It might be prudent to quote the variables, in case somebody, for
> whatever reason, has strange characters in assorted paths.
>
> > What is the purpose of setting DEPEND and RDEPEND to "" if DEPEND and
> > RDEPEND are optional[1][2]? Isn't that just a waste of disk space /
> > bandwidth? DEPEND="virtual/libc" seems like a waste too as it is an
> > implicit system dependency[3], any reason for using it?
> >
> > DEPEND="" # used by 1479 ebuilds
> > RDEPEND="" # used by 884 ebuilds
> These two are probably not necessary, but some devs might prefer to use
> them in their ebuilds for the sake of explicitly stating the implied.
>
> > DEPEND="virtual/libc" # used by 809 ebuilds
> There are opinions on both sides of this subject, but I think that most
> devs are starting to see the value in this. If a package requires some
> other package, say so. It may be a bit more work (twelve keystrokes),
> but it's worth the extra effort (twelve keystrokes) to be complete.
If I have a package that produces a dynamic (non-static) binary, and it
has no other deps, then I throw in virtual/libc.

If it produces a static binary only, or no binary, then it gets "".

What I would like to see at some point, is a real way of differencing
packages that really have no runtime dependencies - not even anything in
the system packages. As to what the best way to go about it, I'm not
certain, but I do think specifying a few packages: virtual/compiler,
virtual/libc and a few limited things from system packages should be ok.
Or maybe even virtual/system (with the compiler removed from that
virtual).

--
Robin Hugh Johnson
E-Mail : robbat2@gentoo.org
GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
On Saturday 17 June 2006 01:22, Alin Nastac wrote:
> Thomas Cort wrote:
> > What is the proper quoting style for using epatch? In the tree there
> > are about 3 different styles...
> >
> > epatch ${FILESDIR}/some-fix.patch # used by 7326 ebuilds
> > epatch "${FILESDIR}"/some-fix.patch # used by 3092 ebuilds
> > epatch "${FILESDIR}/some-fix.patch" # used by 1434 ebuilds
>
> 2 and 3 are fine.

correct ... personally i prefer the 2nd myself

> > What is the proper quoting style for defining the S variable? In the
> > tree there are about 3 different styles...
> >
> > S=${WORKDIR}/${MY_P} # used by 5270 ebuilds
> > S="${WORKDIR}"/${MY_P} # used by 43 ebuilds
> > S="${WORKDIR}/${MY_P}" # used by 2259 ebuilds
>
> ditto

not really ... all three will work fine, but i prefer the first myself as the
quoting is not needed here
-mike
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
On Saturday 17 June 2006 01:34, Donnie Berkholz wrote:
> 2) When you set a variable to a string, you should use quotes.

dont need them, bash does not expand in setting variables
-mike
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
On Saturday 17 June 2006 02:02, Drake Wyrm wrote:
> Thomas Cort <tcort@gentoo.org> wrote:
> > DEPEND="virtual/libc" # used by 809 ebuilds
>
> There are opinions on both sides of this subject, but I think that most
> devs are starting to see the value in this. If a package requires some
> other package, say so. It may be a bit more work (twelve keystrokes),
> but it's worth the extra effort (twelve keystrokes) to be complete.

virtual/libc has no value in DEPEND/RDEPEND

you cannot have a system without a system libc (well you can, but this *very
edge* case doesnt matter in the portage world)
-mike
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
Mike Frysinger <vapier@gentoo.org> posted
200606170330.29685.vapier@gentoo.org, excerpted below, on Sat, 17 Jun
2006 03:30:29 -0400:

>> > What is the proper quoting style for defining the S variable? In the
>> > tree there are about 3 different styles...
>> >
>> > S=${WORKDIR}/${MY_P} # used by 5270 ebuilds
>> > S="${WORKDIR}"/${MY_P} # used by 43 ebuilds
>> > S="${WORKDIR}/${MY_P}" # used by 2259 ebuilds
>>
>> ditto
>
> not really ... all three will work fine, but i prefer the first myself as the
> quoting is not needed here

What if someone has PORTAGE_TMPDIR="/tmp/portage temporary workspace" or
"/var/tmp/\$whatever" or some such (yes I know that's crazy, but...)? I'd
agree with the ditto, not with the all three will work fine.

--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman

--
gentoo-dev@gentoo.org mailing list
Re: Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
> What if someone has PORTAGE_TMPDIR="/tmp/portage temporary workspace" or
> "/var/tmp/\$whatever" or some such (yes I know that's crazy, but...)? I'd
> agree with the ditto, not with the all three will work fine.
It makes no difference in assignments, so all of them will do.

--
Best Regards,
Peper
--
gentoo-dev@gentoo.org mailing list
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
On Sat, 17 Jun 2006 00:35:30 -0400
Thomas Cort <tcort@gentoo.org> wrote:

> What is the purpose of setting DEPEND and RDEPEND to "" if DEPEND and
> RDEPEND are optional[1][2]? Isn't that just a waste of disk space /
> bandwidth? DEPEND="virtual/libc" seems like a waste too as it is an
> implicit system dependency[3], any reason for using it?
>
> DEPEND="" # used by 1479 ebuilds
> RDEPEND="" # used by 884 ebuilds
> DEPEND="virtual/libc" # used by 809 ebuilds

Setting RDEPEND to "" indicates that the stuff in DEPEND isn't needed
to run the package, and can safely be pruned later. If RDEPEND is not
set, it is defaulted to $DEPEND by portage.

--
Kevin F. Quinn
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
On Sat, 17 Jun 2006 00:30:04 -0700
"Robin H. Johnson" <robbat2@gentoo.org> wrote:

> If I have a package that produces a dynamic (non-static) binary, and
> it has no other deps, then I throw in virtual/libc.
>
> If it produces a static binary only, or no binary, then it gets "".

If you're going to do that, static binaries would usually depend on
virtual/libc to be built (using libc.a) so it would be in DEPEND but
explicitly removed from RDEPEND.

> What I would like to see at some point, is a real way of differencing
> packages that really have no runtime dependencies - not even anything
> in the system packages. As to what the best way to go about it, I'm
> not certain, but I do think specifying a few packages:
> virtual/compiler, virtual/libc and a few limited things from system
> packages should be ok. Or maybe even virtual/system (with the
> compiler removed from that virtual).

--
Kevin F. Quinn
Re: Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
Peper <peper@aster.pl> posted 200606171109.45478.peper@aster.pl, excerpted
below, on Sat, 17 Jun 2006 11:09:45 +0200:

> It makes no difference in assignments, so all of them will do.

Noted that based on the other replies after posting. Thanks, tho. I
didn't know that until reading the thread.

--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman

--
gentoo-dev@gentoo.org mailing list
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
> Setting RDEPEND to "" indicates that the stuff in DEPEND isn't needed
> to run the package, and can safely be pruned later. If RDEPEND is not
> set, it is defaulted to $DEPEND by portage.
If you inherit some eclass with deps, not set RDEPEND won't be defaulted to
DEPEND from ebuild, but will also include deps from eclass, which is
incorrect b/c these deps are needed for build time only(like sed,
autotools...). One needs to make sure that RDEPEND is correct if not set
manually in ebuild with eclasses.

--
Best Regards,
Peper
--
gentoo-dev@gentoo.org mailing list
Re: Re: Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
> Noted that based on the other replies after posting. Thanks, tho. I
> didn't know that until reading the thread.
No, it was genstef who pointed me that out when making my first ebuild.

--
Best Regards,
Peper
--
gentoo-dev@gentoo.org mailing list
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
On Sat, 17 Jun 2006 03:33:28 -0400
Mike Frysinger <vapier@gentoo.org> wrote:

> On Saturday 17 June 2006 02:02, Drake Wyrm wrote:
> > Thomas Cort <tcort@gentoo.org> wrote:
> > > DEPEND="virtual/libc" # used by 809 ebuilds
> >
> > There are opinions on both sides of this subject, but I think that
> > most devs are starting to see the value in this. If a package
> > requires some other package, say so. It may be a bit more work
> > (twelve keystrokes), but it's worth the extra effort (twelve
> > keystrokes) to be complete.
>
> virtual/libc has no value in DEPEND/RDEPEND
>
> you cannot have a system without a system libc (well you can, but
> this *very edge* case doesnt matter in the portage world)

Agreed.

However "Package Dependencies" in the dev handbook
http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml?part=2&chap=1#doc_chap5
suggests adding it as it uses virtual/libc as an example of the use of
virtuals.

Regarding implicit system dependencies which can be omitted from *DEPEND
http://devmanual.gentoo.org/general-concepts/dependencies/index.html#implicit-system-dependency
obviously USE flag settings affect what's pulled in by system as does
the profile.

So I think if we're to allow essential system dependencies to be
omitted, we should be very explicit; i.e. publish a strict list.

--
Kevin F. Quinn
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
Harald van D??k <truedfx@gentoo.org> wrote:
> On Fri, Jun 16, 2006 at 11:31:27PM -0700, Drake Wyrm wrote:
> > Harald van D??k <truedfx@gentoo.org> wrote:
> > > Any is fine, there is no word splitting or wildcard expansion in
> > > shell variable assignments.
> >
> > $ foo="bar * baz"
> > $ wombat=$foo
> > $ echo $wombat
> > bar somedir somefile baz
>
> The wildcard expansion is not during the variable assignment, it's
> during the expansion of $wombat. Just try echo "$wombat" instead.

Right, you are! I do apologize.

--
Major premise: You can't handle the truth.
Minor premise: The truth is out there.
Conclusion: You can't handle what is out there.
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
On Sat, 17 Jun 2006 11:26:12 +0200 Peper <peper@aster.pl> wrote:
| > Setting RDEPEND to "" indicates that the stuff in DEPEND isn't
| > needed to run the package, and can safely be pruned later. If
| > RDEPEND is not set, it is defaulted to $DEPEND by portage.
|
| If you inherit some eclass with deps, not set RDEPEND won't be
| defaulted to DEPEND from ebuild, but will also include deps from
| eclass, which is incorrect b/c these deps are needed for build time
| only(like sed, autotools...). One needs to make sure that RDEPEND is
| correct if not set manually in ebuild with eclasses.

Incorrect.

--
Ciaran McCreesh
Mail : ciaran dot mccreesh at blueyonder.co.uk


--
gentoo-dev@gentoo.org mailing list
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kevin F. Quinn wrote:
>
If RDEPEND is not set, it is defaulted to $DEPEND by portage.

Alas, if only. If you inherit an eclass with deps this carry over won't
happen. (And I have the bugs to prove it ;)

~mcummings


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEk/gNq1ztTp5/Ti4RAkjIAJwKPLEKd+T/bHl1v7B850XXCHOP3gCeMF8x
1hosIlwmFZm2f96F9VE5DxI=
=qdGO
-----END PGP SIGNATURE-----
--
gentoo-dev@gentoo.org mailing list
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
On Saturday 17 June 2006 14:39, Michael Cummings wrote:
> Kevin F. Quinn wrote:
>
> If RDEPEND is not set, it is defaulted to $DEPEND by portage.
>
> Alas, if only. If you inherit an eclass with deps this carry over won't
> happen. (And I have the bugs to prove it ;)

Well, has been the job of the eclass the ensure that, of course. But since
Portage 2.1 this is deprecated anyways and every developer is expected to set
RDEPEND explicitly, including RDEPEND=$DEPEND, if necessary. Unfortunately
the ebuild policy has still not been updated.

See also https://bugs.gentoo.org/show_bug.cgi?id=135945


Carsten
Re: variable quoting, setting optional variables to "", and depending on virtual/libc [ In reply to ]
> | If you inherit some eclass with deps, not set RDEPEND won't be
> | defaulted to DEPEND from ebuild, but will also include deps from
> | eclass, which is incorrect b/c these deps are needed for build time
> | only(like sed, autotools...). One needs to make sure that RDEPEND is
> | correct if not set manually in ebuild with eclasses.
>
> Incorrect.
What's incorrect? Made some tests and that's how it seems to work for me. If i
am wrong be more specific plz.

--
Best Regards,
Peper
--
gentoo-dev@gentoo.org mailing list