Skip to content

Commit

Permalink
OutdatedProfilePackage: don't warn when version was removed not long ago
Browse files Browse the repository at this point in the history
Requested-by: Sam James <sam@gentoo.org>
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
  • Loading branch information
arthurzam committed Dec 8, 2023
1 parent d837ae2 commit d2ed366
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/pkgcheck/checks/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@

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__()
Expand Down Expand Up @@ -261,9 +265,10 @@ def _report_unknown_atom(self, path, atom):
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):
Expand Down

0 comments on commit d2ed366

Please sign in to comment.