commit:     4bda26afd8ee21385dcaadb4fdf7b70db0a1c594
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec  8 17:45:14 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Dec 10 18:51:01 2023 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=4bda26af

OutdatedProfilePackage: don't warn when version was removed not long ago

Requested-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgcheck/checks/profiles.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/pkgcheck/checks/profiles.py b/src/pkgcheck/checks/profiles.py
index 8a8248c7..6b3db0c5 100644
--- a/src/pkgcheck/checks/profiles.py
+++ b/src/pkgcheck/checks/profiles.py
@@ -19,7 +19,11 @@ from . import Check, RepoCheck
 
 class OutdatedProfilePackage(results.ProfilesResult, results.Warning):
     """Profile files includes package entry that doesn't exist in the repo
-    for a mentioned period of time."""
+    for a mentioned period of time.
+
+    This is only reported if the version was removed more than 3 months ago,
+    or all versions of this package were removed (i.e. last-rite).
+    """
 
     def __init__(self, path, atom, age):
         super().__init__()
@@ -261,9 +265,10 @@ class ProfilesCheck(Check):
             removal = max(x.time for x in matches)
             removal = datetime.fromtimestamp(removal)
             years = (self.today - removal).days / 365.2425
-            return OutdatedProfilePackage(path, atom, round(years, 2))
-        else:
-            return UnknownProfilePackage(path, atom)
+            # show years value if it's greater than 3 month, or if the package 
was removed
+            if years > 0.25 or not 
self.search_repo.match(atom.unversioned_atom):
+                return OutdatedProfilePackage(path, atom, round(years, 2))
+        return UnknownProfilePackage(path, atom)
 
     @verify_files(("parent", "parents"), ("eapi", "eapi"))
     def _pull_attr(self, *args):

Reply via email to