forked from Mirror/pmbootstrap
Support arch="" in APKBUILD to skip builds (MR 1985)
Alpine indicates with arch="", that a package should temporarily not be built for any architecture. Support this in postmarketOS too by not complaining in the APKBUILD parser if arch is empty. Adjust pmb.build.autodetect.arch and pmb.build.menuconfig.get_arch, so both don't fail with an IndexError when encountering a disabled package. Co-Authored-By: Luca Weiss <luca@z3ntu.xyz>
This commit is contained in:
parent
112e72b068
commit
173f90d796
3 changed files with 9 additions and 5 deletions
|
@ -57,7 +57,10 @@ def arch(args, pkgname):
|
||||||
if arch_device in arches:
|
if arch_device in arches:
|
||||||
return arch_device
|
return arch_device
|
||||||
|
|
||||||
|
try:
|
||||||
return apkbuild["arch"][0]
|
return apkbuild["arch"][0]
|
||||||
|
except IndexError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def suffix(args, apkbuild, arch):
|
def suffix(args, apkbuild, arch):
|
||||||
|
|
|
@ -25,6 +25,11 @@ def get_arch(args, apkbuild):
|
||||||
"""
|
"""
|
||||||
pkgname = apkbuild["pkgname"]
|
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
|
# Multiple architectures
|
||||||
if len(apkbuild["arch"]) > 1:
|
if len(apkbuild["arch"]) > 1:
|
||||||
raise RuntimeError(f"'{pkgname}' supports multiple architectures"
|
raise RuntimeError(f"'{pkgname}' supports multiple architectures"
|
||||||
|
|
|
@ -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"
|
raise RuntimeError("The pkgname must be equal to the name of"
|
||||||
" the folder, that contains the APKBUILD!")
|
" 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
|
# Sanity check: pkgver
|
||||||
if check_pkgver:
|
if check_pkgver:
|
||||||
if "-r" in ret["pkgver"] or not pmb.parse.version.validate(ret["pkgver"]):
|
if "-r" in ret["pkgver"] or not pmb.parse.version.validate(ret["pkgver"]):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue