1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-12 19:09:56 +03:00

pmb.chroot.apk: better error for mising apk-tools (MR 2388)

Currently the usr-merge script fails, and this leads to a very confusing
error when running pmbootstrap the next time:

  (stack trace)
  KeyError: 'apk-tools'

Show a more helpful error instead.
This commit is contained in:
Oliver Smith 2024-09-17 00:48:43 +02:00
parent 0109af5245
commit f38d525538
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -24,6 +24,7 @@ import pmb.parse.version
from pmb.core import Chroot
from pmb.core.context import get_context
from pmb.types import PathString
from pmb.helpers.exceptions import NonBugError
@Cache("chroot", "user_repository", mirrors_exclude=[])
@ -89,8 +90,15 @@ def check_min_version(chroot: Chroot = Chroot.native()):
)
return
installed_pkgs = installed(chroot)
if "apk-tools" not in installed_pkgs:
raise NonBugError(
"ERROR: could not find apk-tools in chroot, run 'pmbootstrap zap' and try again"
)
# Compare
version_installed = installed(chroot)["apk-tools"]["version"]
version_installed = installed_pkgs["apk-tools"]["version"]
pmb.helpers.apk.check_outdated(
version_installed,
"Delete your http cache and zap all chroots, then try again:" " 'pmbootstrap zap -hc'",