From: Daan De Meyer Date: Sat, 22 Jul 2023 14:53:43 +0000 (+0200) Subject: gentoo: Set FEATURES by appending to /etc/portage/make.conf X-Git-Tag: v15~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68d5cc53989e63aa32f05d3415c018bedca741cd;p=thirdparty%2Fmkosi.git gentoo: Set FEATURES by appending to /etc/portage/make.conf Setting via the environment variable doesn't work in all cases, so let's append to /etc/portage/make.conf instead. This allows us to get rid of the custom devtpms for portage as it doesn't try to chown tty's anymore now that userpriv is actually disabled. --- diff --git a/mkosi/distributions/gentoo.py b/mkosi/distributions/gentoo.py index 0d4aa70c0..e99e031a2 100644 --- a/mkosi/distributions/gentoo.py +++ b/mkosi/distributions/gentoo.py @@ -19,7 +19,6 @@ from mkosi.types import PathString def invoke_emerge(state: MkosiState, packages: Sequence[str] = (), apivfs: bool = True) -> None: bwrap( cmd=[ - "sh", "-c", "chmod 1777 /dev/shm && exec $0 \"$@\" || exit $?", "emerge", *packages, "--update", @@ -48,26 +47,11 @@ def invoke_emerge(state: MkosiState, packages: Sequence[str] = (), apivfs: bool "--bind", state.cache_dir / "stage3/var", "/var", "--ro-bind", "/etc/resolv.conf", "/etc/resolv.conf", "--bind", state.cache_dir / "repos", "/var/db/repos", - # https://bugs.gentoo.org/910587 - "--dev", "/dev", ], env=dict( PKGDIR=str(state.cache_dir / "binpkgs"), DISTDIR=str(state.cache_dir / "distfiles"), - FEATURES=" ".join([ - "getbinpkg", - "-candy", - # Disable sandboxing in emerge because we already do it in mkosi. - "-sandbox", - "-userfetch", - "-userpriv", - "-usersandbox", - "-usersync", - "-ebuild-locks", - "parallel-install", - *(["noman", "nodoc", "noinfo"] if state.config.with_docs else []), - ]), - ) | {"USE": "build"} if not apivfs else {} | state.config.environment, + ) | ({"USE": "build"} if not apivfs else {}) | state.config.environment, ) @@ -142,6 +126,25 @@ class GentooInstaller(DistributionInstaller): copy_path(state.pkgmngr, stage3, preserve_owner=False) + features = " ".join([ + "getbinpkg", + "-candy", + # Disable sandboxing in emerge because we already do it in mkosi. + "-sandbox", + "-userfetch", + "-userpriv", + "-usersandbox", + "-usersync", + "-ebuild-locks", + "parallel-install", + *(["noman", "nodoc", "noinfo"] if state.config.with_docs else []), + ]) + + # Setting FEATURES via the environment variable does not seem to apply to ebuilds in portage, so we + # append to /etc/portage/make.conf instead. + with (stage3 / "etc/portage/make.conf").open("a") as f: + f.write(f"\nFEATURES=\"${{FEATURES}} {features}\"\n") + bwrap( cmd=["chroot", "emerge-webrsync"], apivfs=stage3,