Skip to content
Snippets Groups Projects
Unverified Commit 67318823 authored by Oliver Smith's avatar Oliver Smith
Browse files

pmaports.find: show extra-repos/systemd hint (MR 2480)

If the user tries to build a package, but it can't be found: check if
systemd is disabled and the package is in extra-repos/systemd, display a
hint about it.

$ pmbootstrap build systemd
[17:33:53] NOTE: The package 'systemd' exists in extra-repos/systemd, but systemd is currently disabled
[17:33:53] ERROR: Could not find aport for package: systemd

Fixes: issue 2398
parent 0a0f6ead
Branches
No related tags found
No related merge requests found
......@@ -140,6 +140,19 @@ def _find_package_in_apkbuild(package: str, path: Path) -> bool:
return False
def show_pkg_not_found_systemd_hint(package: str, with_extra_repos: WithExtraRepos) -> None:
"""Check if a package would be found if systemd was enabled and display a
hint about it."""
if with_extra_repos != "default" or pmb.config.other.is_systemd_selected():
return
if find(package, False, with_extra_repos="enabled"):
logging.info(
f"NOTE: The package '{package}' exists in extra-repos/systemd, but systemd is currently disabled"
)
@Cache("package", "subpackages", "with_extra_repos")
def find(package, must_exist=True, subpackages=True, with_extra_repos="default"):
"""Find the directory in pmaports that provides a package or subpackage.
......@@ -191,6 +204,7 @@ def find(package, must_exist=True, subpackages=True, with_extra_repos="default")
# Crash when necessary
if ret is None and must_exist:
show_pkg_not_found_systemd_hint(package, with_extra_repos)
raise RuntimeError("Could not find aport for package: " + package)
return ret
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment