public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
Date: Fri, 20 Jan 2023 13:20:26 +0000 (UTC)	[thread overview]
Message-ID: <1674220669.33a0fe9e379839667e84cb8a92207012be2783c1.arthurzam@gentoo> (raw)

commit:     33a0fe9e379839667e84cb8a92207012be2783c1
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 20 13:17:49 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Jan 20 13:17:49 2023 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=33a0fe9e

MissingManifest: fix behavior under thick repos

Resolves: https://github.com/pkgcore/pkgcheck/issues/530
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgcheck/checks/repo_metadata.py | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/pkgcheck/checks/repo_metadata.py b/src/pkgcheck/checks/repo_metadata.py
index 003ff891..21df0745 100644
--- a/src/pkgcheck/checks/repo_metadata.py
+++ b/src/pkgcheck/checks/repo_metadata.py
@@ -4,6 +4,7 @@ from difflib import SequenceMatcher
 from itertools import chain
 
 from pkgcore import fetch
+from pkgcore.ebuild.digest import Manifest
 from snakeoil.sequences import iflatten_instance
 from snakeoil.strings import pluralism
 
@@ -80,14 +81,14 @@ class PackageUpdatesCheck(RepoCheck):
 
     _source = (sources.EmptySource, (base.profiles_scope,))
     known_results = frozenset(
-        [
+        {
             MultiMovePackageUpdate,
             OldMultiMovePackageUpdate,
             OldPackageUpdate,
             MovedPackageUpdate,
             BadPackageUpdate,
             RedundantPackageUpdate,
-        ]
+        }
     )
 
     def __init__(self, *args):
@@ -377,17 +378,16 @@ class GlobalUseCheck(RepoCheck):
     """Check global USE and USE_EXPAND flags for various issues."""
 
     _source = (sources.RepositoryRepoSource, (), (("source", sources.PackageRepoSource),))
-    required_addons = (addons.UseAddon,)
     known_results = frozenset(
-        [
+        {
             PotentialLocalUse,
             PotentialGlobalUse,
             UnusedGlobalUse,
             UnusedGlobalUseExpand,
-        ]
+        }
     )
 
-    def __init__(self, *args, use_addon):
+    def __init__(self, *args):
         super().__init__(*args)
         self.global_flag_usage = defaultdict(set)
         self.repo = self.options.target_repo
@@ -405,8 +405,8 @@ class GlobalUseCheck(RepoCheck):
         """Yield groups of packages with similar local USE flag descriptions."""
         # calculate USE flag description difference ratios
         diffs = {}
-        for i, (i_pkg, i_desc) in enumerate(pkgs):
-            for j, (j_pkg, j_desc) in enumerate(pkgs[i + 1 :]):
+        for i, (_i_pkg, i_desc) in enumerate(pkgs):
+            for j, (_j_pkg, j_desc) in enumerate(pkgs[i + 1 :]):
                 diffs[(i, i + j + 1)] = SequenceMatcher(None, i_desc, j_desc).ratio()
 
         # create an adjacency list using all closely matching flags pairs
@@ -571,17 +571,17 @@ class ManifestCheck(Check):
     required_addons = (addons.UseAddon,)
     _source = sources.PackageRepoSource
     known_results = frozenset(
-        [
+        {
             MissingChksum,
             MissingManifest,
             UnknownManifest,
             UnnecessaryManifest,
             DeprecatedChksum,
             InvalidManifest,
-        ]
+        }
     )
 
