Skip to content

Commit 72ec9a3

Browse files
committed
ArchesMisSync: check for arch.list <-> arches.desc missync
Resolves: #526 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent ecaf9a2 commit 72ec9a3

4 files changed

Lines changed: 24 additions & 0 deletions

File tree

src/pkgcheck/checks/profiles.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,20 @@ def desc(self):
498498
return f"nonexistent profiles/categories entr{ies}: {categories}"
499499

500500

501+
class ArchesOutOfSync(results.ProfilesResult, results.Error):
502+
"""``profiles/arches.desc`` is out of sync with ``arch.list``."""
503+
504+
def __init__(self, arches):
505+
super().__init__()
506+
self.arches = tuple(arches)
507+
508+
@property
509+
def desc(self):
510+
es = pluralism(self.arches, plural="es")
511+
arches = ", ".join(self.arches)
512+
return f"'profiles/arches.desc' is out of sync with 'arch.list', arch{es}: {arches}"
513+
514+
501515
def dir_parents(path):
502516
"""Yield all directory path parents excluding the root directory.
503517
@@ -533,6 +547,7 @@ class RepoProfilesCheck(RepoCheck):
533547
ProfileWarning,
534548
BannedProfileEapi,
535549
DeprecatedProfileEapi,
550+
ArchesOutOfSync,
536551
]
537552
)
538553

@@ -614,3 +629,7 @@ def finish(self):
614629

615630
if unused_profile_dirs := available_profile_dirs - seen_profile_dirs:
616631
yield UnusedProfileDirs(sorted(unused_profile_dirs))
632+
633+
if arches_desc := frozenset().union(*self.repo.config.arches_desc.values()):
634+
if arches_mis_sync := self.repo.known_arches ^ arches_desc:
635+
yield ArchesOutOfSync(sorted(arches_mis_sync))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"__class__": "ArchesOutOfSync", "arches": ["unknown_arch"]}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
sed -i '/^unknown_arch/d' profiles/arch.list
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
amd64 stable
2+
x86 testing

0 commit comments

Comments
 (0)