]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
arch: Use gpgdir from host system 1009/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 15 Jun 2022 20:24:41 +0000 (16:24 -0400)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 16 Jun 2022 13:14:33 +0000 (09:14 -0400)
Instead of setting up the keyring in the image, let's reuse the
keyring from the host. If users want to use pacman in the image,
they just have to run pacman-key themselves in a postinst script
or such.

This speeds up building of images and hopefully also gets rid of
our CI issues with Arch where there's something keeping files open
in the root mount (which I expect is gpg-agent).

NEWS.md
mkosi/__init__.py

diff --git a/NEWS.md b/NEWS.md
index 8a96f43831378ce91eff2e71af022d99713311bc..967473bb993576650875d963d619edd8fcf0971a 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
 - mkosi won't default to the same OS release as the host system anymore when the host system uses the same
   distribution as the image that's being built. Instead, when no release is specified, mkosi will now always
   default to the default version embedded in mkosi itself.
+- mkosi will now use the pacman keyring from the host when building Arch images. This means that users will,
+  on top of installing archlinux-keyring, also have to run `pacman-key --init` and
+  `pacman-key --populate archlinux` on the host system to be able to build Arch images. Also, unless the
+  package manager is configured to do it automatically, the host keyring will have to be updated after
+  archlinux-keyring updates by running `pacman-key --populate archlinux` and `pacman-key --updatedb`.
+
 
 ## v12
 
index 7c2fc3d23ad01f60374ead207ee55bbc84cc0940..071e2daee9b884db84cfa50dd887926788950865 100644 (file)
@@ -2959,13 +2959,7 @@ def install_ubuntu(args: MkosiArgs, root: Path, do_run_build_script: bool) -> No
 
 
 def run_pacman(root: Path, pacman_conf: Path, packages: Set[str]) -> None:
-    try:
-        run(["pacman-key", "--config", pacman_conf, "--init"])
-        run(["pacman-key", "--config", pacman_conf, "--populate"])
-        run(["pacman", "--config", pacman_conf, "--noconfirm", "-Sy", *sort_packages(packages)])
-    finally:
-        # Kill the gpg-agent started by pacman and pacman-key.
-        run(["gpgconf", "--homedir", root / "etc/pacman.d/gnupg", "--kill", "all"])
+    run(["pacman", "--config", pacman_conf, "--noconfirm", "-Sy", *sort_packages(packages)])
 
 
 @complete_step("Installing Arch Linux…")
@@ -3026,7 +3020,7 @@ def install_arch(args: MkosiArgs, root: Path, do_run_build_script: bool) -> None
                 RootDir = {root}
                 LogFile = /dev/null
                 CacheDir = {root}/var/cache/pacman/pkg/
-                GPGDir = {root}/etc/pacman.d/gnupg/
+                GPGDir = /etc/pacman.d/gnupg/
                 HookDir = {root}/etc/pacman.d/hooks/
                 HoldPkg = pacman glibc
                 Architecture = auto