pmb.helpers.package.check_arch(): split (!1776)
Split the part that actually checks the arch against the arches list into pmb.helpers.pmaports.check_arches(arches, arch), and call it from pmb.helpers.package.check_arch(args, pkgname, arch, binary). This will be used in a follow up commit, where we have already resolved the package data and only need to check the architecture.
This commit is contained in:
parent
9241dbb35b
commit
99e7ae3019
|
@ -164,13 +164,7 @@ def check_arch(args, pkgname, arch, binary=True):
|
|||
arches = get(args, pkgname, arch)["arch"]
|
||||
else:
|
||||
arches = pmb.helpers.pmaports.get(args, pkgname)["arch"]
|
||||
|
||||
if "!" + arch in arches:
|
||||
return False
|
||||
for value in [arch, "all", "noarch"]:
|
||||
if value in arches:
|
||||
return True
|
||||
return False
|
||||
return pmb.helpers.pmaports.check_arches(arches, arch)
|
||||
|
||||
|
||||
def check_arch_recurse(args, pkgname, arch):
|
||||
|
|
|
@ -166,3 +166,20 @@ def get_repo(args, pkgname, must_exist=True):
|
|||
if not aport:
|
||||
return None
|
||||
return os.path.basename(os.path.dirname(aport))
|
||||
|
||||
|
||||
def check_arches(arches, arch):
|
||||
""" Check if building for a certain arch is allowed.
|
||||
|
||||
:param arches: list of all supported arches, as it can be found in the
|
||||
arch="" line of APKBUILDS (including all, noarch,
|
||||
!arch, ...). For example: ["x86_64", "x86", "!armhf"]
|
||||
:param arch: the architecture to check for
|
||||
:returns: True when building is allowed, False otherwise
|
||||
"""
|
||||
if "!" + arch in arches:
|
||||
return False
|
||||
for value in [arch, "all", "noarch"]:
|
||||
if value in arches:
|
||||
return True
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue