treewide: migrate to pkgrepo API (MR 2252)

Make use of the new pmb.core.pkgrepo API to handle multiple aports and
extra-repos.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-08 05:59:45 +02:00 committed by Oliver Smith
parent 8a61d67053
commit 560cea46ea
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
19 changed files with 153 additions and 91 deletions

View file

@ -3,7 +3,7 @@
import os
import glob
from pmb.core import get_context
from pmb.types import PmbArgs
from pmb.core.pkgrepo import pkgrepo_iglob
import pmb.helpers.pmaports
import pmb.helpers.package
import pmb.parse
@ -18,8 +18,7 @@ def list_ui(arch):
ret = [("none", "Bare minimum OS image for testing and manual"
" customization. The \"console\" UI should be selected if"
" a graphical UI is not desired.")]
context = get_context() # noqa: F821
for path in sorted(context.config.aports.glob("main/postmarketos-ui-*")):
for path in sorted(pkgrepo_iglob("main/postmarketos-ui-*")):
apkbuild = pmb.parse.apkbuild(path)
ui = os.path.basename(path).split("-", 2)[2]
if pmb.helpers.package.check_arch(apkbuild["pkgname"], arch):
@ -27,10 +26,10 @@ def list_ui(arch):
return ret
def check_option(ui, option):
def check_option(ui, option, skip_extra_repos=False):
"""
Check if an option, such as pmb:systemd, is inside an UI's APKBUILD.
"""
pkgname = f"postmarketos-ui-{ui}"
apkbuild = pmb.helpers.pmaports.get(pkgname, subpackages=False)
apkbuild = pmb.helpers.pmaports.get(pkgname, subpackages=False, skip_extra_repos=skip_extra_repos)
return option in apkbuild["options"]