From 937686d164ba6bf9fece1490bb206ff65530fd15 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sun, 25 Feb 2018 20:49:47 +0000 Subject: [PATCH] Don't mark all packages as explicitly installed (#1247) pmbootstrap does dependency resolving on its own, and passes the list of resolved packages to apk when we want it to install something. The reason was outlined in #129: > fixing #120: packages do not get updated in "pmbootstrap install" > after they have been rebuilt. For this to work, we specify all > packages explicitly for abuild, instead of letting abuild do the > resolving. This new PR fixes #1212 (which noted that all of these dependencies were explicitly marked for installation) by doing the following: 1. All packages and dependencies get attached to the virtual package .pmbootstrap instead of world 2. We install the packages (without depends) explcitly 3. .pmbootstrap gets removed, which means that all packages from 1. stay installed, but are no longer marked as explicitly installed. They will get removed automatically, when the depending packages get removed. In addition, the mechanism for replacing the package of locally built packages with their full path, was broken and has been fixed in this commit. This is necessary to update packages of the same version with apk. --- pmb/chroot/apk.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pmb/chroot/apk.py b/pmb/chroot/apk.py index 8a87b20e..f7ab02ce 100644 --- a/pmb/chroot/apk.py +++ b/pmb/chroot/apk.py @@ -170,7 +170,7 @@ def replace_aports_packages_with_path(args, packages, suffix, arch): aport = pmb.build.find_aport(args, package, False) if aport: apkbuild = pmb.parse.apkbuild(args, aport + "/APKBUILD") - apk_path = ("/home/pmos/packages/pmos/" + arch + "/" + + apk_path = ("/mnt/pmbootstrap-packages/" + arch + "/" + package + "-" + apkbuild["pkgver"] + "-r" + apkbuild["pkgrel"] + ".apk") if os.path.exists(args.work + "/chroot_" + suffix + apk_path): @@ -217,11 +217,20 @@ def install(args, packages, suffix="native", build=True): message += " " + pkgname logging.info(message) - # Install/update everything + # Local packages: Using the path instead of pkgname makes apk update + # packages of the same version if the build date is different packages_todo = replace_aports_packages_with_path(args, packages_todo, suffix, arch) - pmb.chroot.root(args, ["apk", "--no-progress", "add", "-u"] + packages_todo, - suffix) + + # Use a virtual package to mark only the explicitly requested packages as + # explicitly installed, not their dependencies or specific paths (#1212) + commands = [["add"] + packages] + if packages != packages_todo: + commands = [["add", "-u", "--virtual", ".pmbootstrap"] + packages_todo, + ["add"] + packages, + ["del", ".pmbootstrap"]] + for command in commands: + pmb.chroot.root(args, ["apk", "--no-progress"] + command, suffix) def upgrade(args, suffix="native"):