]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
ubuntu: Replace platform.machine() check with args.architecture check
authorMarek Vasut <marex@denx.de>
Sun, 25 Sep 2022 04:39:39 +0000 (06:39 +0200)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Tue, 27 Sep 2022 06:58:02 +0000 (08:58 +0200)
Test args.architecture instead when selecting the ports.ubuntu.com .
The args.architecture will default to "aarch64" if running on a aarch64
machine and respect command line --architecture switch as well. This is
necessary in case the mkosi is generating foreign architecture container
(e.g. mkosi on amd64 generates arm64 container).

Fix security.ubuntu.com URL, which has to point to ubuntu-ports for
aarch64 machines.

mkosi/__init__.py

index 323cf922062aea7be8d20f89afaaad206697ba49..95bc76d4052d245f0b38bc3ae125e80ba5d4fc79 100644 (file)
@@ -2464,7 +2464,10 @@ def add_apt_auxiliary_repos(state: MkosiState, repos: Set[str]) -> None:
 
     # Security updates repos are never mirrored
     if state.config.distribution == Distribution.ubuntu:
-        security = f"deb http://security.ubuntu.com/ubuntu/ {state.config.release}-security {' '.join(repos)}"
+        if state.config.architecture == "x86" or state.config.architecture == "x86_64":
+            security = f"deb http://security.ubuntu.com/ubuntu/ {state.config.release}-security {' '.join(repos)}"
+        else:
+            security = f"deb http://ports.ubuntu.com/ {state.config.release}-security {' '.join(repos)}"
     elif state.config.release in ("stretch", "buster"):
         security = f"deb http://security.debian.org/debian-security/ {state.config.release}/updates main"
     else:
@@ -6411,9 +6414,10 @@ def load_args(args: argparse.Namespace) -> MkosiConfig:
         elif args.distribution == Distribution.debian:
             args.mirror = "http://deb.debian.org/debian"
         elif args.distribution == Distribution.ubuntu:
-            args.mirror = "http://archive.ubuntu.com/ubuntu"
-            if platform.machine() == "aarch64":
-                args.mirror = "http://ports.ubuntu.com/"
+            if args.architecture == "x86" or args.architecture == "x86_64":
+                args.mirror = "http://archive.ubuntu.com/ubuntu"
+            else:
+                args.mirror = "http://ports.ubuntu.com"
         elif args.distribution == Distribution.arch:
             if args.architecture == "aarch64":
                 args.mirror = "http://mirror.archlinuxarm.org"