pmb.build.is_necessary: fix case with Alpine's pkg (!1904)
No build is necessary if pmaport can't be built for given arch. pmbootstrap must use Alpine's binary package in that case, even if the pmaport version is higher than Alpine's binary package version. Fixes: #1897
This commit is contained in:
parent
44cb06d345
commit
b4a05cbcfb
|
@ -55,6 +55,13 @@ def is_necessary(args, arch, apkbuild, indexes=None):
|
|||
logging.debug(msg + "No binary package available")
|
||||
return True
|
||||
|
||||
# Can't build pmaport for arch: use Alpine's package (#1897)
|
||||
if arch and not pmb.helpers.pmaports.check_arches(apkbuild["arch"], arch):
|
||||
logging.verbose(f"{package}: build is not necessary, because pmaport"
|
||||
" can't be built for {arch}. Using Alpine's binary"
|
||||
" package.")
|
||||
return False
|
||||
|
||||
# a) Binary repo has a newer version
|
||||
version_old = index_data["version"]
|
||||
if pmb.parse.version.compare(version_old, version_new) == 1:
|
||||
|
|
|
@ -73,3 +73,15 @@ def test_build_is_necessary_no_binary_available(args):
|
|||
aport = pmb.helpers.pmaports.find(args, "hello-world")
|
||||
apkbuild = pmb.parse.apkbuild(args, aport + "/APKBUILD")
|
||||
assert pmb.build.is_necessary(args, None, apkbuild, indexes) is True
|
||||
|
||||
|
||||
def test_build_is_necessary_cant_build_pmaport_for_arch(args):
|
||||
""" pmaport version is higher than Alpine's binary package, but pmaport
|
||||
can't be built for given arch. (#1897) """
|
||||
|
||||
apkbuild = {"pkgname": "alpine-base",
|
||||
"arch": "armhf", # can't build for x86_64!
|
||||
"pkgver": "9999",
|
||||
"pkgrel": "0"}
|
||||
assert pmb.build.is_necessary(args, "x86_64", apkbuild) is False
|
||||
assert pmb.build.is_necessary(args, "armhf", apkbuild) is True
|
||||
|
|
Loading…
Reference in New Issue