-    def __init__(self, *args, use_addon):
+    def __init__(self, *args, use_addon: addons.UseAddon):
         super().__init__(*args)
         repo = self.options.target_repo
         self.preferred_checksums = frozenset(
@@ -593,7 +593,8 @@ class ManifestCheck(Check):
         self.iuse_filter = use_addon.get_filter("fetchables")
 
     def feed(self, pkgset):
-        pkg_manifest = pkgset[0].manifest
+        pkg_manifest: Manifest = pkgset[0].manifest
+        pkg_manifest.allow_missing = True
         manifest_distfiles = set(pkg_manifest.distfiles.keys())
         seen = set()
         for pkg in pkgset:
@@ -625,14 +626,13 @@ class ManifestCheck(Check):
                 seen.add(f_inst.filename)
 
         if pkg_manifest.thin:
-            unnecessary_manifests = []
+            unnecessary_manifests = set()
             for attr in ("aux_files", "ebuilds", "misc"):
-                unnecessary_manifests.extend(getattr(pkg_manifest, attr, []))
+                unnecessary_manifests.update(getattr(pkg_manifest, attr, ()))
             if unnecessary_manifests:
                 yield UnnecessaryManifest(sorted(unnecessary_manifests), pkg=pkgset[0])
 
-        unknown_manifests = manifest_distfiles.difference(seen)
-        if unknown_manifests:
+        if unknown_manifests := manifest_distfiles.difference(seen):
             yield UnknownManifest(sorted(unknown_manifests), pkg=pkgset[0])
 
 
@@ -753,6 +753,6 @@ class ProjectMetadataCheck(RepoCheck):
         self.repo = self.options.target_repo
 
     def finish(self):
-        for key, project in self.repo.projects_xml.projects.items():
+        for _key, project in self.repo.projects_xml.projects.items():
             if not project.recursive_members:
                 yield EmptyProject(project)


             reply	other threads:[~2023-01-20 13:20 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-20 13:20 Arthur Zamarin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-07-24 18:24 [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/ Arthur Zamarin
2025-07-20 16:55 Arthur Zamarin
2025-07-11 19:44 Arthur Zamarin
2025-04-09 18:01 Arthur Zamarin
2025-03-28 16:40 Arthur Zamarin
2025-03-08 16:25 Arthur Zamarin
2025-03-01 19:15 Arthur Zamarin
2025-02-28  7:10 Arthur Zamarin
2025-02-22  8:30 Arthur Zamarin
2025-01-25 11:27 Arthur Zamarin
2025-01-25 11:27 Arthur Zamarin
2024-07-06 16:28 Arthur Zamarin
2024-07-04 20:06 Arthur Zamarin
2024-05-09 19:39 Arthur Zamarin
2024-05-08 16:32 Arthur Zamarin
2024-03-01 21:06 Arthur Zamarin
2023-12-10 20:07 Arthur Zamarin
2023-12-08 18:38 Arthur Zamarin
2023-12-08 17:52 Arthur Zamarin
2023-11-05 13:22 Arthur Zamarin
2023-11-01 19:20 Arthur Zamarin
2023-09-14 17:02 Arthur Zamarin
2023-09-14 17:02 Arthur Zamarin
2023-09-01 16:42 Arthur Zamarin
2023-08-29 18:58 Arthur Zamarin
2023-08-03 17:28 Arthur Zamarin
2023-08-02 11:59 Arthur Zamarin
2023-07-15 10:17 Arthur Zamarin
2023-06-24  7:52 Arthur Zamarin
2023-05-12 17:21 Arthur Zamarin
2023-03-24 13:56 Arthur Zamarin
2023-03-18 15:04 Arthur Zamarin
2023-03-11  7:18 Arthur Zamarin
2023-03-04 18:24 Arthur Zamarin
2023-02-18 18:33 Arthur Zamarin
2023-02-17 10:10 Arthur Zamarin
2023-02-16 18:44 Arthur Zamarin
2023-02-05 17:56 Arthur Zamarin
2023-02-05 17:18 Arthur Zamarin
2023-01-31 17:08 Arthur Zamarin
2023-01-31 16:44 Arthur Zamarin
2023-01-24 18:57 Arthur Zamarin
2023-01-20 15:01 Arthur Zamarin
2023-01-20 15:01 Arthur Zamarin
2023-01-14 20:31 Arthur Zamarin
2022-12-27 19:15 Arthur Zamarin
2022-12-13 19:59 Arthur Zamarin
2022-10-29 18:46 Arthur Zamarin
2022-10-29  5:43 Arthur Zamarin
2022-10-12 18:06 Arthur Zamarin
2022-10-07 12:42 Arthur Zamarin
2022-10-05 16:46 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=1674220669.33a0fe9e379839667e84cb8a92207012be2783c1.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