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
19 changes: 19 additions & 0 deletions src/pkgcheck/checks/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,20 @@ def desc(self):
return f"nonexistent profiles/categories entr{ies}: {categories}"


class ArchesOutOfSync(results.ProfilesResult, results.Error):
"""``profiles/arches.desc`` is out of sync with ``arch.list``."""

def __init__(self, arches):
super().__init__()
self.arches = tuple(arches)

@property
def desc(self):
es = pluralism(self.arches, plural="es")
arches = ", ".join(self.arches)
return f"'profiles/arches.desc' is out of sync with 'arch.list', arch{es}: {arches}"


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

Expand Down Expand Up @@ -533,6 +547,7 @@ class RepoProfilesCheck(RepoCheck):
ProfileWarning,
BannedProfileEapi,
DeprecatedProfileEapi,
ArchesOutOfSync,
]
)

Expand Down Expand Up @@ -614,3 +629,7 @@ def finish(self):

if unused_profile_dirs := available_profile_dirs - seen_profile_dirs:
yield UnusedProfileDirs(sorted(unused_profile_dirs))

if arches_desc := frozenset().union(*self.repo.config.arches_desc.values()):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice trick. I'd have used itertools.chain() myself.

if arches_mis_sync := self.repo.known_arches ^ arches_desc:
yield ArchesOutOfSync(sorted(arches_mis_sync))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"__class__": "ArchesOutOfSync", "arches": ["unknown_arch"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
sed -i '/^unknown_arch/d' profiles/arch.list
2 changes: 2 additions & 0 deletions testdata/repos/profiledir/profiles/arches.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
amd64 stable
x86 testing