pmb.parse: show which package require the missing package (MR 2150)
When a dependency is not found it now shows all the pacakges that require that dependency in the error message.
This commit is contained in:
parent
fd7050835f
commit
81dc4c17f6
|
@ -123,6 +123,7 @@ def recurse(args, pkgnames, suffix="native"):
|
||||||
|
|
||||||
# Iterate over todo-list until is is empty
|
# Iterate over todo-list until is is empty
|
||||||
todo = list(pkgnames)
|
todo = list(pkgnames)
|
||||||
|
required_by = {}
|
||||||
ret = []
|
ret = []
|
||||||
while len(todo):
|
while len(todo):
|
||||||
# Skip already passed entries
|
# Skip already passed entries
|
||||||
|
@ -138,9 +139,12 @@ def recurse(args, pkgnames, suffix="native"):
|
||||||
|
|
||||||
# Nothing found
|
# Nothing found
|
||||||
if not package:
|
if not package:
|
||||||
|
source = 'world'
|
||||||
|
if pkgname_depend in required_by:
|
||||||
|
source = ', '.join(required_by[pkgname_depend])
|
||||||
raise RuntimeError(f"Could not find dependency '{pkgname_depend}' "
|
raise RuntimeError(f"Could not find dependency '{pkgname_depend}' "
|
||||||
"in any aports folder or APKINDEX. See:"
|
f"in any aports folder or APKINDEX. Required by: {source}. "
|
||||||
" <https://postmarketos.org/depends>")
|
"See: <https://postmarketos.org/depends>")
|
||||||
|
|
||||||
# Append to todo/ret (unless it is a duplicate)
|
# Append to todo/ret (unless it is a duplicate)
|
||||||
pkgname = package["pkgname"]
|
pkgname = package["pkgname"]
|
||||||
|
@ -151,5 +155,9 @@ def recurse(args, pkgnames, suffix="native"):
|
||||||
logging.verbose(f"{pkgname}: depends on: {','.join(depends)}")
|
logging.verbose(f"{pkgname}: depends on: {','.join(depends)}")
|
||||||
if depends:
|
if depends:
|
||||||
todo += depends
|
todo += depends
|
||||||
|
for dep in depends:
|
||||||
|
if dep not in required_by:
|
||||||
|
required_by[dep] = set()
|
||||||
|
required_by[dep].add(pkgname_depend)
|
||||||
ret.append(pkgname)
|
ret.append(pkgname)
|
||||||
return ret
|
return ret
|
||||||
|
|
Loading…
Reference in New Issue