diff --git a/pmb/install/_install.py b/pmb/install/_install.py index 4b8917c68cbfbc473689a57252698949a44a5db7..7d1573ce8fb2a1cf992bc1abddeabb080e3ecfe7 100644 --- a/pmb/install/_install.py +++ b/pmb/install/_install.py @@ -1291,8 +1291,12 @@ def create_device_rootfs(args: PmbArgs, step, steps): unlocker = pmb.parse.depends.package_provider( "postmarketos-fde-unlocker", install_packages, chroot ) - if unlocker["pkgname"] not in install_packages: - install_packages += [unlocker["pkgname"]] + if not unlocker: + raise RuntimeError( + "Full disk encryption enabled but unable to find any suitable FDE unlocker app" + ) + if unlocker.pkgname not in install_packages: + install_packages += [unlocker.pkgname] else: install_packages += ["postmarketos-base-nofde"] diff --git a/pmb/parse/depends.py b/pmb/parse/depends.py index 2d05269c1f42c5fcba29bce5def91ef4e21333f2..861ec4c75eb1dffb1df3e65c1ad9106bed470389 100644 --- a/pmb/parse/depends.py +++ b/pmb/parse/depends.py @@ -29,11 +29,12 @@ def package_from_aports(pkgname_depend): return {"pkgname": pkgname, "depends": apkbuild["depends"], "version": version} -def package_provider(pkgname, pkgnames_install, suffix: Chroot = Chroot.native()): +def package_provider( + pkgname, pkgnames_install, suffix: Chroot = Chroot.native() +) -> pmb.core.apkindex_block.ApkindexBlock | None: """ :param pkgnames_install: packages to be installed - :returns: a block from the apkindex: {"pkgname": "...", ...} - or None (no provider found) + :returns: ApkindexBlock object or None (no provider found) """ # Get all providers arch = suffix.arch @@ -105,10 +106,7 @@ def package_from_index( return package_aport # Binary package outdated - if ( - package_aport - and pmb.parse.version.compare(package_aport["version"], provider["version"]) == 1 - ): + if package_aport and pmb.parse.version.compare(package_aport["version"], provider.version) == 1: logging.verbose(pkgname_depend + ": binary package is outdated") return package_aport