From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 0026D15800F for ; Fri, 20 Jan 2023 07:02:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 35639E085E; Fri, 20 Jan 2023 07:02:53 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1E10AE085E for ; Fri, 20 Jan 2023 07:02:53 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1C3DA340C69 for ; Fri, 20 Jan 2023 07:02:52 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 666B4738 for ; Fri, 20 Jan 2023 07:02:50 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1674197162.72ec9a3d5ee68be6158566ce51ef3ab62ae23832.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: testdata/repos/profiledir/profiles/, ... X-VCS-Repository: proj/pkgcore/pkgcheck X-VCS-Files: src/pkgcheck/checks/profiles.py testdata/data/repos/profiledir/RepoProfilesCheck/ArchesOutOfSync/expected.json testdata/data/repos/profiledir/RepoProfilesCheck/ArchesOutOfSync/fix.sh testdata/repos/profiledir/profiles/arches.desc X-VCS-Directories: testdata/repos/profiledir/profiles/ src/pkgcheck/checks/ testdata/data/repos/profiledir/RepoProfilesCheck/ArchesOutOfSync/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: 72ec9a3d5ee68be6158566ce51ef3ab62ae23832 X-VCS-Branch: master Date: Fri, 20 Jan 2023 07:02:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 69d088c0-abea-43b0-bfed-387a704bddb4 X-Archives-Hash: cf94558bb5e6d6e19cde8abbe9e211f7 commit: 72ec9a3d5ee68be6158566ce51ef3ab62ae23832 Author: Arthur Zamarin gentoo org> AuthorDate: Thu Jan 19 21:48:07 2023 +0000 Commit: Arthur Zamarin gentoo 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 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