Re: [gentoo-portage-dev] bin/isolated-functions.sh USERLAND setting

2022-07-28 Thread Fabian Groffen
On 28-07-2022 20:11:24 +0200, Fabian Groffen wrote:
> On 28-07-2022 19:57:50 +0200, Arfrever Frehtes Taifersar Arahesis wrote:
> > But this code starts with 'if [[ -z ${USERLAND} ]]', so it should not
> > be run when USERLAND="GNU".
> > 
> > USERLAND="GNU" is set in make.defaults, which is parsed by Portage
> > early (at Python side) and these values are passed by Portage to
> > ebuild.sh subprocess.
> 
> Hmmm, that would be nice, features/prefix/make.defaults includes setting
> that.
> 
> Makes me still wonder why we do this, is it a fallback for when the
> profiles aren't available (no tree yet) or something?
> 
> It exports XARGS, which only used in the ___parallel_xargs function.
> That function in turn is used in 2 places.  So all this stuff is done to
> add -r to xargs if xargs isn't BSD xargs.  Iow --no-run-if-empty, which
> is cool, but apparently not strictly necessary (fugly warning I guess at
> worst).  We're already checking xargs to support --max-procs=, so we
> could in the same go check for support of --no-run-if-empty, and drop
> the whole XARGS thing and declutter the code quite a lot :)

Sorry, I grepped wrong.  XARGS is used throughout the code, so it needs
to be initialised in isolated-functions.sh.  It could be initialised by
simply probing instead of relying on uname though.

As for USERLAND, emerge-webrsync and delta-webrsync appear to use it,
but they retrieve it from portageq, so I guess USERLAND is not really
used in Portage itself.

Fabian

-- 
Fabian Groffen
Gentoo on a different level


signature.asc
Description: PGP signature


Re: [gentoo-portage-dev] bin/isolated-functions.sh USERLAND setting

2022-07-28 Thread Fabian Groffen
On 28-07-2022 19:57:50 +0200, Arfrever Frehtes Taifersar Arahesis wrote:
> 2022-07-28 17:47 UTCに、Fabian Groffen は書いた:
> > bin/isolated-functions.sh does the following bit:
> >
> > if [[ -z ${USERLAND} ]] ; then
> >case $(uname -s) in
> >*BSD|DragonFly)
> >export USERLAND="BSD"
> >;;
> >*)
> >export USERLAND="GNU"
> >;;
> >esac
> > fi
> >
> > (after which it uses USERLAND for a single purpose, to export XARGS to
> > either GNU '[g]xargs -r', or BSD 'xargs')
> >
> > This bit is problematic for Prefix, because Prefix may run on *BSD, but
> > use USERLAND=GNU.
> 
> But this code starts with 'if [[ -z ${USERLAND} ]]', so it should not
> be run when USERLAND="GNU".
> 
> USERLAND="GNU" is set in make.defaults, which is parsed by Portage
> early (at Python side) and these values are passed by Portage to
> ebuild.sh subprocess.

Hmmm, that would be nice, features/prefix/make.defaults includes setting
that.

Makes me still wonder why we do this, is it a fallback for when the
profiles aren't available (no tree yet) or something?

It exports XARGS, which only used in the ___parallel_xargs function.
That function in turn is used in 2 places.  So all this stuff is done to
add -r to xargs if xargs isn't BSD xargs.  Iow --no-run-if-empty, which
is cool, but apparently not strictly necessary (fugly warning I guess at
worst).  We're already checking xargs to support --max-procs=, so we
could in the same go check for support of --no-run-if-empty, and drop
the whole XARGS thing and declutter the code quite a lot :)

Thanks,
Fabian

-- 
Fabian Groffen
Gentoo on a different level


signature.asc
Description: PGP signature


Re: [gentoo-portage-dev] bin/isolated-functions.sh USERLAND setting

2022-07-28 Thread Arfrever Frehtes Taifersar Arahesis
2022-07-28 17:47 UTCに、Fabian Groffen は書いた:
> bin/isolated-functions.sh does the following bit:
>
> if [[ -z ${USERLAND} ]] ; then
>case $(uname -s) in
>*BSD|DragonFly)
>export USERLAND="BSD"
>;;
>*)
>export USERLAND="GNU"
>;;
>esac
> fi
>
> (after which it uses USERLAND for a single purpose, to export XARGS to
> either GNU '[g]xargs -r', or BSD 'xargs')
>
> This bit is problematic for Prefix, because Prefix may run on *BSD, but
> use USERLAND=GNU.

But this code starts with 'if [[ -z ${USERLAND} ]]', so it should not
be run when USERLAND="GNU".

USERLAND="GNU" is set in make.defaults, which is parsed by Portage
early (at Python side) and these values are passed by Portage to
ebuild.sh subprocess.