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.
This commit is contained in:
Oliver Smith 2018-02-25 20:49:47 +00:00 committed by GitHub
parent 6b9e7ecf75
commit 937686d164
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 4 deletions

View File

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