Re: bin/isolated-functions.sh USERLAND setting

Fabian Groffen <[email protected]> Thu, 28 Jul 2022 20:11:24 +0200
Newsgroups gmane.linux.gentoo.portage.devel
Organization Gentoo Foundation, Inc.
Message-ID <YuLRTNcuewKR/[email protected]>
--rKpVAygeOLWcWux/
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 28-07-2022 19:57:50 +0200, Arfrever Frehtes Taifersar Arahesis wrote:
> 2022-07-28 17:47 UTC=E3=81=AB=E3=80=81Fabian Groffen <[email protected]>=
=E3=81=AF=E6=9B=B8=E3=81=84=E3=81=9F:
> > bin/isolated-functions.sh does the following bit:
> >
> > if [[ -z ${USERLAND} ]] ; then
> >    case $(uname -s) in
> >    *BSD|DragonFly)
> >        export USERLAND=3D"BSD"
> >        ;;
> >    *)
> >        export USERLAND=3D"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=3DGNU.
>=20
> But this code starts with 'if [[ -z ${USERLAND} ]]', so it should not
> be run when USERLAND=3D"GNU".
>=20
> USERLAND=3D"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=3D, 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

--=20
Fabian Groffen
Gentoo on a different level

--rKpVAygeOLWcWux/
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEELUvHd/Gtp7LaU1vuzpXahU5EQpMFAmLi0UwACgkQzpXahU5E
QpO6LwgAn1QVleUc32FKWWzzYVQbmTZ64CKlZo+XF09QvP2Ha+w93TvC2mR98A+/
OLixGKwILhYtj9nI1I7jLgKwkdSJlEniU3wAQK719Ehl/w4blSjqbIFZLDs1OedZ
W0RetcawtCvb31vHEMoG2rIIJ305CZbVrB6DKZQ9UOAKuG4bg0MItYiRrQ5q8Hb5
I6FhHyyX88aE7gm9hRLeUZO8TF5bi75GC9AZwFog13eBhb07Pt6zkm8M71DRkpOB
fx0eyw5a0cU0Tkt3WIkA0mMs2Y9bh0a2Rx5wy2ZX3kFaFsqV/xfMz/JFgjCN2b6p
bpyYb46QgRhtAJj0CIWcj69fU7A3jw==
=CCTA
-----END PGP SIGNATURE-----

--rKpVAygeOLWcWux/--