helpers: package: fix potential null access in check_arch() (MR 2252)

pmaports.get() can return None usually, but check_arch() has no handling
for it. Set must_exist=True so we properly error out in this case.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-10 01:46:25 +02:00 committed by Oliver Smith
parent 84bced2110
commit 807424ee2b
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -158,5 +158,5 @@ def check_arch(pkgname, arch, binary=True):
if binary:
arches = get(pkgname, arch)["arch"]
else:
arches = pmb.helpers.pmaports.get(pkgname)["arch"]
arches = pmb.helpers.pmaports.get(pkgname, must_exist=True)["arch"]
return pmb.helpers.pmaports.check_arches(arches, arch)