diff --git a/pmb/build/package.py b/pmb/build/package.py index 6b8de703..5d605e90 100644 --- a/pmb/build/package.py +++ b/pmb/build/package.py @@ -51,16 +51,16 @@ def package(args, pkgname, carch, force=False, recurse=True): cross = pmb.build.autodetect.crosscompile(args, apkbuild, carch_buildenv, suffix) + # Build dependencies first (they may be outdated, even if they exist) + if recurse: + for depend in apkbuild["depends"]: + package(args, depend, carch) + # Skip already built versions if not force and not pmb.build.is_necessary(args, suffix, carch_buildenv, apkbuild): return - # Build dependencies first - if recurse: - for depend in apkbuild["depends"]: - package(args, depend, carch) - # Install build tools and makedepends pmb.build.init(args, suffix) if len(apkbuild["makedepends"]): diff --git a/pmb/chroot/apk.py b/pmb/chroot/apk.py index 879a3e15..61fd25f6 100644 --- a/pmb/chroot/apk.py +++ b/pmb/chroot/apk.py @@ -58,17 +58,23 @@ def install(args, packages, suffix="native", build=True): pmb.chroot.root(args, ["apk", "--no-progress", "add"] + packages_todo, suffix) -# Update all packages installed in a chroot - -def update(args, suffix="native"): +def upgrade(args, suffix="native", update_index=True): + """ + Upgrade all packages installed in a chroot + """ pmb.chroot.init(args, suffix) - pmb.chroot.root(args, ["apk", "update"], suffix) + if update_index: + pmb.chroot.root(args, ["apk", "update"], suffix) -# Get all explicitly installed packages + # -a: also update previously downgraded (and therefore pinned) packages + pmb.chroot.root(args, ["apk", "upgrade", "-a"], suffix) def installed(args, suffix="native"): + """ + Get all explicitly installed packages + """ world = args.work + "/chroot_" + suffix + "/etc/apk/world" if not os.path.exists(world): return [] diff --git a/pmb/install/install.py b/pmb/install/install.py index 2cf1685d..3c34af7c 100644 --- a/pmb/install/install.py +++ b/pmb/install/install.py @@ -82,12 +82,17 @@ def install(args, show_flash_msg=True): pmb.chroot.apk.install(args, pmb.config.install_native_packages, build=False) - # Install all packages to device rootfs chroot + # Explicitly call build on the install packages, to re-build it or any + # dependency, in case the version increased logging.info("*** (2/5) CREATE DEVICE ROOTFS (" + args.device + ") ***") + install_packages = pmb.config.install_device_packages + ["device-" + args.device] + for pkgname in install_packages: + pmb.build.package(args, pkgname, args.deviceinfo["arch"]) + + # Install all packages to device rootfs chroot suffix = "rootfs_" + args.device - pmb.chroot.apk.install(args, pmb.config.install_device_packages + - ["device-" + args.device], suffix) - pmb.chroot.apk.update(args, suffix) + pmb.chroot.apk.install(args, install_packages, suffix) + pmb.chroot.apk.upgrade(args, suffix) set_user_password(args) # Partition and fill image/sdcard