From 3587812539fa6e1fd14619c92aa568cce6f89d91 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Wed, 27 Nov 2019 23:50:36 +0100 Subject: [PATCH] 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 --- pmb/chroot/apk.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pmb/chroot/apk.py b/pmb/chroot/apk.py index 64fbd96e..c7f5fda0 100644 --- a/pmb/chroot/apk.py +++ b/pmb/chroot/apk.py @@ -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):