diff --git a/pmb/build/_package.py b/pmb/build/_package.py index 597a3ede..cfa7af44 100644 --- a/pmb/build/_package.py +++ b/pmb/build/_package.py @@ -269,7 +269,12 @@ def prioritise_build_queue(disarray: list[BuildQueueItem]) -> list[BuildQueueIte for dep in item["depends"]: # This might be a subpkgname, replace with the main pkgname # (e.g."linux-pam-dev" -> "linux-pam") - dep = pmb.helpers.package.get(dep, item["arch"])["pkgname"] + dep_data = pmb.helpers.package.get( + dep, item["arch"], must_exist=False, try_other_arches=False + ) + if not dep_data: + raise NonBugError(f"{item['name']}: dependency not found: {dep}") + dep = dep_data["pkgname"] if dep in all_pkgnames: unmet_deps.setdefault(item["name"], []).append(dep) diff --git a/pmb/helpers/package.py b/pmb/helpers/package.py index 5ee6b1a3..2fc934bd 100644 --- a/pmb/helpers/package.py +++ b/pmb/helpers/package.py @@ -39,8 +39,18 @@ def get( ) -> dict[str, Any] | None: ... -@Cache("pkgname", "arch", "replace_subpkgnames") -def get(pkgname, arch, replace_subpkgnames=False, must_exist=True): +@overload +def get( + pkgname: str, + arch: Arch, + replace_subpkgnames: bool = False, + must_exist: bool = True, + try_other_arches: bool = True, +) -> dict[str, Any] | None: ... + + +@Cache("pkgname", "arch", "replace_subpkgnames", "try_other_arches") +def get(pkgname, arch, replace_subpkgnames=False, must_exist=True, try_other_arches=True): """Find a package in pmaports, and as fallback in the APKINDEXes of the binary packages. :param pkgname: package name (e.g. "hello-world") @@ -51,6 +61,7 @@ def get(pkgname, arch, replace_subpkgnames=False, must_exist=True): :param replace_subpkgnames: replace all subpkgnames with their main pkgnames in the depends (see #1733) :param must_exist: raise an exception, if not found + :param try_other_arches: set to False to not attempt to find other arches :returns: * data from the parsed APKBUILD or APKINDEX in the following format: {"arch": ["noarch"], "depends": ["busybox-extras", "lddtree", ...], @@ -83,7 +94,7 @@ def get(pkgname, arch, replace_subpkgnames=False, must_exist=True): ret = ret_repo # Find in APKINDEX (other arches) - if not ret: + if not ret and try_other_arches: pmb.helpers.repo.update() for arch_i in Arch.supported(): if arch_i != arch: