mirror of
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
synced 2025-07-13 03:19:47 +03:00
pmb.parse.depends.package_provider: add type hinting and fix references (MR 2439)
pmb.parse.apkindex.providers now returns a dict of string:ApkindexBlock,
probably from 71772b9b6
This adds type hinting to package_provider to reflect this, and fixes
code that calls it to properly deal with the possible return types.
Without this, building FDE images is broken.
This commit is contained in:
parent
4019636f72
commit
47dc493701
2 changed files with 11 additions and 9 deletions
|
@ -1291,8 +1291,12 @@ def create_device_rootfs(args: PmbArgs, step, steps):
|
||||||
unlocker = pmb.parse.depends.package_provider(
|
unlocker = pmb.parse.depends.package_provider(
|
||||||
"postmarketos-fde-unlocker", install_packages, chroot
|
"postmarketos-fde-unlocker", install_packages, chroot
|
||||||
)
|
)
|
||||||
if unlocker["pkgname"] not in install_packages:
|
if not unlocker:
|
||||||
install_packages += [unlocker["pkgname"]]
|
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:
|
else:
|
||||||
install_packages += ["postmarketos-base-nofde"]
|
install_packages += ["postmarketos-base-nofde"]
|
||||||
|
|
||||||
|
|
|
@ -29,11 +29,12 @@ def package_from_aports(pkgname_depend):
|
||||||
return {"pkgname": pkgname, "depends": apkbuild["depends"], "version": version}
|
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
|
:param pkgnames_install: packages to be installed
|
||||||
:returns: a block from the apkindex: {"pkgname": "...", ...}
|
:returns: ApkindexBlock object or None (no provider found)
|
||||||
or None (no provider found)
|
|
||||||
"""
|
"""
|
||||||
# Get all providers
|
# Get all providers
|
||||||
arch = suffix.arch
|
arch = suffix.arch
|
||||||
|
@ -105,10 +106,7 @@ def package_from_index(
|
||||||
return package_aport
|
return package_aport
|
||||||
|
|
||||||
# Binary package outdated
|
# Binary package outdated
|
||||||
if (
|
if package_aport and pmb.parse.version.compare(package_aport["version"], provider.version) == 1:
|
||||||
package_aport
|
|
||||||
and pmb.parse.version.compare(package_aport["version"], provider["version"]) == 1
|
|
||||||
):
|
|
||||||
logging.verbose(pkgname_depend + ": binary package is outdated")
|
logging.verbose(pkgname_depend + ": binary package is outdated")
|
||||||
return package_aport
|
return package_aport
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue