replace_aports_packages_with_path: better error (!1837)

Because of an APKINDEX subpkg parsing bug, pmbootstrap currently assumes
that "ktp-common-internals" provides "make". It fails with a cryptic
error when trying to build a package without an existing postmarketOS
binary packages mirror (like done in the build.postmarketos.org
testsuite):

  File "/home/user/code/pmbootstrap/pmb/chroot/apk.py", line 174, in replace_aports_packages_with_path
    package + "-" + data_repo["version"] + ".apk")
TypeError: 'NoneType' object is not subscriptable

Replace this error with a more meaningful message, that points to the
issue analyzing this bug.

Related: https://gitlab.com/postmarketOS/build.postmarketos.org/issues/61
This commit is contained in:
Oliver Smith 2019-11-27 23:50:36 +01:00
parent 84abedd536
commit 3587812539
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 8 additions and 0 deletions

View File

@ -170,6 +170,14 @@ def replace_aports_packages_with_path(args, packages, suffix, arch):
aport = pmb.helpers.pmaports.find(args, package, False)
if aport:
data_repo = pmb.parse.apkindex.package(args, package, arch, False)
if not data_repo:
raise RuntimeError(package + ": could not find binary"
" package, although it should exist for"
" sure at this point in the code."
" Probably an APKBUILD subpackage parsing"
" bug. Related: https://gitlab.com/"
"postmarketOS/build.postmarketos.org/"
"issues/61")
apk_path = ("/mnt/pmbootstrap-packages/" + arch + "/" +
package + "-" + data_repo["version"] + ".apk")
if os.path.exists(args.work + "/chroot_" + suffix + apk_path):