Fix #68: properly update the device chroot in the install step

* build all dependencies, that have a newer version
* upgrade all packages inside the chroot
This commit is contained in:
Oliver Smith 2017-06-08 17:54:53 +02:00
parent 9e945423d9
commit f1ab344f09
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
3 changed files with 25 additions and 14 deletions

View File

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

View File

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

View File

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