diff --git a/pmb/build/other.py b/pmb/build/other.py index 7928f22c..561aaab9 100644 --- a/pmb/build/other.py +++ b/pmb/build/other.py @@ -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: diff --git a/test/test_build_is_necessary.py b/test/test_build_is_necessary.py index 0f43f4a4..35eb4bbc 100644 --- a/test/test_build_is_necessary.py +++ b/test/test_build_is_necessary.py @@ -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