Fix various build issues (fix #189, fix #341) (#345)

Changes:
* Removed the apkindex_files cache. That particular cache caused
  bug #189 and didn't bring any real-world performance improvements
  (tested 3x with that cache and 3x without, no significant speed
  difference). I decided to remove it instead of keeping it/adding
  even more code to resolve the bug.
* Fix the check for already built packages: always use the architecture,
  that the package should be built for instead of the architecture of
  the build environment (e.g. use armhf, even when building a noarch
  package in the x86_64 chroot). This partially resolves #341.
* Make pmb.chroot.apk.install_is_necessary() more robust: If the binary
  package is missing, although it should be there, print a warning and
  build it with force.
This commit is contained in:
Oliver Smith 2017-08-09 17:59:21 +00:00 committed by GitHub
parent 035e3807b5
commit 21c09b3b3c
4 changed files with 14 additions and 9 deletions

View File

@ -53,8 +53,7 @@ def package(args, pkgname, carch, force=False, buildinfo=False):
suffix)
# Skip already built versions
if not force and not pmb.build.is_necessary(
args, carch_buildenv, apkbuild):
if not force and not pmb.build.is_necessary(args, carch, apkbuild):
return
# Initialize build environment, install/build makedepends

View File

@ -122,9 +122,21 @@ def install_is_necessary(args, build, arch, package, packages_installed):
if package not in packages_installed:
return True
# Make sure, that we really have a binary package
data_repo = pmb.parse.apkindex.read_any_index(args, package, arch)
if not data_repo:
logging.warning("WARNING: Internal error in pmbootstrap," +
" package '" + package + "' for " + arch +
" has not been built yet, but it should have"
" been. Rebuilding it with force. Please "
" report this, if there is no ticket about this"
" yet!")
pmb.build.package(args, package, arch, True)
return install_is_necessary(args, build, arch, package,
packages_installed)
# Compare the installed version vs. the version in the repos
data_installed = packages_installed[package]
data_repo = pmb.parse.apkindex.read_any_index(args, package, arch)
compare = pmb.parse.apkindex.compare_version(data_installed["version"],
data_repo["version"])
# a) Installed newer (should not happen normally)

View File

@ -128,10 +128,6 @@ def apkindex_files(args, arch=None):
if not arch:
arch = args.arch_native
# Try to get a cached result first.
if arch in args.cache["apkindex_files"]:
return args.cache["apkindex_files"][arch]
# Local user repository (for packages compiled with pmbootstrap)
ret = [args.work + "/packages/" + arch + "/APKINDEX.tar.gz"]
@ -151,5 +147,4 @@ def apkindex_files(args, arch=None):
ret.append(args.work + "/cache_apk_" + arch + "/APKINDEX." +
hash(url) + ".tar.gz")
args.cache["apkindex_files"][arch] = ret
return ret

View File

@ -241,7 +241,6 @@ def arguments():
# Add a caching dict (caches parsing of files etc. for the current session)
setattr(args, "cache", {"apkindex": {},
"apkindex_files": {},
"apkbuild": {},
"apk_min_version_checked": [],
"apk_repository_list_updated": [],