* [gentoo-dev] More general interface to use flags
@ 2007-11-02 13:44 Marijn Schouten (hkBst)
2007-11-02 14:04 ` Roy Marples
2007-11-04 10:54 ` [gentoo-dev] " Steve Long
0 siblings, 2 replies; 38+ messages in thread
From: Marijn Schouten (hkBst) @ 2007-11-02 13:44 UTC (permalink / raw
To: gentoo-dev@lists.gentoo.org; +Cc: gentoo-portage-dev
[-- Attachment #1.1: Type: text/plain, Size: 1725 bytes --]
Hi list,
the current interface to use flags, useq, usev, use_with, use_enable, as
defined in /usr/lib/portage/bin/ebuild.sh lacks generality. The common thing
is testing a use flag and possibly echoing a string, but there is no function
that implements this common behaviour.
I propose that we add such a function. Proposed name for the function is "ifuse".
I also propose to add the utility function "ifv" which is useful for writing
concise and clean code.
These additions would allow you to easily define your own function for
processing use flags in ebuilds and eclasses. One such example is
use_mime() {
local WORD=$(ifv "$2" "$2" "$1")
ifuse "$1" "${WORD};"
}
for generating a string of ';'-separated mime-types based on use flags.
The explanation of this function is:
#set WORD to argument 2 or if that is empty to argument 1
#output "${WORD};" if use flag $1 is set (or if it starts with ! and is unset)
#otherwise don't output anything
The existing interface is also simple to reimplement:
use() {
ifuse "${1}"
}
useq() {
ifuse "${1}"
}
usev() {
ifuse "${1}" "${1}"
}
use_with() {
local SUFFIX=$(ifv "$3" "=$3")
local WORD=$(ifv "$2" "$2" "$1")
ifuse "$1" "--with-${WORD}${SUFFIX}" "--without-${WORD}"
}
use_enable() {
local SUFFIX=$(ifv "$3" "=$3")
local WORD=$(ifv "$2" "$2" "$1")
ifuse "$1" "--enable-${WORD}${SUFFIX}" "--disable-${WORD}"
}
ifuse's code is much like useq's code now, but more versatile. You can find it
attached along with ifv.
Please comment,
Marijn
--
Marijn Schouten (hkBst), Gentoo Lisp project
<http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode
[-- Attachment #1.2: new_use_interface --]
[-- Type: text/plain, Size: 785 bytes --]
# test a use flag and return the result, possibly echo a non-empty string
ifuse() {
local flag=$1
local string_success=$2
local string_failure=$3
local success=0
# invert the return value for "!blah" and strip the '!'
[[ ${flag} = !* ]] && { success=1 ; flag=${flag:1} }
# Make sure we have this USE flag in IUSE
if ! hasq "${flag}" ${IUSE} ${E_IUSE} && ! hasq "${flag}" ${PORTAGE_ARCHLIST} selinux; then
eqawarn "QA Notice: USE Flag '${flag}' not in IUSE for ${CATEGORY}/${PF}"
fi
hasq "${flag}" ${USE} || ((success=1-success))
string=$( (( ${success} == 0 )) && echo ${string_success} || echo ${string_failure} )
[[ -n ${string} ]] && echo ${string}
return ${success}
}
ifv() {
[[ -n $1 ]] && echo $2 || echo $3
}
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] More general interface to use flags
2007-11-02 13:44 [gentoo-dev] More general interface to use flags Marijn Schouten (hkBst)
@ 2007-11-02 14:04 ` Roy Marples
2007-11-02 14:27 ` Marijn Schouten (hkBst)
2007-11-02 14:59 ` Mike Frysinger
2007-11-04 10:54 ` [gentoo-dev] " Steve Long
1 sibling, 2 replies; 38+ messages in thread
From: Roy Marples @ 2007-11-02 14:04 UTC (permalink / raw
To: gentoo-dev
On Fri, 2007-11-02 at 14:44 +0100, Marijn Schouten (hkBst) wrote:
> [[ ${flag} = !* ]] && { success=1 ; flag=${flag:1} }
Could be written as
[ "${flag#!}" != "${flag}" ] && { success=1; flag=${flag#!}; }
> string=$( (( ${success} == 0 )) && echo ${string_success} || echo
> ${string_failure} )
> [[ -n ${string} ]] && echo ${string}
if [ "${success}" = "0" ]; then
string=${string_success}
else
string=${string_failure}
fi
[ -n "${string}" ] && echo "${string}"
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] More general interface to use flags
2007-11-02 14:04 ` Roy Marples
@ 2007-11-02 14:27 ` Marijn Schouten (hkBst)
2007-11-02 14:52 ` Roy Marples
2007-11-02 14:59 ` Mike Frysinger
1 sibling, 1 reply; 38+ messages in thread
From: Marijn Schouten (hkBst) @ 2007-11-02 14:27 UTC (permalink / raw
To: gentoo-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Roy Marples wrote:
> On Fri, 2007-11-02 at 14:44 +0100, Marijn Schouten (hkBst) wrote:
>> [[ ${flag} = !* ]] && { success=1 ; flag=${flag:1} }
>
> Could be written as
> [ "${flag#!}" != "${flag}" ] && { success=1; flag=${flag#!}; }
>
>> string=$( (( ${success} == 0 )) && echo ${string_success} || echo
>> ${string_failure} )
>> [[ -n ${string} ]] && echo ${string}
>
> if [ "${success}" = "0" ]; then
> string=${string_success}
> else
> string=${string_failure}
> fi
> [ -n "${string}" ] && echo "${string}"
Actually I'd prefer to introduce
ifz() {
[[ $1 = 0 ]] && echo $2 || echo $3
}
and reimplement as follows
string=$(ifz ${success} "${string_success}" "${string_failure}")
but I don't want to push my luck,
Marijn
- --
Marijn Schouten (hkBst), Gentoo Lisp project
<http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHKzPXp/VmCx0OL2wRAhvNAKCB5yPezkffi/QXx6aDEXsgB662kwCfb3DV
SDZ66FZzdoSF3uftGd+ZBik=
=ylxW
-----END PGP SIGNATURE-----
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] More general interface to use flags
2007-11-02 14:27 ` Marijn Schouten (hkBst)
@ 2007-11-02 14:52 ` Roy Marples
0 siblings, 0 replies; 38+ messages in thread
From: Roy Marples @ 2007-11-02 14:52 UTC (permalink / raw
To: gentoo-dev
On Fri, 2007-11-02 at 15:27 +0100, Marijn Schouten (hkBst) wrote:
>
> ifz() {
> [[ $1 = 0 ]] && echo $2 || echo $3
> }
And that could be written as
[ "$1" = 0 ] && echo "$2" || echo "$3"
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] More general interface to use flags
2007-11-02 14:04 ` Roy Marples
2007-11-02 14:27 ` Marijn Schouten (hkBst)
@ 2007-11-02 14:59 ` Mike Frysinger
2007-11-02 15:30 ` Roy Marples
1 sibling, 1 reply; 38+ messages in thread
From: Mike Frysinger @ 2007-11-02 14:59 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 222 bytes --]
On Friday 02 November 2007, Roy Marples wrote:
> On Fri, 2007-11-02 at 14:44 +0100, Marijn Schouten (hkBst) wrote:
> > [[ ${flag} = !* ]] && { success=1 ; flag=${flag:1} }
>
> Could be written as
irrelevant, thanks
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 827 bytes --]
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] More general interface to use flags
2007-11-02 14:59 ` Mike Frysinger
@ 2007-11-02 15:30 ` Roy Marples
2007-11-02 15:38 ` Mike Frysinger
0 siblings, 1 reply; 38+ messages in thread
From: Roy Marples @ 2007-11-02 15:30 UTC (permalink / raw
To: gentoo-dev
On Fri, 2007-11-02 at 10:59 -0400, Mike Frysinger wrote:
> On Friday 02 November 2007, Roy Marples wrote:
> > On Fri, 2007-11-02 at 14:44 +0100, Marijn Schouten (hkBst) wrote:
> > > [[ ${flag} = !* ]] && { success=1 ; flag=${flag:1} }
> >
> > Could be written as
>
> irrelevant, thanks
My mail was relevant to the discussion, yours is just trolling and has
no place here.
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] More general interface to use flags
2007-11-02 15:30 ` Roy Marples
@ 2007-11-02 15:38 ` Mike Frysinger
2007-11-02 15:48 ` Roy Marples
0 siblings, 1 reply; 38+ messages in thread
From: Mike Frysinger @ 2007-11-02 15:38 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 808 bytes --]
On Friday 02 November 2007, Roy Marples wrote:
> On Fri, 2007-11-02 at 10:59 -0400, Mike Frysinger wrote:
> > On Friday 02 November 2007, Roy Marples wrote:
> > > On Fri, 2007-11-02 at 14:44 +0100, Marijn Schouten (hkBst) wrote:
> > > > [[ ${flag} = !* ]] && { success=1 ; flag=${flag:1} }
> > >
> > > Could be written as
> >
> > irrelevant, thanks
>
> My mail was relevant to the discussion, yours is just trolling and has
> no place here.
wrong. the point of the discussion on the gentoo dev mailing list is to go
over the exported API for *ebuilds*, not for the implementation. the
implementation is already baked and really, Marijn shouldnt have sent it to
the gentoo dev mailing list in the first place. your pointless POSIX
conversions have no place in the discussion.
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 827 bytes --]
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] More general interface to use flags
2007-11-02 15:38 ` Mike Frysinger
@ 2007-11-02 15:48 ` Roy Marples
2007-11-02 15:58 ` Mike Frysinger
0 siblings, 1 reply; 38+ messages in thread
From: Roy Marples @ 2007-11-02 15:48 UTC (permalink / raw
To: gentoo-dev
On Fri, 2007-11-02 at 11:38 -0400, Mike Frysinger wrote:
> wrong. the point of the discussion on the gentoo dev mailing list is to go
> over the exported API for *ebuilds*, not for the implementation. the
> implementation is already baked and really, Marijn shouldnt have sent it to
> the gentoo dev mailing list in the first place. your pointless POSIX
> conversions have no place in the discussion.
However, I notice that you have no problem discussing the implementation
of ebuild commits or are they special in some way?
My POSIX conversations encourage the use of POSIX over non portable bash
as that's something I try and encourage. And that is very pertinent to
-dev.
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] More general interface to use flags
2007-11-02 15:48 ` Roy Marples
@ 2007-11-02 15:58 ` Mike Frysinger
2007-11-02 16:10 ` Roy Marples
0 siblings, 1 reply; 38+ messages in thread
From: Mike Frysinger @ 2007-11-02 15:58 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1349 bytes --]
On Friday 02 November 2007, Roy Marples wrote:
> On Fri, 2007-11-02 at 11:38 -0400, Mike Frysinger wrote:
> > wrong. the point of the discussion on the gentoo dev mailing list is to
> > go over the exported API for *ebuilds*, not for the implementation. the
> > implementation is already baked and really, Marijn shouldnt have sent it
> > to the gentoo dev mailing list in the first place. your pointless POSIX
> > conversions have no place in the discussion.
>
> However, I notice that you have no problem discussing the implementation
> of ebuild commits or are they special in some way?
that's because the point of said discussions *is about the implementation*.
this thread is not about the implementation, but about the API. besides, i'd
give you the same answer there when you attempt to get people to change
perfectly valid (and preferred) code structures.
> My POSIX conversations encourage the use of POSIX over non portable bash
> as that's something I try and encourage. And that is very pertinent to
> -dev.
and the answer is still the same. POSIX conversions are irrelevant until you
can propose solutions for the things bash can do but POSIX cannot. you can
only provide workarounds or hacks, so any further attempt on the topic is
half way conversions that lead to ugly inconsistencies.
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 827 bytes --]
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] More general interface to use flags
2007-11-02 15:58 ` Mike Frysinger
@ 2007-11-02 16:10 ` Roy Marples
2007-11-02 16:30 ` Bo Ørsted Andresen
0 siblings, 1 reply; 38+ messages in thread
From: Roy Marples @ 2007-11-02 16:10 UTC (permalink / raw
To: gentoo-dev
On Fri, 2007-11-02 at 11:58 -0400, Mike Frysinger wrote:
> and the answer is still the same. POSIX conversions are irrelevant until you
> can propose solutions for the things bash can do but POSIX cannot. you can
> only provide workarounds or hacks, so any further attempt on the topic is
> half way conversions that lead to ugly inconsistencies.
Please point to the ugly inconsistent POSIX hacks in this thread?
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] More general interface to use flags
2007-11-02 16:10 ` Roy Marples
@ 2007-11-02 16:30 ` Bo Ørsted Andresen
2007-11-02 16:52 ` Roy Marples
0 siblings, 1 reply; 38+ messages in thread
From: Bo Ørsted Andresen @ 2007-11-02 16:30 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 577 bytes --]
On Friday 02 November 2007 17:10:29 Roy Marples wrote:
> > and the answer is still the same. POSIX conversions are irrelevant until
> > you can propose solutions for the things bash can do but POSIX cannot.
> > you can only provide workarounds or hacks, so any further attempt on the
> > topic is half way conversions that lead to ugly inconsistencies.
>
> Please point to the ugly inconsistent POSIX hacks in this thread?
Please explain why you hijack this thread to discuss POSIX vs. bash when it's
supposed to be about the API for ebuilds.
--
Bo Andresen
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] More general interface to use flags
2007-11-02 16:30 ` Bo Ørsted Andresen
@ 2007-11-02 16:52 ` Roy Marples
2007-11-02 17:17 ` Bo Ørsted Andresen
0 siblings, 1 reply; 38+ messages in thread
From: Roy Marples @ 2007-11-02 16:52 UTC (permalink / raw
To: gentoo-dev
On Fri, 2007-11-02 at 17:30 +0100, Bo Ørsted Andresen wrote:
> Please explain why you hijack this thread to discuss POSIX vs. bash when it's
> supposed to be about the API for ebuilds.
I dislike the gratuitous use of bash for no good reason - and in the
code he gave there is no good reason for using bashisms.
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] More general interface to use flags
2007-11-02 16:52 ` Roy Marples
@ 2007-11-02 17:17 ` Bo Ørsted Andresen
2007-11-02 17:35 ` Roy Marples
0 siblings, 1 reply; 38+ messages in thread
From: Bo Ørsted Andresen @ 2007-11-02 17:17 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 556 bytes --]
On Friday 02 November 2007 17:52:13 Roy Marples wrote:
> On Fri, 2007-11-02 at 17:30 +0100, Bo Ørsted Andresen wrote:
> > Please explain why you hijack this thread to discuss POSIX vs. bash when
> > it's supposed to be about the API for ebuilds.
>
> I dislike the gratuitous use of bash for no good reason - and in the
> code he gave there is no good reason for using bashisms.
So your approach to getting it your way is to hijack every thread that shows
use of bashisms until people start using your inferior workarounds?
--
Bo Andresen
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] More general interface to use flags
2007-11-02 17:17 ` Bo Ørsted Andresen
@ 2007-11-02 17:35 ` Roy Marples
2007-11-03 0:19 ` [gentoo-dev] POSIX shell and "portable" Fabian Groffen
[not found] ` <b41005390711022225i4f30bb01jbf5a040c60c4b088@mail.gmail.com>
0 siblings, 2 replies; 38+ messages in thread
From: Roy Marples @ 2007-11-02 17:35 UTC (permalink / raw
To: gentoo-dev
On Fri, 2007-11-02 at 18:17 +0100, Bo Ørsted Andresen wrote:
> On Friday 02 November 2007 17:52:13 Roy Marples wrote:
> > On Fri, 2007-11-02 at 17:30 +0100, Bo Ørsted Andresen wrote:
> > > Please explain why you hijack this thread to discuss POSIX vs. bash when
> > > it's supposed to be about the API for ebuilds.
> >
> > I dislike the gratuitous use of bash for no good reason - and in the
> > code he gave there is no good reason for using bashisms.
>
> So your approach to getting it your way is to hijack every thread that shows
> use of bashisms until people start using your inferior workarounds?
I don't see them as inferior.
I see them as more portable and less confusing.
Of course you are welcome to compare the code in question and state
which is inferior and why it is so.
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-02 17:35 ` Roy Marples
@ 2007-11-03 0:19 ` Fabian Groffen
2007-11-03 0:47 ` Roy Marples
` (3 more replies)
[not found] ` <b41005390711022225i4f30bb01jbf5a040c60c4b088@mail.gmail.com>
1 sibling, 4 replies; 38+ messages in thread
From: Fabian Groffen @ 2007-11-03 0:19 UTC (permalink / raw
To: gentoo-dev
On 02-11-2007 17:35:08 +0000, Roy Marples wrote:
> I don't see them as inferior.
> I see them as more portable and less confusing.
Please stop calling it "more portable". The shell code you see in
configure can in a way be called "portable". Your POSIX compliant stuff
isn't. In fact, by stating #!/bin/sh you actually make the code useless
on a number of platforms, where it would have been working fine if there
just were #!/bin/bash there.
It seems to me that you actually mean "more FreeBSD-able" or something,
which is a high price to pay for a relatively small part of Gentoo as a
whole.
--
Fabian Groffen
Gentoo on a different level
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-03 0:19 ` [gentoo-dev] POSIX shell and "portable" Fabian Groffen
@ 2007-11-03 0:47 ` Roy Marples
2007-11-05 9:22 ` Michael Haubenwallner
2007-11-03 0:57 ` Natanael copa
` (2 subsequent siblings)
3 siblings, 1 reply; 38+ messages in thread
From: Roy Marples @ 2007-11-03 0:47 UTC (permalink / raw
To: gentoo-dev
On Sat, 2007-11-03 at 01:19 +0100, Fabian Groffen wrote:
> On 02-11-2007 17:35:08 +0000, Roy Marples wrote:
> > I don't see them as inferior.
> > I see them as more portable and less confusing.
>
> Please stop calling it "more portable".
But is it more portable as then then works across more than one shell.
> The shell code you see in
> configure can in a way be called "portable". Your POSIX compliant stuff
> isn't.
Sure it is - it should work on a shell that claims POSIX compliance.
> In fact, by stating #!/bin/sh you actually make the code useless
> on a number of platforms, where it would have been working fine if there
> just were #!/bin/bash there.
Then the issue is to fix their sh so it follows POSIX compliance.
As soon as a dash, bb or FreeBSD sh issue is found where it deviates
from POSIX but it works on bash a lot of people say "dash bug, therefore
invalid
> It seems to me that you actually mean "more FreeBSD-able" or something,
> which is a high price to pay for a relatively small part of Gentoo as a
> whole.
More embeddable.
More BSDable.
More Linuxable - bash isn't the only linux shell, there are plently of
others.
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-03 0:19 ` [gentoo-dev] POSIX shell and "portable" Fabian Groffen
2007-11-03 0:47 ` Roy Marples
@ 2007-11-03 0:57 ` Natanael copa
2007-11-03 1:06 ` Roy Marples
2007-11-03 1:10 ` [gentoo-dev] " Roy Marples
3 siblings, 0 replies; 38+ messages in thread
From: Natanael copa @ 2007-11-03 0:57 UTC (permalink / raw
To: gentoo-dev
On Sat, 2007-11-03 at 01:19 +0100, Fabian Groffen wrote:
> On 02-11-2007 17:35:08 +0000, Roy Marples wrote:
> > I don't see them as inferior.
> > I see them as more portable and less confusing.
>
> Please stop calling it "more portable". The shell code you see in
> configure can in a way be called "portable". Your POSIX compliant stuff
> isn't.
It is - in the sense the run in more shells. Roy's POSIX compliant stuff
runs on at least a handful different shells. bash scripts runs on only
one. (busybox ash can run some bash things but mostly they don't work)
bash itself is portable but that is another story.
-nc
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-03 0:19 ` [gentoo-dev] POSIX shell and "portable" Fabian Groffen
2007-11-03 0:47 ` Roy Marples
2007-11-03 0:57 ` Natanael copa
@ 2007-11-03 1:06 ` Roy Marples
2007-11-03 16:19 ` [gentoo-dev] " Steve Long
2007-11-03 1:10 ` [gentoo-dev] " Roy Marples
3 siblings, 1 reply; 38+ messages in thread
From: Roy Marples @ 2007-11-03 1:06 UTC (permalink / raw
To: gentoo-dev
On Sat, 2007-11-03 at 01:19 +0100, Fabian Groffen wrote:
> Please stop calling it "more portable". The shell code you see in
> configure can in a way be called "portable". Your POSIX compliant stuff
> isn't. In fact, by stating #!/bin/sh you actually make the code useless
> on a number of platforms, where it would have been working fine if there
> just were #!/bin/bash there.
>
> It seems to me that you actually mean "more FreeBSD-able" or something,
> which is a high price to pay for a relatively small part of Gentoo as a
> whole.
Another way of looking at it is that you're forcing specific tools on
people, where I am asking people to use standard POSIX tools.
I guess it's because I'm an Engineer and you probably aren't. If the
tool isn't up to the job, then fix the tool. If the tool doesn't claim
any standards compliance then feel free to change it.
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-03 0:19 ` [gentoo-dev] POSIX shell and "portable" Fabian Groffen
` (2 preceding siblings ...)
2007-11-03 1:06 ` Roy Marples
@ 2007-11-03 1:10 ` Roy Marples
3 siblings, 0 replies; 38+ messages in thread
From: Roy Marples @ 2007-11-03 1:10 UTC (permalink / raw
To: gentoo-dev
On Sat, 2007-11-03 at 01:19 +0100, Fabian Groffen wrote:
> On 02-11-2007 17:35:08 +0000, Roy Marples wrote:
> > I don't see them as inferior.
> > I see them as more portable and less confusing.
>
> Please stop calling it "more portable". The shell code you see in
> configure can in a way be called "portable". Your POSIX compliant stuff
> isn't. In fact, by stating #!/bin/sh you actually make the code useless
> on a number of platforms, where it would have been working fine if there
> just were #!/bin/bash there.
>
> It seems to me that you actually mean "more FreeBSD-able" or something,
> which is a high price to pay for a relatively small part of Gentoo as a
> whole.
Me again.
If the shell isn't infact POSIX then you could always patch everything
to change #!/bin/sh to #!/bin/bash and install bash or remove /bin/sh
and link it to bash.
As a lot of programs out there in the tree that are runtime (not ebuilds
or init scripts) depend on /bin/sh being a POSIX shell.
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Fwd: [gentoo-dev] More general interface to use flags
[not found] ` <b41005390711022225i4f30bb01jbf5a040c60c4b088@mail.gmail.com>
@ 2007-11-03 5:26 ` Alec Warner
2007-11-03 21:57 ` Mike Frysinger
0 siblings, 1 reply; 38+ messages in thread
From: Alec Warner @ 2007-11-03 5:26 UTC (permalink / raw
To: gentoo-dev
I hate gmail
---------- Forwarded message ----------
From: Alec Warner <antarus@scriptkitty.com>
Date: Nov 2, 2007 10:25 PM
Subject: Re: [gentoo-dev] More general interface to use flags
To: gentoo-dev@lists.gentoo.org
On 11/2/07, Roy Marples <uberlord@gentoo.org> wrote:
>
> On Fri, 2007-11-02 at 18:17 +0100, Bo Ørsted Andresen wrote:
> > On Friday 02 November 2007 17:52:13 Roy Marples wrote:
> > > On Fri, 2007-11-02 at 17:30 +0100, Bo Ørsted Andresen wrote:
> > > > Please explain why you hijack this thread to discuss POSIX vs. bash when
> > > > it's supposed to be about the API for ebuilds.
> > >
> > > I dislike the gratuitous use of bash for no good reason - and in the
> > > code he gave there is no good reason for using bashisms.
> >
> > So your approach to getting it your way is to hijack every thread that shows
> > use of bashisms until people start using your inferior workarounds?
>
> I don't see them as inferior.
> I see them as more portable and less confusing.
>
> Of course you are welcome to compare the code in question and state
> which is inferior and why it is so.
>
> Thanks
>
> Roy
I think Roy's comments about POSIX shell are appropriate in that it is
his goal to see POSIX shell used within Gentoo and it is important to
that goal to point out where one can use POSIX shell instead of bash.
That being said; as far as I'm aware the reference implementation
provided by hkbst is in relation to portage (since it was already
discussed on the gentoo-dev-portage list). Since portage currently
uses bash and to my knowledge is not moving to POSIX shell in the near
term, I think bash is appropriate in the implementation. AKA,
everyone stop arguing about which is better.
-Alec
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* [gentoo-dev] Re: POSIX shell and "portable"
2007-11-03 1:06 ` Roy Marples
@ 2007-11-03 16:19 ` Steve Long
0 siblings, 0 replies; 38+ messages in thread
From: Steve Long @ 2007-11-03 16:19 UTC (permalink / raw
To: gentoo-dev
Roy Marples wrote:
> On Sat, 2007-11-03 at 01:19 +0100, Fabian Groffen wrote:
>> Please stop calling it "more portable". The shell code you see in
>> configure can in a way be called "portable". Your POSIX compliant stuff
>> isn't. In fact, by stating #!/bin/sh you actually make the code useless
>> on a number of platforms, where it would have been working fine if there
>> just were #!/bin/bash there.
>>
>> It seems to me that you actually mean "more FreeBSD-able" or something,
>> which is a high price to pay for a relatively small part of Gentoo as a
>> whole.
>
> Another way of looking at it is that you're forcing specific tools on
> people, where I am asking people to use standard POSIX tools.
>
No, you're waging a campaign to get all Gentoo ebuilds in sh, by pointing
out how certain constructs can be rewritten in sh. If your campaign is
successful, all Gentoo devs will be forced to write in sh. Saying it's
standard when the standard is a) pretty old and b) pretty minimalistic
doesn't make it a tool "that's up to the job".
> I guess it's because I'm an Engineer and you probably aren't. If the
> tool isn't up to the job, then fix the tool. If the tool doesn't claim
> any standards compliance then feel free to change it.
>
Er there are two conflicting statements there. The *standard* isn't up to
the job, in that use of the sh syntax you promote leads to longer
maintenance times and increased likelihood of bugs, since the code is
counter-intuitive (aka fugly ;)
As Mr Copa said "bash itself is portable."
As a _software_ engineer I am vehemently opposed for the reasons given. The
reason for my vehemence is that I don't want to see Gentoo devs spending
extra time working around limitations in sh (which is a *base* standard)
when really there are /far/ better technical ways round getting, say,
ebuilds installed on a Linux Phone (and I have seen *no* other use-case
which merits use of sh in package management; it's hardly our core
user-base, is it?)
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Fwd: [gentoo-dev] More general interface to use flags
2007-11-03 5:26 ` Fwd: [gentoo-dev] More general interface to use flags Alec Warner
@ 2007-11-03 21:57 ` Mike Frysinger
0 siblings, 0 replies; 38+ messages in thread
From: Mike Frysinger @ 2007-11-03 21:57 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 287 bytes --]
On Saturday 03 November 2007, Alec Warner wrote:
> Since portage currently
> uses bash and to my knowledge is not moving to POSIX shell in the near
> term, I think bash is appropriate in the implementation. AKA,
> everyone stop arguing about which is better.
there it is, thanks
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 827 bytes --]
^ permalink raw reply [flat|nested] 38+ messages in thread
* [gentoo-dev] Re: More general interface to use flags
2007-11-02 13:44 [gentoo-dev] More general interface to use flags Marijn Schouten (hkBst)
2007-11-02 14:04 ` Roy Marples
@ 2007-11-04 10:54 ` Steve Long
2007-11-04 21:54 ` Alec Warner
1 sibling, 1 reply; 38+ messages in thread
From: Steve Long @ 2007-11-04 10:54 UTC (permalink / raw
To: gentoo-dev; +Cc: gentoo-portage-dev
Marijn Schouten (hkBst) wrote:
> the current interface to use flags, useq, usev, use_with, use_enable, as
> defined in /usr/lib/portage/bin/ebuild.sh lacks generality. The common
> thing is testing a use flag and possibly echoing a string, but there is no
> function that implements this common behaviour.
>
> I propose that we add such a function. Proposed name for the function is
> "ifuse".
>
I like the overall API that is enabled (and that it doesn't break anything.)
> I also propose to add the utility function "ifv" which is useful for
> writing concise and clean code.
>
This one seems a bit light-weight to me, but if it makes your life easier,
why not?
One minor thing; -n is the default test, so:
[[ $1 ]] is the same as [[ -n $1 ]]
and:
[[ ! $1 ]] is the same as [[ -z $1 ]]
''help test'' is very revealing, for those who haven't read it. ;-)
Also, you need to add quotes to the echo'ed vars, as Mr Marples outlined:
ifv() {
[[ $1 ]] && echo "$2" || echo "$3"
}
If you don't, the vars will be split according to IFS, and treated as
separate parameters, eg:
~ $ a=$'blah\nfoo'
~ $ echo "$a"
blah
foo
~ $ echo $a
blah foo
The following sums up the whole quoting issue IMO:
"At its base, a shell is simply a macro processor that executes commands.
The term macro processor means functionality where text and symbols are
expanded to create larger expressions."
http://tiswww.tis.case.edu/~chet/bash/bashref.html
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] Re: More general interface to use flags
2007-11-04 10:54 ` [gentoo-dev] " Steve Long
@ 2007-11-04 21:54 ` Alec Warner
2007-11-06 11:50 ` Steve Long
0 siblings, 1 reply; 38+ messages in thread
From: Alec Warner @ 2007-11-04 21:54 UTC (permalink / raw
To: gentoo-dev; +Cc: gentoo-portage-dev
On 11/4/07, Steve Long <slong@rathaus.eclipse.co.uk> wrote:
> Marijn Schouten (hkBst) wrote:
> > the current interface to use flags, useq, usev, use_with, use_enable, as
> > defined in /usr/lib/portage/bin/ebuild.sh lacks generality. The common
> > thing is testing a use flag and possibly echoing a string, but there is no
> > function that implements this common behaviour.
> >
> > I propose that we add such a function. Proposed name for the function is
> > "ifuse".
> >
> I like the overall API that is enabled (and that it doesn't break anything.)
>
> > I also propose to add the utility function "ifv" which is useful for
> > writing concise and clean code.
> >
> This one seems a bit light-weight to me, but if it makes your life easier,
> why not?
>
> One minor thing; -n is the default test, so:
> [[ $1 ]] is the same as [[ -n $1 ]]
> and:
> [[ ! $1 ]] is the same as [[ -z $1 ]]
> ''help test'' is very revealing, for those who haven't read it. ;-)
Code Clarity over shortcuts. Use the explicit version.
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-03 0:47 ` Roy Marples
@ 2007-11-05 9:22 ` Michael Haubenwallner
2007-11-05 10:13 ` Roy Marples
0 siblings, 1 reply; 38+ messages in thread
From: Michael Haubenwallner @ 2007-11-05 9:22 UTC (permalink / raw
To: gentoo-dev
On Sat, 2007-11-03 at 00:47 +0000, Roy Marples wrote:
As it seems too few people really accept your suggestion, I feel it's
time for me to chime in too, although I don't know what exactly POSIX-sh
standard defines.
> On Sat, 2007-11-03 at 01:19 +0100, Fabian Groffen wrote:
> > On 02-11-2007 17:35:08 +0000, Roy Marples wrote:
> > > I don't see them as inferior.
> > > I see them as more portable and less confusing.
> >
> > Please stop calling it "more portable".
>
> But is it more portable as then then works across more than one shell.
>
> > The shell code you see in
> > configure can in a way be called "portable". Your POSIX compliant stuff
> > isn't.
>
> Sure it is - it should work on a shell that claims POSIX compliance.
>
> > In fact, by stating #!/bin/sh you actually make the code useless
> > on a number of platforms, where it would have been working fine if there
> > just were #!/bin/bash there.
>
> Then the issue is to fix their sh so it follows POSIX compliance.
> As soon as a dash, bb or FreeBSD sh issue is found where it deviates
> from POSIX but it works on bash a lot of people say "dash bug, therefore
> invalid
Agreed, but (speaking for alt/prefix):
Alt/prefix is designed to (mainly) work without superuser access on the
target machine, which may also be Solaris, AIX, HP-UX and the like.
/bin/sh on such a machine is not POSIX-shell, but old bourne-shell
(unfortunately with bugs often).
And it is _impossible_ to have sysadmins to get /bin/sh a POSIX-Shell
nor to have that bugs fixed.
But yes, on most machines there is /bin/ksh, which IMHO is POSIX
compliant (maybe also with non-fixable bugs).
Although I do not know yet for which _installed_ scripts it'd be really
useful to have them non-bash in alt/prefix, I appreciate the discussion.
To see benefits for alt/prefix too, it _might_ require that discussion
going from requiring /bin/sh being POSIX-sh towards being
bourne-shell...
>
> > It seems to me that you actually mean "more FreeBSD-able" or something,
> > which is a high price to pay for a relatively small part of Gentoo as a
> > whole.
>
> More embeddable.
> More BSDable.
> More Linuxable - bash isn't the only linux shell, there are plently of
> others.
More (generic) unix-able.
/haubi/
--
Michael Haubenwallner
Gentoo on a different level
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-05 9:22 ` Michael Haubenwallner
@ 2007-11-05 10:13 ` Roy Marples
2007-11-05 13:21 ` Michael Haubenwallner
0 siblings, 1 reply; 38+ messages in thread
From: Roy Marples @ 2007-11-05 10:13 UTC (permalink / raw
To: gentoo-dev
While I still have access to the u@g.o email, I'll respond here.
On Mon, 2007-11-05 at 10:22 +0100, Michael Haubenwallner wrote:
> On Sat, 2007-11-03 at 00:47 +0000, Roy Marples wrote:
>
> As it seems too few people really accept your suggestion, I feel it's
> time for me to chime in too, although I don't know what exactly POSIX-sh
> standard defines.
> Agreed, but (speaking for alt/prefix):
>
> Alt/prefix is designed to (mainly) work without superuser access on the
> target machine, which may also be Solaris, AIX, HP-UX and the like.
> /bin/sh on such a machine is not POSIX-shell, but old bourne-shell
> (unfortunately with bugs often).
> And it is _impossible_ to have sysadmins to get /bin/sh a POSIX-Shell
> nor to have that bugs fixed.
>
> But yes, on most machines there is /bin/ksh, which IMHO is POSIX
> compliant (maybe also with non-fixable bugs).
>
> Although I do not know yet for which _installed_ scripts it'd be really
> useful to have them non-bash in alt/prefix, I appreciate the discussion.
>
> To see benefits for alt/prefix too, it _might_ require that discussion
> going from requiring /bin/sh being POSIX-sh towards being
> bourne-shell...
Actually you missed the mark completely.
Nothing in the tree itself specifies what shell to use - instead it's
the package manager. So the PM on Gentoo/Linux/FreeBSD *could*
be /bin/sh and on the systems where /bin/sh is not possible to change to
a POSIX compliant shell then it can still use /bin/bash or wherever it's
installed.
This also applies to the userland tools. If the ebuild or eclass *has*
to use the GNU variants then it should either adjust $PATH so that it
finds them first, or it prefixes them all with g, like it does on
Gentoo/FreeBSD.
None of this is technically challenging in itself, it's just that the
key people who would have to do the work to make this possible have
already given a flat out no.
> > > It seems to me that you actually mean "more FreeBSD-able" or something,
> > > which is a high price to pay for a relatively small part of Gentoo as a
> > > whole.
> >
> > More embeddable.
> > More BSDable.
> > More Linuxable - bash isn't the only linux shell, there are plently of
> > others.
>
> More (generic) unix-able.
Exactly so :)
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-05 10:13 ` Roy Marples
@ 2007-11-05 13:21 ` Michael Haubenwallner
2007-11-05 20:21 ` Mike Frysinger
2007-11-05 20:32 ` Roy Marples
0 siblings, 2 replies; 38+ messages in thread
From: Michael Haubenwallner @ 2007-11-05 13:21 UTC (permalink / raw
To: gentoo-dev
On Mon, 2007-11-05 at 10:13 +0000, Roy Marples wrote:
> While I still have access to the u@g.o email, I'll respond here.
>
>
> On Mon, 2007-11-05 at 10:22 +0100, Michael Haubenwallner wrote:
> > On Sat, 2007-11-03 at 00:47 +0000, Roy Marples wrote:
> >
> > As it seems too few people really accept your suggestion, I feel it's
> > time for me to chime in too, although I don't know what exactly POSIX-sh
> > standard defines.
>
> > Agreed, but (speaking for alt/prefix):
> >
> > Alt/prefix is designed to (mainly) work without superuser access on the
> > target machine, which may also be Solaris, AIX, HP-UX and the like.
> > /bin/sh on such a machine is not POSIX-shell, but old bourne-shell
> > (unfortunately with bugs often).
> > And it is _impossible_ to have sysadmins to get /bin/sh a POSIX-Shell
> > nor to have that bugs fixed.
> >
> > But yes, on most machines there is /bin/ksh, which IMHO is POSIX
> > compliant (maybe also with non-fixable bugs).
> >
> > Although I do not know yet for which _installed_ scripts it'd be really
> > useful to have them non-bash in alt/prefix, I appreciate the discussion.
> >
> > To see benefits for alt/prefix too, it _might_ require that discussion
> > going from requiring /bin/sh being POSIX-sh towards being
> > bourne-shell...
>
> Actually you missed the mark completely.
> Nothing in the tree itself specifies what shell to use - instead it's
> the package manager. So the PM on Gentoo/Linux/FreeBSD *could*
> be /bin/sh and on the systems where /bin/sh is not possible to change to
> a POSIX compliant shell then it can still use /bin/bash or wherever it's
> installed.
So "have the installed scripts to not require bash" is another topic ?
Ok then:
Given that we want to have the tree "more generic unix-able":
What is the benefit from having the tree being POSIX- but not
bourne-shell compatible, so one still needs bash on Solaris/AIX/HP-UX ?
Because I'd say those three are the biggest substitutes for "unix",
while I'd call *BSD and Linux just "unix derivates" (although with
enhancements)...
>
> This also applies to the userland tools. If the ebuild or eclass *has*
> to use the GNU variants then it should either adjust $PATH so that it
> finds them first, or it prefixes them all with g, like it does on
> Gentoo/FreeBSD.
>
> None of this is technically challenging in itself, it's just that the
> key people who would have to do the work to make this possible have
> already given a flat out no.
In the early prefix days I had some portage enhancement, providing a
wrapper-function around all coreutils/findutils/diffutils/grep/others,
trying to find a GNU implementation for them. And if not found, try to
map some args to the native ones ("xargs -r" fex - although didn't work
as shell-function).
But then we decided to always provide USERLAND=GNU in prefix and this
portage patch was thrown away.
>
> > > > It seems to me that you actually mean "more FreeBSD-able" or something,
> > > > which is a high price to pay for a relatively small part of Gentoo as a
> > > > whole.
> > >
> > > More embeddable.
> > > More BSDable.
> > > More Linuxable - bash isn't the only linux shell, there are plently of
> > > others.
> >
> > More (generic) unix-able.
>
> Exactly so :)
Not really as long as not being bourne shell compatible like autoconf's
configure. I won't trust to have a POSIX shell like /bin/ksh everywhere,
but /bin/sh only, which usually is just a bourne shell on "unix".
/haubi/
--
Michael Haubenwallner
Gentoo on a different level
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-05 13:21 ` Michael Haubenwallner
@ 2007-11-05 20:21 ` Mike Frysinger
2007-11-05 23:18 ` Roy Marples
2007-11-05 20:32 ` Roy Marples
1 sibling, 1 reply; 38+ messages in thread
From: Mike Frysinger @ 2007-11-05 20:21 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 2998 bytes --]
On Monday 05 November 2007, Michael Haubenwallner wrote:
> On Mon, 2007-11-05 at 10:13 +0000, Roy Marples wrote:
> > While I still have access to the u@g.o email, I'll respond here.
> >
> > On Mon, 2007-11-05 at 10:22 +0100, Michael Haubenwallner wrote:
> > > On Sat, 2007-11-03 at 00:47 +0000, Roy Marples wrote:
> > >
> > > As it seems too few people really accept your suggestion, I feel it's
> > > time for me to chime in too, although I don't know what exactly
> > > POSIX-sh standard defines.
> > >
> > > Agreed, but (speaking for alt/prefix):
> > >
> > > Alt/prefix is designed to (mainly) work without superuser access on the
> > > target machine, which may also be Solaris, AIX, HP-UX and the like.
> > > /bin/sh on such a machine is not POSIX-shell, but old bourne-shell
> > > (unfortunately with bugs often).
> > > And it is _impossible_ to have sysadmins to get /bin/sh a POSIX-Shell
> > > nor to have that bugs fixed.
> > >
> > > But yes, on most machines there is /bin/ksh, which IMHO is POSIX
> > > compliant (maybe also with non-fixable bugs).
> > >
> > > Although I do not know yet for which _installed_ scripts it'd be really
> > > useful to have them non-bash in alt/prefix, I appreciate the
> > > discussion.
> > >
> > > To see benefits for alt/prefix too, it _might_ require that discussion
> > > going from requiring /bin/sh being POSIX-sh towards being
> > > bourne-shell...
> >
> > Actually you missed the mark completely.
> > Nothing in the tree itself specifies what shell to use - instead it's
> > the package manager. So the PM on Gentoo/Linux/FreeBSD *could*
> > be /bin/sh and on the systems where /bin/sh is not possible to change to
> > a POSIX compliant shell then it can still use /bin/bash or wherever it's
> > installed.
>
> So "have the installed scripts to not require bash" is another topic ?
yes, and generally that's a baked topic. if your script is /bin/sh, then it
must be POSIX compliant. if your script is /bin/bash, then you're encouraged
to convert it to POSIX /bin/sh. but this is because the *runtime*
environment is generally a lot more restricted than that of the *buildtime*
environment. runtime implies a lot leaner requirements (think binary-only
systems, embedded systems, production systems, etc...) than that of a
development system (which requires everything in order to compile).
> Ok then:
> Given that we want to have the tree "more generic unix-able":
> What is the benefit from having the tree being POSIX- but not
> bourne-shell compatible, so one still needs bash on Solaris/AIX/HP-UX ?
> Because I'd say those three are the biggest substitutes for "unix",
> while I'd call *BSD and Linux just "unix derivates" (although with
> enhancements)...
we want the installed environment to be portable, not the build environment.
i do not see any benefit from forcing the build environment to be pure POSIX
compliant and i see many many detrimental problems.
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 827 bytes --]
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-05 13:21 ` Michael Haubenwallner
2007-11-05 20:21 ` Mike Frysinger
@ 2007-11-05 20:32 ` Roy Marples
2007-11-05 20:55 ` Fabian Groffen
2007-11-05 22:27 ` Mike Frysinger
1 sibling, 2 replies; 38+ messages in thread
From: Roy Marples @ 2007-11-05 20:32 UTC (permalink / raw
To: gentoo-dev
On Mon, 2007-11-05 at 14:21 +0100, Michael Haubenwallner wrote:
> > Actually you missed the mark completely.
> > Nothing in the tree itself specifies what shell to use - instead it's
> > the package manager. So the PM on Gentoo/Linux/FreeBSD *could*
> > be /bin/sh and on the systems where /bin/sh is not possible to change to
> > a POSIX compliant shell then it can still use /bin/bash or wherever it's
> > installed.
>
> So "have the installed scripts to not require bash" is another topic ?
No, it's a valid topic.
Either the profile could hook src_unpack or the ebuild could call a
function to do this
sed -e '1 s,^#!/bin/sh,#!/path/to/bash,'
Either for all files in CONTENTS or all arguments passed.
>
> Ok then:
> Given that we want to have the tree "more generic unix-able":
> What is the benefit from having the tree being POSIX- but not
> bourne-shell compatible, so one still needs bash on Solaris/AIX/HP-UX ?
> Because I'd say those three are the biggest substitutes for "unix",
> while I'd call *BSD and Linux just "unix derivates" (although with
> enhancements)...
The benefit is that we're not locked into any one toolset. This makes
development of the tree more attractive to non Linux developers I would
say.
> > This also applies to the userland tools. If the ebuild or eclass *has*
> > to use the GNU variants then it should either adjust $PATH so that it
> > finds them first, or it prefixes them all with g, like it does on
> > Gentoo/FreeBSD.
> >
> > None of this is technically challenging in itself, it's just that the
> > key people who would have to do the work to make this possible have
> > already given a flat out no.
>
> In the early prefix days I had some portage enhancement, providing a
> wrapper-function around all coreutils/findutils/diffutils/grep/others,
> trying to find a GNU implementation for them. And if not found, try to
> map some args to the native ones ("xargs -r" fex - although didn't work
> as shell-function).
> But then we decided to always provide USERLAND=GNU in prefix and this
> portage patch was thrown away.
I dislike wrappers. The maintainers of revdep-rebuild say the same thing
and I'm sure others would as well.
An alternative would be to say have a list of ebuilds that don't require
the GNU toolset (via an eclass or the ebuild itself) in a profile and
slowly update the ebuilds and the lists when we can make them work with
the desired userlands.
If it requires gratuitous use of extensions then maybe the package
itself should be patched upstream instead of us having to write overly
complex ebuilds.
Probably not the best idea for this, but workable.
> > > More (generic) unix-able.
> >
> > Exactly so :)
>
> Not really as long as not being bourne shell compatible like autoconf's
> configure. I won't trust to have a POSIX shell like /bin/ksh everywhere,
> but /bin/sh only, which usually is just a bourne shell on "unix".
As I said above, portage could change this.
Think of it as an #ifdef :)
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-05 20:32 ` Roy Marples
@ 2007-11-05 20:55 ` Fabian Groffen
2007-11-05 22:27 ` Mike Frysinger
1 sibling, 0 replies; 38+ messages in thread
From: Fabian Groffen @ 2007-11-05 20:55 UTC (permalink / raw
To: gentoo-dev
On 05-11-2007 20:32:09 +0000, Roy Marples wrote:
> > > > More (generic) unix-able.
> > >
> > > Exactly so :)
> >
> > Not really as long as not being bourne shell compatible like autoconf's
> > configure. I won't trust to have a POSIX shell like /bin/ksh everywhere,
> > but /bin/sh only, which usually is just a bourne shell on "unix".
>
> As I said above, portage could change this.
> Think of it as an #ifdef :)
We already (have to) do this, and it is not as trivial as you think.
Though, as Mike pointed out, we sort of all agree that scripts outside
of portage should be POSIX sh.
--
Fabian Groffen
Gentoo on a different level
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-05 20:32 ` Roy Marples
2007-11-05 20:55 ` Fabian Groffen
@ 2007-11-05 22:27 ` Mike Frysinger
1 sibling, 0 replies; 38+ messages in thread
From: Mike Frysinger @ 2007-11-05 22:27 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 808 bytes --]
On Monday 05 November 2007, Roy Marples wrote:
> On Mon, 2007-11-05 at 14:21 +0100, Michael Haubenwallner wrote:
> > > Actually you missed the mark completely.
> > > Nothing in the tree itself specifies what shell to use - instead it's
> > > the package manager. So the PM on Gentoo/Linux/FreeBSD *could*
> > > be /bin/sh and on the systems where /bin/sh is not possible to change
> > > to a POSIX compliant shell then it can still use /bin/bash or wherever
> > > it's installed.
> >
> > So "have the installed scripts to not require bash" is another topic ?
>
> No, it's a valid topic.
he didnt say it was invalid, just a different topic
> Either the profile could hook src_unpack or the ebuild could call a
> function to do this
>
> sed -e '1 s,^#!/bin/sh,#!/path/to/bash,'
fix the packages i say
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 827 bytes --]
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-05 20:21 ` Mike Frysinger
@ 2007-11-05 23:18 ` Roy Marples
2007-11-06 7:12 ` Ciaran McCreesh
2007-11-06 9:04 ` Michael Haubenwallner
0 siblings, 2 replies; 38+ messages in thread
From: Roy Marples @ 2007-11-05 23:18 UTC (permalink / raw
To: gentoo-dev
On Mon, 2007-11-05 at 16:21 -0400, Mike Frysinger wrote:
> we want the installed environment to be portable, not the build environment.
> i do not see any benefit from forcing the build environment to be pure POSIX
> compliant and i see many many detrimental problems.
Oh I don't know. Imagine how cool it would be for starting a new port.
1) Install PM
2) Wang on a portage tree
3) emerge ready to go
Obviously it's not quite that simple as portage requires python and
pkgcore require python, paludis requires tr1-whatever libs - but that's
the restriction of the PM used. Maybe one day Gentoo will have a PM that
doesn't require any of that and is just written in C and sh, using POSIX
libc where it can.
But enough pipe dreaming :)
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-05 23:18 ` Roy Marples
@ 2007-11-06 7:12 ` Ciaran McCreesh
2007-11-06 7:40 ` Roy Marples
2007-11-06 9:04 ` Michael Haubenwallner
1 sibling, 1 reply; 38+ messages in thread
From: Ciaran McCreesh @ 2007-11-06 7:12 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 510 bytes --]
On Mon, 05 Nov 2007 23:18:43 +0000
Roy Marples <uberlord@gentoo.org> wrote:
> paludis requires tr1-whatever libs
4.1 ships those, so you don't need to do anything there.
> Maybe one day Gentoo will have a PM that doesn't require any of that
> and is just written in C and sh, using POSIX libc where it can.
Except it won't, because ebuilds require bash regardless of which
package manager is being used. If you want to change that you'll have to
rewrite the entire tree.
--
Ciaran McCreesh
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-06 7:12 ` Ciaran McCreesh
@ 2007-11-06 7:40 ` Roy Marples
2007-11-06 8:03 ` Ciaran McCreesh
0 siblings, 1 reply; 38+ messages in thread
From: Roy Marples @ 2007-11-06 7:40 UTC (permalink / raw
To: gentoo-dev
On Tue, 2007-11-06 at 07:12 +0000, Ciaran McCreesh wrote:
> Except it won't, because ebuilds require bash regardless of which
> package manager is being used. If you want to change that you'll have to
> rewrite the entire tree.
Az once said near enough the same thing about baselayout. And that's
your view, your entitled to it, but it is not my view. Change a little
bit here, a little bit there. Slowly does it.
Yes, I know that a fair chunk of the tree will need a re-write, just in
the same way that the init scripts got a re-write. It will take time, it
will not happen magically over night. To think overwise is foolish :)
But if the default shell remains bash but the PM had enough knobs on it
so this could be changed (maybe per ebuild) in /etc then work *could*
start.
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-06 7:40 ` Roy Marples
@ 2007-11-06 8:03 ` Ciaran McCreesh
2007-11-06 8:25 ` Roy Marples
0 siblings, 1 reply; 38+ messages in thread
From: Ciaran McCreesh @ 2007-11-06 8:03 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 996 bytes --]
On Tue, 06 Nov 2007 07:40:20 +0000
Roy Marples <uberlord@gentoo.org> wrote:
> On Tue, 2007-11-06 at 07:12 +0000, Ciaran McCreesh wrote:
> > Except it won't, because ebuilds require bash regardless of which
> > package manager is being used. If you want to change that you'll
> > have to rewrite the entire tree.
>
> Az once said near enough the same thing about baselayout. And that's
> your view, your entitled to it, but it is not my view. Change a little
> bit here, a little bit there. Slowly does it.
It's not a view. It's a simple fact.
> Yes, I know that a fair chunk of the tree will need a re-write, just
> in the same way that the init scripts got a re-write. It will take
> time, it will not happen magically over night. To think overwise is
> foolish :)
How many lines of code are in baselayout? How many in the tree?
Pushing for non-bash for ebuilds is pointless. The cost of using bash is
tiny; the cost of not using bash is huge.
--
Ciaran McCreesh
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-06 8:03 ` Ciaran McCreesh
@ 2007-11-06 8:25 ` Roy Marples
0 siblings, 0 replies; 38+ messages in thread
From: Roy Marples @ 2007-11-06 8:25 UTC (permalink / raw
To: gentoo-dev
On Tue, 2007-11-06 at 08:03 +0000, Ciaran McCreesh wrote:
> On Tue, 06 Nov 2007 07:40:20 +0000
> Roy Marples <uberlord@gentoo.org> wrote:
> > On Tue, 2007-11-06 at 07:12 +0000, Ciaran McCreesh wrote:
> > > Except it won't, because ebuilds require bash regardless of which
> > > package manager is being used. If you want to change that you'll
> > > have to rewrite the entire tree.
> >
> > Az once said near enough the same thing about baselayout. And that's
> > your view, your entitled to it, but it is not my view. Change a little
> > bit here, a little bit there. Slowly does it.
>
> It's not a view. It's a simple fact.
It's my considered opinion that it's a view.
You are free to call it what you like.
> > Yes, I know that a fair chunk of the tree will need a re-write, just
> > in the same way that the init scripts got a re-write. It will take
> > time, it will not happen magically over night. To think overwise is
> > foolish :)
>
> How many lines of code are in baselayout? How many in the tree?
>
> Pushing for non-bash for ebuilds is pointless. The cost of using bash is
> tiny; the cost of not using bash is huge.
Size of baselayout compared to the tree is small vs huge. But unlike
baselayout, the ebuilds themselves should be relatively easy as they
don't normally use bash specific features [1]. The real work is in the
eclasses which make extensive use of bash specific features, such as
arrays. A quick look at the dir shows that there's probably a similar
number of eclasses to the number of init scripts installed by ebuilds.
[1] The one expection being ${var//foo/var} which is used a fair bit. It
could also be argued that versionator should be used more which oddly
enough should also reduce the use of this bashism.
Thanks
Roy
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] POSIX shell and "portable"
2007-11-05 23:18 ` Roy Marples
2007-11-06 7:12 ` Ciaran McCreesh
@ 2007-11-06 9:04 ` Michael Haubenwallner
1 sibling, 0 replies; 38+ messages in thread
From: Michael Haubenwallner @ 2007-11-06 9:04 UTC (permalink / raw
To: gentoo-dev
On Mon, 2007-11-05 at 23:18 +0000, Roy Marples wrote:
> On Mon, 2007-11-05 at 16:21 -0400, Mike Frysinger wrote:
> > we want the installed environment to be portable, not the build environment.
> > i do not see any benefit from forcing the build environment to be pure POSIX
> > compliant and i see many many detrimental problems.
>
> Oh I don't know. Imagine how cool it would be for starting a new port.
>
> 1) Install PM
> 2) Wang on a portage tree
> 3) emerge ready to go
>
> Obviously it's not quite that simple as portage requires python and
> pkgcore require python, paludis requires tr1-whatever libs - but that's
> the restriction of the PM used. Maybe one day Gentoo will have a PM that
> doesn't require any of that and is just written in C and sh, using POSIX
> libc where it can.
>
> But enough pipe dreaming :)
Stop dreaming: Some very rudimentary thing like this already exists:
To bootstrap an alt/prefix instance on AIX, HPUX, whatever-unix-without-
sufficient-GNU-userland, we're using some "prefix-launcher"[1].
This simply is a "package fetcher/patcher/builder/installer", where a
single package is defined by some ".build"-script, which is written in
plain bourne shell. You might (should) find some gentoo ideas if you
look inside it ;)
Now to install {python, bash, (prefix-)portage, wget, patch, diffutils,
findutils, gcc, etc.} one single command[2] (think "emerge system") does
it all, just requiring GNU make, /bin/sh being bourne shell, some ansi-c
compiler, some (non-GNU) tar, gunzip, (non-GNU) sed, (non-GNU) whatever.
So the only non-native (not installed by default) thing required is GNU
make, which is available as binary package without any dependencies for
each "unix" I've seen.
[1] http://sourceforge.net/projects/prefix-launcher/
[2] http://prefix-launcher.wiki.sourceforge.net/
/haubi/
--
Michael Haubenwallner
Gentoo on a different level
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [gentoo-dev] Re: More general interface to use flags
2007-11-04 21:54 ` Alec Warner
@ 2007-11-06 11:50 ` Steve Long
0 siblings, 0 replies; 38+ messages in thread
From: Steve Long @ 2007-11-06 11:50 UTC (permalink / raw
To: gentoo-dev; +Cc: gentoo-portage-dev
Alec Warner wrote:
> On 11/4/07, Steve Long <slong@rathaus.eclipse.co.uk> wrote:
>> One minor thing; -n is the default test, so:
>> [[ $1 ]] is the same as [[ -n $1 ]]
>> and:
>> [[ ! $1 ]] is the same as [[ -z $1 ]]
>> ''help test'' is very revealing, for those who haven't read it. ;-)
>
> Code Clarity over shortcuts. Use the explicit version.
There's nothing unclear about [[ $1 ]] IMO. But whatever floats
your "${boat}" ;)
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 38+ messages in thread
end of thread, other threads:[~2007-11-06 11:57 UTC | newest]
Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-02 13:44 [gentoo-dev] More general interface to use flags Marijn Schouten (hkBst)
2007-11-02 14:04 ` Roy Marples
2007-11-02 14:27 ` Marijn Schouten (hkBst)
2007-11-02 14:52 ` Roy Marples
2007-11-02 14:59 ` Mike Frysinger
2007-11-02 15:30 ` Roy Marples
2007-11-02 15:38 ` Mike Frysinger
2007-11-02 15:48 ` Roy Marples
2007-11-02 15:58 ` Mike Frysinger
2007-11-02 16:10 ` Roy Marples
2007-11-02 16:30 ` Bo Ørsted Andresen
2007-11-02 16:52 ` Roy Marples
2007-11-02 17:17 ` Bo Ørsted Andresen
2007-11-02 17:35 ` Roy Marples
2007-11-03 0:19 ` [gentoo-dev] POSIX shell and "portable" Fabian Groffen
2007-11-03 0:47 ` Roy Marples
2007-11-05 9:22 ` Michael Haubenwallner
2007-11-05 10:13 ` Roy Marples
2007-11-05 13:21 ` Michael Haubenwallner
2007-11-05 20:21 ` Mike Frysinger
2007-11-05 23:18 ` Roy Marples
2007-11-06 7:12 ` Ciaran McCreesh
2007-11-06 7:40 ` Roy Marples
2007-11-06 8:03 ` Ciaran McCreesh
2007-11-06 8:25 ` Roy Marples
2007-11-06 9:04 ` Michael Haubenwallner
2007-11-05 20:32 ` Roy Marples
2007-11-05 20:55 ` Fabian Groffen
2007-11-05 22:27 ` Mike Frysinger
2007-11-03 0:57 ` Natanael copa
2007-11-03 1:06 ` Roy Marples
2007-11-03 16:19 ` [gentoo-dev] " Steve Long
2007-11-03 1:10 ` [gentoo-dev] " Roy Marples
[not found] ` <b41005390711022225i4f30bb01jbf5a040c60c4b088@mail.gmail.com>
2007-11-03 5:26 ` Fwd: [gentoo-dev] More general interface to use flags Alec Warner
2007-11-03 21:57 ` Mike Frysinger
2007-11-04 10:54 ` [gentoo-dev] " Steve Long
2007-11-04 21:54 ` Alec Warner
2007-11-06 11:50 ` Steve Long
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox