1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-13 03:19:47 +03:00

core: pkgrepo: support arbitrarily named pmaports directories (MR 2470)

There was an oversight when this API was originally created and it
implicitly assumed that the pmaports repository was always named
"pmaports". This unfortunately broke some peoples workflows.

Introduce a new "pkgrepo_name()" function and adjust the codebase to use
it, as well as adjusting pkgrepo internally to special case the
"pmaports" repo so that it's always named pmaports no matter what the
directory itself is named.

This is probably more complexity than we should be dealing with here, we
should probably create a new type to encode this behaviour.

Fixes: #2412
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-11-02 16:01:46 +01:00 committed by Oliver Smith
parent 70dc855281
commit a72a60f546
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
5 changed files with 49 additions and 15 deletions

View file

@ -2,7 +2,12 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from collections.abc import Sequence
from pmb.core.chroot import Chroot
from pmb.core.pkgrepo import pkgrepo_iter_package_dirs, pkgrepo_names, pkgrepo_relative_path
from pmb.core.pkgrepo import (
pkgrepo_iter_package_dirs,
pkgrepo_name,
pkgrepo_names,
pkgrepo_relative_path,
)
from pmb.helpers import logging
from pmb.helpers.exceptions import NonBugError
from pmb.helpers.toml import load_toml_file
@ -69,7 +74,7 @@ def check(pkgnames: Sequence[str]) -> None:
continue
repo, relpath = pkgrepo_relative_path(pkgdir)
apkbuilds[repo.name].append(os.fspath(relpath / "APKBUILD"))
apkbuilds[pkgrepo_name(repo)].append(os.fspath(relpath / "APKBUILD"))
found_pkgnames.add(pkgdir.name)
# Check we found all the packages in pkgnames
@ -94,7 +99,7 @@ def check(pkgnames: Sequence[str]) -> None:
["apkbuild-lint"] + apkbuild_paths,
check=False,
output="stdout",
working_dir=dest_paths[repo.name],
working_dir=dest_paths[pkgrepo_name(repo)],
env={"CUSTOM_VALID_OPTIONS": " ".join(get_custom_valid_options())},
):
has_failed = True