repo_missing: properly find subpackages, provides (!1724)

Do not fail anymore when attempting to start a new binary repository
build without any existing binary packages:
	pmbootstrap -mp="" repo_missing

Find subpackages defined with subpackage functions:
	subpackages="dev:mydevfunc"

Find provides defined with specific versions:
	provides="mkbootimg=1.0.0"
This commit is contained in:
Oliver Smith 2018-12-10 20:48:57 +01:00
parent 9cb27e5d22
commit d6f7571cb9
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 18 additions and 3 deletions

View File

@ -96,12 +96,27 @@ def find(args, package, must_exist=True):
elif len(paths) == 1:
ret = paths[0]
# Search in subpackages
# Search in subpackages and provides
if not ret:
for path_current in glob.glob(args.aports + "/*/*/APKBUILD"):
apkbuild = pmb.parse.apkbuild(args, path_current)
if (package in apkbuild["subpackages"] or
package in apkbuild["provides"]):
found = False
# Subpackages
for subpackage_i in apkbuild["subpackages"]:
if package == subpackage_i.split(":", 1)[0]:
found = True
break
# Provides (cut off before equals sign for entries like
# "mkbootimg=0.0.1")
if not found:
for provides_i in apkbuild["provides"]:
if package == provides_i.split("=", 1)[0]:
found = True
break
if found:
ret = os.path.dirname(path_current)
break