Replace skip_extra_repos -> with_extra_repos (MR 2480)

Replace the boolean skip_extra_repos with a new with_extra_repos
argument that can be default, enabled or disabled.

This will be used to explicitly enable extra repos in a package search
even if systemd is currently disabled, so we can display a hint when a
package was not found because systemd is disabled in a follow-up patch.
This commit is contained in:
Oliver Smith 2024-11-07 18:04:06 +01:00
parent 444d9e256f
commit 0a0f6ead33
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
6 changed files with 51 additions and 28 deletions

View file

@ -2,6 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import os
from pmb.core.pkgrepo import pkgrepo_iglob
from pmb.types import WithExtraRepos
import pmb.helpers.pmaports
import pmb.helpers.package
import pmb.parse
@ -29,7 +30,7 @@ def list_ui(arch):
return ret
def check_option(ui, option, skip_extra_repos=False):
def check_option(ui: str, option: str, with_extra_repos: WithExtraRepos = "default") -> bool:
"""
Check if an option, such as pmb:systemd, is inside an UI's APKBUILD.
"""
@ -40,6 +41,6 @@ def check_option(ui, option, skip_extra_repos=False):
pkgname = f"postmarketos-ui-{ui}"
apkbuild = pmb.helpers.pmaports.get(
pkgname, subpackages=False, skip_extra_repos=skip_extra_repos
pkgname, subpackages=False, with_extra_repos=with_extra_repos
)
return option in apkbuild["options"]