for d in ("binpkgs", "distfiles", "repos/gentoo"):
(state.cache_dir / d).mkdir(parents=True, exist_ok=True)
- copy_path(state.pkgmngr, stage3, preserve_owner=False)
+ copy_tree(state.config, 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,