Skip to content

Commit

Permalink
skip annotations for version results
Browse files Browse the repository at this point in the history
Add support for an ebuild to declare a skip annotation for a class of
*version* results. This skip annotation must be declared before any
non-comment non-empty line (most of the times it would be before the
EAPI declaration). Empty lines between the copyright and the annotation
are allowed.
The annotation line must be precise, only one class per line and every
space is required.

For example, it would look like:

  # Copyright 2023 Gentoo Authors
  # Distributed under the terms of the GNU General Public License v2

  # pkgcheck skip: PythonCompatUpdate

  EAPI=8

Resolves: pkgcore#478
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
  • Loading branch information
arthurzam committed Jan 29, 2023
1 parent 4d74d90 commit 7865153
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/pkgcheck/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,21 @@ def __init__(self, pkg, **kwargs):
self.version = pkg.fullver
self._attr = "version"

if hasattr(pkg, "lines"):
lines = pkg.lines
elif ebuild := getattr(pkg, "ebuild", None):
with ebuild.text_fileobj() as fileobj:
lines = tuple(fileobj)
else:
lines = ()

for line in map(str.rstrip, lines):
if line and not line.startswith("#"):
break # stop after first non-comment non-empty line
elif line == f"# pkgcheck skip: {self.__class__.__name__}":
self._filtered = True
break

@klass.jit_attr
def ver_rev(self):
version, _, revision = self.version.partition("-r")
Expand Down

0 comments on commit 7865153

Please sign in to comment.