Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/pkgcheck/checks/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,20 @@ def desc(self):
return f"'profiles/arches.desc' is out of sync with 'arch.list', arch{es}: {arches}"


class SystemSetMissingKeywords(results.PackageResult, results.Error):
"""System set is missing keywords for some arches."""

def __init__(self, missing_arches, **kwargs):
super().__init__(**kwargs)
self.missing_arches = tuple(missing_arches)

@property
def desc(self):
arches = ", ".join(self.missing_arches)
s = pluralism(self.missing_arches, plural="es")
return f"part of @system set, but is missing keywords for arch{s}: {arches}"


def dir_parents(path):
"""Yield all directory path parents excluding the root directory.

Expand Down Expand Up @@ -588,6 +602,7 @@ class RepoProfilesCheck(RepoCheck):
BannedProfileEapi,
DeprecatedProfileEapi,
ArchesOutOfSync,
SystemSetMissingKeywords,
}
)

Expand All @@ -602,6 +617,25 @@ def __init__(self, *args, profile_addon):
self.repo = self.options.target_repo
self.profiles_dir = self.repo.config.profiles_base
self.non_profile_dirs = profile_addon.non_profile_dirs
self.arch_profiles = profile_addon.arch_profiles

def _check_system_set(self):
system_packages: dict[atom_cls, set[str]] = defaultdict(set)
stable_arches = self.options.target_repo.config.arches_desc["stable"]
for arch, profiles in self.arch_profiles.items():
is_stable = arch in stable_arches
if not is_stable:
arch = "~" + arch
for profile, _ in profiles:
for pkg in profile.system:
system_packages[pkg].add(arch)
for pkg in profile.profile_set:
system_packages[pkg].add(arch)
for atom, required_arches in system_packages.items():
if pkgs := self.repo.match(atom):
keywords = frozenset().union(*(pkg.keywords for pkg in pkgs))
if missing_arches := required_arches - keywords:
yield SystemSetMissingKeywords(sorted(missing_arches), pkg=atom)

def finish(self):
if unknown_category_dirs := set(self.repo.category_dirs).difference(
Expand Down Expand Up @@ -674,3 +708,5 @@ def finish(self):
if arches_desc := frozenset().union(*self.repo.config.arches_desc.values()):
if arches_mis_sync := self.repo.known_arches ^ arches_desc:
yield ArchesOutOfSync(sorted(arches_mis_sync))

yield from self._check_system_set()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"__class__": "SystemSetMissingKeywords", "category": "cat", "package": "pkg1", "missing_arches": ["amd64"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
diff -Naur profiledir/cat/pkg1/pkg1-0.ebuild fixed/cat/pkg1/pkg1-0.ebuild
--- profiledir/cat/pkg1/pkg1-0.ebuild
+++ fixed/cat/pkg1/pkg1-0.ebuild
@@ -3,3 +3,4 @@ HOMEPAGE="https://github.com/pkgcore/pkgcheck"
LICENSE="BSD"
SLOT="0"
IUSE="used"
+KEYWORDS="amd64"
1 change: 1 addition & 0 deletions testdata/repos/profiledir/profiles/default/packages
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*cat/pkg1
Loading