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.
This commit is contained in:
Oliver Smith 2020-10-07 19:04:21 +02:00 committed by Martijn Braam
parent 864469531c
commit fc1ba9ba7b
No known key found for this signature in database
GPG Key ID: C4280ACB000B060F
2 changed files with 3 additions and 15 deletions

View File

@ -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

View File

@ -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):