]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
gentoo: unmerge baselayout early on.
authorPaymon MARANDI <darwinskernel@gmail.com>
Wed, 24 Nov 2021 17:36:59 +0000 (12:36 -0500)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 26 Nov 2021 08:23:59 +0000 (09:23 +0100)
fixes ``Couldn't find '=sys-apps/baselayout-2.7' to unmerge``

intro:
there are 2 problems that require messing with baselayout package.
both are being worked on upstream [bug1][bug2].

1. `/etc/os-release` missing `VERSION_ID` which causes KUI generated by
   dracut/installkernel et al not being accepted by the firmware/bootloader.

2. `/usr` is not merged in stage3. but `baselayout` with `"USE=build
   -split-usr"` has a usrmerge layout.

[bug1] is fixed but that fix hasn't made it into the release.
[bug2] has 6 blocking bugs as of this writing.

we merge baselayout before copying stage3 tree over into `root` so the
usrmerge layout is in place.

source of the problem:
hard-coded baselayout version, "-2.7", was the source of the problem
which was inevitable to cause problem once upstream bumped the version
of baselayout they ship with stage3.

in the old logic we removed baselayout by hand during fetch_fix_stage3()
by removing members of baselaouy_qlist array from stage3 before copying
stage3 tree into `root`. this would cause the root to have two "slots"
of baselayout installed which the call to `emerge(1)` in `update_stage3`
would try to fix by removing the *bad* slot (=sys-apps/baselayout-2.7).

the new logic simply unmerges stage3's baselayout during
fetch_fix_stage3() using emerge(1).

[bug1]: https://bugs.gentoo.org/788190
[bug2]: https://bugs.gentoo.org/690294

Signed-off-by: Paymon MARANDI <darwinskernel@gmail.com>
mkosi/gentoo.py

index 1972753b59522cc1fd956651b3c49498e5a1a5e4..9cef73988abeac67fc8e8b89981e53838a1e49ee 100644 (file)
@@ -261,7 +261,7 @@ class Gentoo:
         self.set_useflags()
         self.mkosi_conf()
         self.baselayout(args, root)
-        self.fetch_fix_stage3(root)
+        self.fetch_fix_stage3(args, root)
         self.update_stage3(args, root)
         self.depclean(args, root)
 
@@ -269,7 +269,7 @@ class Gentoo:
                           root: Path) -> None:
         self.invoke_emerge(args, root, inside_stage3=False, actions=["--sync"])
 
-    def fetch_fix_stage3(self, root: Path) -> None:
+    def fetch_fix_stage3(self, args: CommandLineArguments, root: Path) -> None:
         """usrmerge tracker bug: https://bugs.gentoo.org/690294"""
 
         # e.g.:
@@ -323,41 +323,8 @@ class Gentoo:
                 # remove once upstream ships the current *baselayout-999*
                 # version alternative would be to mount /sys as tmpfs when
                 # invoking emerge inside stage3; we don't want that.
-                baselaouy_qlist = [
-                    "etc/env.d/50baselayout",
-                    "etc/hosts",
-                    "etc/networks",
-                    "etc/profile",
-                    "etc/protocols",
-                    "etc/services",
-                    "etc/shells",
-                    "etc/filesystems",
-                    "etc/inputrc",
-                    "etc/issue",
-                    "etc/issue.logo",
-                    "etc/gentoo-release",
-                    "lib/modprobe.d/aliases.conf",
-                    "lib/modprobe.d/i386.conf",
-                    "lib/sysctl.d/00protected-links.conf",
-                    "usr/lib/os-release",
-                    "usr/share/baselayout/fstab",
-                    "usr/share/baselayout/group",
-                    "usr/share/baselayout/issue.devfix",
-                    "usr/share/baselayout/passwd",
-                    "usr/share/baselayout/shadow",
-                    "etc/os-release",
-                    "usr/share/applications/javaws.desktop",
-                    "usr/share/pixmaps/java-icon48.png",
-                    "etc/revdep-rebuild/60-java",
-                    "etc/profile.d/java-config-2.csh",
-                    "etc/profile.d/java-config-2.sh",
-                    "etc/env.d/20java-config",
-                    "etc/ssl/certs/java/.keep_sys-apps_baselayout-java-0",
-                    "etc/ca-certificates/update.d/java-cacerts",
-                ]
-                for path in baselaouy_qlist:
-                    if stage3_tmp_extract.joinpath(path).exists():
-                        stage3_tmp_extract.joinpath(path).unlink()
+                self.invoke_emerge(args, stage3_tmp_extract, inside_stage3=True,
+                        opts=["--unmerge"], pkgs=["sys-apps/baselayout"])
 
                 unlink_try_hard(stage3_tmp_extract.joinpath("dev"))
                 unlink_try_hard(stage3_tmp_extract.joinpath("proc"))
@@ -551,9 +518,6 @@ class Gentoo:
     def update_stage3(self, args: CommandLineArguments, root: Path) -> None:
         # exclude baselayout, it expects /sys/.keep but nspawn mounts host's
         # /sys for us without the .keep file.
-        self.invoke_emerge(args, root, inside_stage3=True,
-                           opts=["--unmerge"],
-                           pkgs=["=sys-apps/baselayout-2.7"])
         opts = self.EMERGE_UPDATE_OPTS + ["--exclude",
                                           "sys-apps/baselayout"]
         self.invoke_emerge(args, root, pkgs=self.pkgs_sys, opts=opts)