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

build: package: proper missing dep error (MR 2388)

When a dependency cannot be found in source or binary packages of the
selected architecture, then don't look for binary packages in other
architectures package indexes.

This leads to a confusing error down the line when building packages for
extra_repos_systemd (and e.g. stable branches), because we don't have
binary packages for all arches that pmbootstrap supports, and so it
tries to fetch a non-existing APKINDEX.

Instead, print a nice error about a non-existing dependency.
parent 94d91768
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment