* Ignore `>`, `<`, `=` and `!` operators, when they are specified in the dependencies. This was the desired behavior before, but it was not implemented correctly (so it wouldn't ignore them everywhere). Of course the real fix would be to honor these operators like apk does. But this isn't feasible right now, and it should work for most, if not all, our use-cases. I have documented this in the wiki under build internals and if we happen to need correct operator handling, we should do it then. Minor other changes: * `pmbootstrap parse_apkindex`: support optional package parameter to only show the parsed content for one package. * Support building most python APKBUILDs by replacing ${pkgname#py-} properly
This commit is contained in:
parent
177f6ea592
commit
c730326d3c
|
@ -88,6 +88,11 @@ def parse_apkbuild(args):
|
|||
|
||||
def parse_apkindex(args):
|
||||
result = pmb.parse.apkindex.parse(args, args.apkindex_path)
|
||||
if args.package:
|
||||
if args.package not in result:
|
||||
raise RuntimeError("Package not found in the APKINDEX: " +
|
||||
args.package)
|
||||
result = result[args.package]
|
||||
print(json.dumps(result, indent=4))
|
||||
|
||||
|
||||
|
|
|
@ -53,6 +53,15 @@ def replace_variables(apkbuild):
|
|||
for var in ["_llvmver"]:
|
||||
makedepend = makedepend.replace("$" + var, ret[var])
|
||||
replaced += [makedepend]
|
||||
|
||||
# Python: ${pkgname#py-}
|
||||
if ret["pkgname"].startswith("py-"):
|
||||
replacement = ret["pkgname"][3:]
|
||||
for var in ["depends", "makedepends", "subpackages"]:
|
||||
for i in range(len(ret[var])):
|
||||
ret[var][i] = ret[var][i].replace(
|
||||
"${pkgname#py-}", replacement)
|
||||
|
||||
ret["makedepends"] = replaced
|
||||
return ret
|
||||
|
||||
|
|
|
@ -106,10 +106,19 @@ def parse_next_block(args, path, lines, start):
|
|||
# Format optional lists
|
||||
for key in ["provides", "depends"]:
|
||||
if key in ret and ret[key] != "":
|
||||
ret[key] = ret[key].split(" ")
|
||||
# Ignore all operators for now
|
||||
values = ret[key].split(" ")
|
||||
ret[key] = []
|
||||
for value in values:
|
||||
if value.startswith("!"):
|
||||
continue
|
||||
for operator in [">", "=", "<"]:
|
||||
if operator in value:
|
||||
value = value.split(operator)[0]
|
||||
break
|
||||
ret[key].append(value)
|
||||
else:
|
||||
ret[key] = []
|
||||
|
||||
return ret
|
||||
|
||||
# No more blocks
|
||||
|
@ -205,9 +214,7 @@ def parse(args, path, strict=False):
|
|||
parse_add_block(path, strict, ret, block)
|
||||
if "provides" in block:
|
||||
for alias in block["provides"]:
|
||||
split = alias.split("=")
|
||||
if len(split) == 2:
|
||||
parse_add_block(path, strict, ret, block, split[0])
|
||||
parse_add_block(path, strict, ret, block, alias)
|
||||
|
||||
# Update the cache
|
||||
args.cache["apkindex"][path] = {"lastmod": lastmod, "ret": ret}
|
||||
|
|
|
@ -198,6 +198,7 @@ def arguments():
|
|||
# Action: parse_apkindex
|
||||
parse_apkindex = sub.add_parser("parse_apkindex")
|
||||
parse_apkindex.add_argument("apkindex_path")
|
||||
parse_apkindex.add_argument("package", default=None, nargs="?")
|
||||
|
||||
# Use defaults from the user's config file
|
||||
args = parser.parse_args()
|
||||
|
|
|
@ -27,21 +27,11 @@ def apkindex(args, pkgname, arch):
|
|||
Non-recursively get the dependencies of one package in any APKINDEX.
|
||||
"""
|
||||
index_data = pmb.parse.apkindex.read_any_index(args, pkgname, arch)
|
||||
if not index_data:
|
||||
if index_data:
|
||||
return index_data["depends"]
|
||||
else:
|
||||
return None
|
||||
|
||||
# Remove operators from the depends list
|
||||
ret = []
|
||||
for depend in index_data["depends"]:
|
||||
if depend.startswith("!"):
|
||||
continue
|
||||
for operator in [">", "="]:
|
||||
if operator in depend:
|
||||
depend = depend.split(operator)[0]
|
||||
if depend not in ret:
|
||||
ret.append(depend)
|
||||
return ret
|
||||
|
||||
|
||||
def recurse_error_message(pkgname, in_aports, in_apkindexes):
|
||||
ret = "Could not find package '" + pkgname + "'"
|
||||
|
|
Loading…
Reference in New Issue