diff --git a/pmb/build/autodetect.py b/pmb/build/autodetect.py index 9526d300..7d75df1f 100644 --- a/pmb/build/autodetect.py +++ b/pmb/build/autodetect.py @@ -57,7 +57,10 @@ def arch(args, pkgname): if arch_device in arches: return arch_device - return apkbuild["arch"][0] + try: + return apkbuild["arch"][0] + except IndexError: + return None def suffix(args, apkbuild, arch): diff --git a/pmb/build/menuconfig.py b/pmb/build/menuconfig.py index ae4fcd0c..f9e32a3e 100644 --- a/pmb/build/menuconfig.py +++ b/pmb/build/menuconfig.py @@ -25,6 +25,11 @@ def get_arch(args, apkbuild): """ pkgname = apkbuild["pkgname"] + # Disabled package (arch="") + if not apkbuild["arch"]: + raise RuntimeError(f"'{pkgname}' is disabled (arch=\"\"). Please use" + " '--arch' to specify the desired architecture.") + # Multiple architectures if len(apkbuild["arch"]) > 1: raise RuntimeError(f"'{pkgname}' supports multiple architectures" diff --git a/pmb/parse/_apkbuild.py b/pmb/parse/_apkbuild.py index da4604c1..6d743645 100644 --- a/pmb/parse/_apkbuild.py +++ b/pmb/parse/_apkbuild.py @@ -312,10 +312,6 @@ def apkbuild(args, path, check_pkgver=True, check_pkgname=True): raise RuntimeError("The pkgname must be equal to the name of" " the folder, that contains the APKBUILD!") - # Sanity check: arch - if not len(ret["arch"]): - raise RuntimeError("Arch must not be empty: " + path) - # Sanity check: pkgver if check_pkgver: if "-r" in ret["pkgver"] or not pmb.parse.version.validate(ret["pkgver"]):