repo_missing: ensure abuild is not twice in deps

Fix that abuild gets added twice in packages that exist in both the main
and split systemd repository:

        "pkgname": "gnome-settings-daemon-mobile",
        "repo": null,
        "version": "99946.0-r0",
        "depends": [
            "abuild",
            "abuild",
            "alsa-lib-dev",
            "colord-dev",

This fixes the following error in bpo when it tries to use the output of
"pmbootstrap repo_missing":

  UNIQUE constraint failed: package_dependency.package_id, package_dependency.dependency_id

Related: https://postmarketos.org/edge/2025/01/09/systemd-soon/
This commit is contained in:
Oliver Smith 2025-01-10 16:10:49 +01:00
parent 02591cfda2
commit 3ddb725e8a
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -11,6 +11,7 @@ import pmb.helpers.package
import pmb.helpers.pmaports
import glob
import os
import copy
@Cache("repo")
@ -61,6 +62,13 @@ 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}")
# Add abuild to depends if needed. Use a copy of entry and
# entry.depends so we don't modify the original versions that these
# references point to, which can lead to having abuild twice in
# depends when this function gets called again for a package that
# is in both the main and split repository.
entry = copy.copy(entry)
entry.depends = copy.copy(entry.depends)
if pkgname != "abuild" and is_abuild_forked(repo):
entry.depends.insert(0, "abuild")