From fc1ba9ba7b2ed82fa499e815bc41eb9abfed56ff Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Wed, 7 Oct 2020 19:04:21 +0200 Subject: [PATCH] pmbootstrap install: don't screw up /etc/apk/world (MR 1981) Do not attempt to upgrade packages in the rootfs chroot when running "pmbootstrap install". This was responsible for placing every single package in /etc/apk/world (which should only hold the packages explicitly installed), because the upgrade function was literally implemented as getting a list of installed packages and explicitly running pmb.chroot.apk.install on each of them. The intention was to rebuild these packages if they were outdated, I guess I didn't realize that this makes /etc/apk/world unusable when I introduced this three years ago in 51bdc243 ("Properly rebuild/install packages when something changed"). Remove pmb.chroot.apk.upgrade altogether, because: 1) pmb.install.install builds and upgrades outdated pmaports 2) pmb.install.install is the only user of pmb.chroot.apk.upgrade 3) 'pmbootstrap init' is warning that the chroots do not get upgraded automatically, so let's not go against that expectation. users who want an updated rootfs chroot can simply run zap and install again. Replace it with a call to pmb.helpers.repo.update, because we still need to update the APKINDEX files before attempting to build/install the generated list of packages. --- pmb/chroot/apk.py | 13 ------------- pmb/install/_install.py | 5 +++-- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/pmb/chroot/apk.py b/pmb/chroot/apk.py index 8ca4e153..6ae0776f 100644 --- a/pmb/chroot/apk.py +++ b/pmb/chroot/apk.py @@ -237,19 +237,6 @@ def install(args, packages, suffix="native", build=True): pmb.chroot.root(args, ["apk", "--no-progress"] + command, suffix=suffix, disable_timeout=True) -def upgrade(args, suffix="native"): - """ - Upgrade all packages installed in a chroot - """ - # Update APKINDEX files - arch = pmb.parse.arch.from_chroot_suffix(args, suffix) - pmb.helpers.repo.update(args, arch) - - # Rebuild and upgrade out-of-date packages - packages = list(installed(args, suffix).keys()) - install(args, packages, suffix) - - def installed(args, suffix="native"): """ Read the list of installed packages (which has almost the same format, as diff --git a/pmb/install/_install.py b/pmb/install/_install.py index 5a723e99..c3276d39 100644 --- a/pmb/install/_install.py +++ b/pmb/install/_install.py @@ -681,8 +681,8 @@ def install(args): install_packages += ["postmarketos-ui-" + args.ui] if args.ui_extras: install_packages += ["postmarketos-ui-" + args.ui + "-extras"] - suffix = "rootfs_" + args.device - pmb.chroot.apk.upgrade(args, suffix) + + pmb.helpers.repo.update(args, args.deviceinfo["arch"]) # Create final user and remove 'build' user set_user(args) @@ -700,6 +700,7 @@ def install(args): # Install all packages to device rootfs chroot (and rebuild the initramfs, # because that doesn't always happen automatically yet, e.g. when the user # installed a hook without pmbootstrap - see #69 for more info) + suffix = "rootfs_" + args.device pmb.chroot.apk.install(args, install_packages, suffix) pmb.install.file.write_os_release(args, suffix) for flavor in pmb.chroot.other.kernel_flavors_installed(args, suffix):