repo_missing: if abuild is forked, add it as dep (MR 2410)

In the systemd repository, we currently have a forked version of
abuild, which needs to be used to build all other packages. Check if we
have a forked abuild, and if it is the case, add it to the dependencies
of all other packages.

Closes: issue 2401
This commit is contained in:
Oliver Smith 2025-01-06 10:44:41 +01:00
parent 8d446c2aeb
commit 02591cfda2
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -2,6 +2,8 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from pmb.core.arch import Arch
from pmb.core.context import get_context
from pmb.meta import Cache
from pmb.types import WithExtraRepos
from pathlib import Path
import pmb.build
@ -11,6 +13,23 @@ import glob
import os
@Cache("repo")
def is_abuild_forked(repo: str | None) -> bool:
"""Check if abuild is forked to make sure we build it first (pmb#2401)"""
with_extra_repos: WithExtraRepos
if repo == "systemd":
with_extra_repos = "enabled"
elif repo is None:
with_extra_repos = "disabled"
else:
raise RuntimeError(f"Unexpected repo value: {repo}")
if pmb.helpers.pmaports.find("abuild", False, False, with_extra_repos):
return True
return False
def generate(arch: Arch) -> list[dict[str, list[str] | str | None]]:
"""Get packages that need to be built, with all their dependencies. Include
packages from extra-repos, no matter if systemd is enabled or not. This
@ -42,6 +61,9 @@ def generate(arch: Arch) -> list[dict[str, list[str] | str | None]]:
if entry is None:
raise RuntimeError(f"Couldn't get package {pkgname} for arch {arch}")
if pkgname != "abuild" and is_abuild_forked(repo):
entry.depends.insert(0, "abuild")
ret += [
{
"pkgname": entry.pkgname,