From fdbb8eebb8313b310ba933c863608b1a9b97fcf7 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sun, 6 Aug 2023 20:43:28 +0200 Subject: [PATCH] chroot: /mnt/pmbootstrap-* -> /mnt/pmbootstrap/* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Have one /mnt/pmbootstrap directory with subdirectories, instead of several /mnt/pmbootstrap-* directories. Reviewed-by: Pablo Correa Gómez Reviewed-by: Luca Weiss Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230806184729.4891-2-ollieparanoid@postmarketos.org%3E --- pmb/build/_package.py | 2 +- pmb/build/init.py | 2 +- pmb/chroot/apk.py | 4 ++-- pmb/config/__init__.py | 30 +++++++++++++++--------------- pmb/helpers/repo.py | 6 +++--- pmb/install/_install.py | 4 ++-- pmb/netboot/__init__.py | 2 +- test/test_helpers_repo.py | 4 ++-- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/pmb/build/_package.py b/pmb/build/_package.py index 884c931f..c5eb151a 100644 --- a/pmb/build/_package.py +++ b/pmb/build/_package.py @@ -260,7 +260,7 @@ def override_source(args, apkbuild, pkgver, src, suffix="native"): return # Mount source in chroot - mount_path = "/mnt/pmbootstrap-source-override/" + mount_path = "/mnt/pmbootstrap/source-override/" mount_path_outside = args.work + "/chroot_" + suffix + mount_path pmb.helpers.mount.bind(args, src, mount_path_outside, umount=True) diff --git a/pmb/build/init.py b/pmb/build/init.py index b56c6c2c..f10ae73c 100644 --- a/pmb/build/init.py +++ b/pmb/build/init.py @@ -54,7 +54,7 @@ def init(args, suffix="native"): # Copy package signing key to /etc/apk/keys for key in glob.glob(chroot + - "/mnt/pmbootstrap-abuild-config/*.pub"): + "/mnt/pmbootstrap/abuild-config/*.pub"): key = key[len(chroot):] pmb.chroot.root(args, ["cp", key, "/etc/apk/keys/"], suffix) diff --git a/pmb/chroot/apk.py b/pmb/chroot/apk.py index 926f92c1..aa190e1e 100644 --- a/pmb/chroot/apk.py +++ b/pmb/chroot/apk.py @@ -143,7 +143,7 @@ def packages_get_locally_built_apks(args, packages, arch): :param packages: list of pkgnames :param arch: architecture that the locally built packages should have :returns: list of apk file paths that are valid inside the chroots, e.g. - ["/mnt/pmbootstrap-packages/x86_64/hello-world-1-r6.apk", ...] + ["/mnt/pmbootstrap/packages/x86_64/hello-world-1-r6.apk", ...] """ channel = pmb.config.pmaports.read_config(args)["channel"] ret = [] @@ -157,7 +157,7 @@ def packages_get_locally_built_apks(args, packages, arch): if not os.path.exists(f"{args.work}/packages/{channel}/{arch}/{apk_file}"): continue - ret.append(f"/mnt/pmbootstrap-packages/{arch}/{apk_file}") + ret.append(f"/mnt/pmbootstrap/packages/{arch}/{apk_file}") return ret diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py index d0dac15f..2ded467a 100644 --- a/pmb/config/__init__.py +++ b/pmb/config/__init__.py @@ -210,15 +210,15 @@ chroot_mount_bind = { "/proc": "/proc", "$WORK/cache_apk_$ARCH": "/var/cache/apk", "$WORK/cache_appstream/$ARCH/$CHANNEL": "/mnt/appstream-data", - "$WORK/cache_ccache_$ARCH": "/mnt/pmbootstrap-ccache", + "$WORK/cache_ccache_$ARCH": "/mnt/pmbootstrap/ccache", "$WORK/cache_distfiles": "/var/cache/distfiles", - "$WORK/cache_git": "/mnt/pmbootstrap-git", - "$WORK/cache_go": "/mnt/pmbootstrap-go", - "$WORK/cache_rust": "/mnt/pmbootstrap-rust", - "$WORK/config_abuild": "/mnt/pmbootstrap-abuild-config", + "$WORK/cache_git": "/mnt/pmbootstrap/git", + "$WORK/cache_go": "/mnt/pmbootstrap/go", + "$WORK/cache_rust": "/mnt/pmbootstrap/rust", + "$WORK/config_abuild": "/mnt/pmbootstrap/abuild-config", "$WORK/config_apk_keys": "/etc/apk/keys", - "$WORK/images_netboot": "/mnt/pmbootstrap-netboot", - "$WORK/packages/$CHANNEL": "/mnt/pmbootstrap-packages", + "$WORK/images_netboot": "/mnt/pmbootstrap/netboot", + "$WORK/packages/$CHANNEL": "/mnt/pmbootstrap/packages", } # Building chroots (all chroots, except for the rootfs_ chroot) get symlinks in @@ -234,14 +234,14 @@ chroot_mount_bind = { # rust depends caching described above) and to cache build artifacts (GOCACHE, # similar to ccache). chroot_home_symlinks = { - "/mnt/pmbootstrap-abuild-config": "/home/pmos/.abuild", - "/mnt/pmbootstrap-ccache": "/home/pmos/.ccache", - "/mnt/pmbootstrap-packages": "/home/pmos/packages/pmos", - "/mnt/pmbootstrap-go/gocache": "/home/pmos/.cache/go-build", - "/mnt/pmbootstrap-go/gomodcache": "/home/pmos/go/pkg/mod", - "/mnt/pmbootstrap-rust/registry/index": "/home/pmos/.cargo/registry/index", - "/mnt/pmbootstrap-rust/registry/cache": "/home/pmos/.cargo/registry/cache", - "/mnt/pmbootstrap-rust/git/db": "/home/pmos/.cargo/git/db", + "/mnt/pmbootstrap/abuild-config": "/home/pmos/.abuild", + "/mnt/pmbootstrap/ccache": "/home/pmos/.ccache", + "/mnt/pmbootstrap/packages": "/home/pmos/packages/pmos", + "/mnt/pmbootstrap/go/gocache": "/home/pmos/.cache/go-build", + "/mnt/pmbootstrap/go/gomodcache": "/home/pmos/go/pkg/mod", + "/mnt/pmbootstrap/rust/registry/index": "/home/pmos/.cargo/registry/index", + "/mnt/pmbootstrap/rust/registry/cache": "/home/pmos/.cargo/registry/cache", + "/mnt/pmbootstrap/rust/git/db": "/home/pmos/.cargo/git/db", } # Device nodes to be created in each chroot. Syntax for each entry: diff --git a/pmb/helpers/repo.py b/pmb/helpers/repo.py index cb5847c8..76d09be8 100644 --- a/pmb/helpers/repo.py +++ b/pmb/helpers/repo.py @@ -43,10 +43,10 @@ def hash(url, length=8): def urls(args, user_repository=True, postmarketos_mirror=True, alpine=True): """ Get a list of repository URLs, as they are in /etc/apk/repositories. - :param user_repository: add /mnt/pmbootstrap-packages + :param user_repository: add /mnt/pmbootstrap/packages :param postmarketos_mirror: add postmarketos mirror URLs :param alpine: add alpine mirror URLs - :returns: list of mirror strings, like ["/mnt/pmbootstrap-packages", + :returns: list of mirror strings, like ["/mnt/pmbootstrap/packages", "http://...", ...] """ ret = [] @@ -59,7 +59,7 @@ def urls(args, user_repository=True, postmarketos_mirror=True, alpine=True): # Local user repository (for packages compiled with pmbootstrap) if user_repository: - ret.append("/mnt/pmbootstrap-packages") + ret.append("/mnt/pmbootstrap/packages") # Upstream postmarketOS binary repository if postmarketos_mirror: diff --git a/pmb/install/_install.py b/pmb/install/_install.py index 652434ae..4b7ff47c 100644 --- a/pmb/install/_install.py +++ b/pmb/install/_install.py @@ -165,7 +165,7 @@ def configure_apk(args): """ Copy over all official keys, and the keys used to compile local packages (unless --no-local-pkgs is set). Then copy the corresponding APKINDEX files - and remove the /mnt/pmbootstrap-packages repository. + and remove the /mnt/pmbootstrap/packages repository. """ # Official keys pattern = f"{pmb.config.apk_keys_path}/*.pub" @@ -187,7 +187,7 @@ def configure_apk(args): pmb.helpers.run.root(args, ["cp", f, rootfs + "/var/cache/apk/"]) # Disable pmbootstrap repository - pmb.helpers.run.root(args, ["sed", "-i", r"/\/mnt\/pmbootstrap-packages/d", + pmb.helpers.run.root(args, ["sed", "-i", r"/\/mnt\/pmbootstrap\/packages/d", rootfs + "/etc/apk/repositories"]) pmb.helpers.run.user(args, ["cat", rootfs + "/etc/apk/repositories"]) diff --git a/pmb/netboot/__init__.py b/pmb/netboot/__init__.py index 1cd4904c..c05449fc 100644 --- a/pmb/netboot/__init__.py +++ b/pmb/netboot/__init__.py @@ -20,7 +20,7 @@ def start_nbd_server(args, ip="172.16.42.2", port=9999): chroot = f"{args.work}/chroot_native" - rootfs_path = f"/mnt/pmbootstrap-netboot/{args.device}.img" + rootfs_path = f"/mnt/pmbootstrap/netboot/{args.device}.img" if not os.path.exists(chroot + rootfs_path) or args.replace: rootfs_path2 = f"/home/pmos/rootfs/{args.device}.img" if not os.path.exists(chroot + rootfs_path2): diff --git a/test/test_helpers_repo.py b/test/test_helpers_repo.py index 1589378d..0b180ad2 100644 --- a/test/test_helpers_repo.py +++ b/test/test_helpers_repo.py @@ -51,7 +51,7 @@ def test_urls(args, monkeypatch): monkeypatch.setattr(pmb.config.pmaports, "read_config", read_config) # Channel: v20.05 - assert func(args) == ["/mnt/pmbootstrap-packages", + assert func(args) == ["/mnt/pmbootstrap/packages", "http://localhost/pmos1/v20.05", "http://localhost/pmos2/v20.05", "http://localhost/alpine/v3.11/main", @@ -59,7 +59,7 @@ def test_urls(args, monkeypatch): # Channel: edge (has Alpine's testing) channel = "edge" - assert func(args) == ["/mnt/pmbootstrap-packages", + assert func(args) == ["/mnt/pmbootstrap/packages", "http://localhost/pmos1/master", "http://localhost/pmos2/master", "http://localhost/alpine/edge/main",