]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
debian/ubuntu: Pass Architecture option to apt
authorMarek Vasut <marex@denx.de>
Thu, 1 Sep 2022 00:16:09 +0000 (20:16 -0400)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Tue, 6 Sep 2022 08:34:00 +0000 (10:34 +0200)
Pass the target architecture to apt, otherwise mkosi ... --architecture
pulls in packages for the host architecture. This fixes generation of
container images for non-host architectures, e.g. generation of images
on amd64 host for arm64 target.

mkosi/__init__.py

index 7d48cfc7c71d248225192fe073f6513db2766e9f..cdbffc9457d9b71a5b0856f5a2c4d50e4d925869 100644 (file)
@@ -2451,10 +2451,13 @@ def invoke_apt(
     **kwargs: Any,
 ) -> CompletedProcess:
 
+    debarch = DEBIAN_ARCHITECTURES[config.architecture]
+
     cmdline = [
         f"/usr/bin/apt-{subcommand}",
         "-o", f"Dir={root}",
         "-o", f"DPkg::Chroot-Directory={root}",
+        "-o", f"APT::Architecture={debarch}",
         operation,
         *extra,
     ]