From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: testdata/repos/profiledir/profiles/, ...
Date: Fri, 20 Jan 2023 07:02:50 +0000 (UTC) [thread overview]
Message-ID: <1674197162.72ec9a3d5ee68be6158566ce51ef3ab62ae23832.arthurzam@gentoo> (raw)
commit: 72ec9a3d5ee68be6158566ce51ef3ab62ae23832
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 19 21:48:07 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Jan 20 06:46:02 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=72ec9a3d
ArchesMisSync: check for arch.list <-> arches.desc missync
Resolves: https://github.com/pkgcore/pkgcheck/issues/526
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/profiles.py | 19 +++++++++++++++++++
.../RepoProfilesCheck/ArchesOutOfSync/expected.json | 1 +
.../RepoProfilesCheck/ArchesOutOfSync/fix.sh | 2 ++
testdata/repos/profiledir/profiles/arches.desc | 2 ++
4 files changed, 24 insertions(+)
diff --git a/src/pkgcheck/checks/profiles.py b/src/pkgcheck/checks/profiles.py
index 625a05d6..a0b8c618 100644
--- a/src/pkgcheck/checks/profiles.py
+++ b/src/pkgcheck/checks/profiles.py
@@ -498,6 +498,20 @@ class NonexistentCategories(results.ProfilesResult, results.Warning):
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.
@@ -533,6 +547,7 @@ class RepoProfilesCheck(RepoCheck):
ProfileWarning,
BannedProfileEapi,
DeprecatedProfileEapi,
+ ArchesOutOfSync,
]
)
@@ -614,3 +629,7 @@ class RepoProfilesCheck(RepoCheck):
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()):
+ if arches_mis_sync := self.repo.known_arches ^ arches_desc:
+ yield ArchesOutOfSync(sorted(arches_mis_sync))
diff --git a/testdata/data/repos/profiledir/RepoProfilesCheck/ArchesOutOfSync/expected.json b/testdata/data/repos/profiledir/RepoProfilesCheck/ArchesOutOfSync/expected.json
new file mode 100644
index 00000000..9e51e311
--- /dev/null
+++ b/testdata/data/repos/profiledir/RepoProfilesCheck/ArchesOutOfSync/expected.json
@@ -0,0 +1 @@
+{"__class__": "ArchesOutOfSync", "arches": ["unknown_arch"]}
diff --git a/testdata/data/repos/profiledir/RepoProfilesCheck/ArchesOutOfSync/fix.sh b/testdata/data/repos/profiledir/RepoProfilesCheck/ArchesOutOfSync/fix.sh
new file mode 100755
index 00000000..d7c5432e
--- /dev/null
+++ b/testdata/data/repos/profiledir/RepoProfilesCheck/ArchesOutOfSync/fix.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+sed -i '/^unknown_arch/d' profiles/arch.list
diff --git a/testdata/repos/profiledir/profiles/arches.desc b/testdata/repos/profiledir/profiles/arches.desc
new file mode 100644
index 00000000..d6266385
--- /dev/null
+++ b/testdata/repos/profiledir/profiles/arches.desc
@@ -0,0 +1,2 @@
+amd64 stable
+x86 testing
next reply other threads:[~2023-01-20 7:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 7:02 Arthur Zamarin [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-10-04 11:16 [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: testdata/repos/profiledir/profiles/, Arthur Zamarin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1674197162.72ec9a3d5ee68be6158566ce51ef3ab62ae23832.arthurzam@gentoo \
--to=arthurzam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox