* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2022-10-05 16:46 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2022-10-05 16:46 UTC (permalink / raw
To: gentoo-commits
commit: 8be0a6a08313552e30bee6ddf376faba9bf57083
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 5 16:45:08 2022 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 5 16:45:08 2022 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=8be0a6a0
profiles: remove code duplication
The function `traverse_parents_tree` is already implemented in pkgcore
as `ProfileStack.stack`.
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/profiles.py | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/src/pkgcheck/checks/profiles.py b/src/pkgcheck/checks/profiles.py
index 73e2898e..db49cf38 100644
--- a/src/pkgcheck/checks/profiles.py
+++ b/src/pkgcheck/checks/profiles.py
@@ -168,14 +168,6 @@ class ProfilesCheck(Check):
local_iuse | use_addon.global_iuse |
use_addon.global_iuse_expand | use_addon.global_iuse_implicit)
- @staticmethod
- def traverse_parents_tree(profile):
- def _traverse(node):
- for parent in node.parents:
- yield parent
- yield from _traverse(parent)
- return set(_traverse(profile))
-
@verify_files(('parent', 'parents'),
('eapi', 'eapi'))
def _pull_attr(self, *args):
@@ -230,9 +222,8 @@ class ProfilesCheck(Check):
@verify_files(('package.mask', 'masks'),)
def _pkg_masks(self, filename, node, vals):
- all_parents = self.traverse_parents_tree(node)
all_masked = set().union(*(masked[1]
- for p in all_parents if (masked := p.masks)))
+ for p in profiles_mod.ProfileStack(node.path).stack if (masked := p.masks)))
unmasked, masked = vals
for x in masked:
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2022-10-07 12:42 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2022-10-07 12:42 UTC (permalink / raw
To: gentoo-commits
commit: bedfeffb24829004d9ac918d6ae2f89be1ba07fa
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 7 11:15:59 2022 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Oct 7 12:24:24 2022 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=bedfeffb
GitPkgCommitsCheck: fix archival repo from multiple removals
When we are performing `--commits` scan over a commit range that have at
least 2 commits that drop a version from the same package, we can have a
state of the temporary "removal repo" that it expects one of the removed
ebuilds.
This is because the check is fed package after package, with the list of
all removals of this package in a list. When creating the archival repo,
we need to select the commit from which to "archive", and we select the
first commit in the list. This is not always the right commit, as it can
be the second or third commit that removes the a version. As a result we
have an archival repo that expects all version to exist, but one of them
might be missing.
By selecting the commit with the lowest commit date, we ensure the right
commit is selected, and all removed ebuilds are present.
On the same note, sometimes we have another exception, which involves a
failure to check the EAPI of the repo is supported, because of missing
`profiles` directory in archival repo, so also include it in the archive.
Resolves: https://github.com/pkgcore/pkgcheck/issues/460
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/git.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py
index 046f1843..c06c8278 100644
--- a/src/pkgcheck/checks/git.py
+++ b/src/pkgcheck/checks/git.py
@@ -7,6 +7,7 @@ import tarfile
from collections import defaultdict
from datetime import datetime
from itertools import chain
+from operator import attrgetter
from tempfile import TemporaryDirectory
from urllib.parse import urlparse
@@ -204,10 +205,11 @@ class _RemovalRepo(UnconfiguredTree):
def _populate(self, pkgs):
"""Populate the repo with a given sequence of historical packages."""
- pkg = pkgs[0]
+ pkg = min(pkgs, key=attrgetter('time'))
paths = [pjoin(pkg.category, pkg.package)]
- if os.path.exists(pjoin(self.__parent_repo.location, 'eclass')):
- paths.append('eclass')
+ for subdir in ('eclass', 'profiles'):
+ if os.path.exists(pjoin(self.__parent_repo.location, subdir)):
+ paths.append(subdir)
old_files = subprocess.Popen(
['git', 'archive', f'{pkg.commit}~1'] + paths,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2022-10-12 18:06 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2022-10-12 18:06 UTC (permalink / raw
To: gentoo-commits
commit: da9e7499dd6ec5e965d539c03e1534bd9ab37509
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 12 17:51:00 2022 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 12 17:51:19 2022 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=da9e7499
GitCommitsCheck: use Sequential runner
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/__init__.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/pkgcheck/checks/__init__.py b/src/pkgcheck/checks/__init__.py
index 67fa4503..f0959257 100644
--- a/src/pkgcheck/checks/__init__.py
+++ b/src/pkgcheck/checks/__init__.py
@@ -100,6 +100,8 @@ class OptionalCheck(Check):
class GitCommitsCheck(OptionalCheck):
"""Check that is only run when explicitly enabled via the --commits git option."""
+ runner_cls = runners.SequentialCheckRunner
+
def __init__(self, *args):
super().__init__(*args)
if not self.options.commits:
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2022-10-29 5:43 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2022-10-29 5:43 UTC (permalink / raw
To: gentoo-commits
commit: d2ff093fae54ee3507a97c6d91c86fd093e46c29
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 29 05:20:50 2022 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Oct 29 05:20:50 2022 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=d2ff093f
BetterCompressionCheck: fix false positive when fixed
When the issue is fixed, we get a url which looks like "${URL}.tar.bz2",
but this URL was matching for the ".tar" extension in previous regex
variant. Fix this by forcing the after ".tar" a ".bz2" doesn't appear.
Resolves: https://github.com/pkgcore/pkgcheck/issues/487
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/codingstyle.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pkgcheck/checks/codingstyle.py b/src/pkgcheck/checks/codingstyle.py
index 0933c492..b6ef8c34 100644
--- a/src/pkgcheck/checks/codingstyle.py
+++ b/src/pkgcheck/checks/codingstyle.py
@@ -416,7 +416,7 @@ class BetterCompressionCheck(Check):
known_results = frozenset([BetterCompressionUri])
REGEXPS = (
- (r'.*\b(?P<uri>(?P<prefix>https?://[^/]*?gitlab[^/]*?/.*/-/archive/.*?/\S*)\.(?:tar\.gz|tar|zip))',
+ (r'.*\b(?P<uri>https?://[^/]*?gitlab[^/]*?/.*/-/archive/.*?/\S*\.(?:tar\.gz|tar(?!.bz2)|zip))',
'.tar.bz2'),
)
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2022-10-29 18:46 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2022-10-29 18:46 UTC (permalink / raw
To: gentoo-commits
commit: 01b68ca982ce815c46330b9fabf2aefb7fd965b6
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 29 18:45:23 2022 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Oct 29 18:45:23 2022 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=01b68ca9
PythonGHDistfileSuffix: add common solution to docs
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/python.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py
index fc9a58e7..5d6a8a1a 100644
--- a/src/pkgcheck/checks/python.py
+++ b/src/pkgcheck/checks/python.py
@@ -621,6 +621,10 @@ class PythonGHDistfileSuffix(results.VersionResult, results.Warning):
published on PyPI. Since both kinds of distfiles often have the same name,
".gh.tar.gz" suffix is often used for the former to avoid filename
collisions with official archives published upstream.
+
+ To solve this warning, rename the distfile in ``SRC_URI`` to include the
+ suffix. There is no need to contact upstream, as it is done simply by
+ adding ``-> ${P}.gh.tar.gz`` after the URI.
"""
def __init__(self, filename, uri, **kwargs):
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2022-12-13 19:59 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2022-12-13 19:59 UTC (permalink / raw
To: gentoo-commits
commit: 9b634116478cefbce700acdfd5d819828f17863e
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 10 15:52:48 2022 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 13 19:58:46 2022 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=9b634116
MissingRemoteIdCheck: give ready <remote-id/> sample
Instead of verbose description of what to put in the missing remote-id
element, just print a ready-to-use XML snippet.
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Closes: https://github.com/pkgcore/pkgcheck/pull/500
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/metadata_xml.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pkgcheck/checks/metadata_xml.py b/src/pkgcheck/checks/metadata_xml.py
index 06d62cf3..2182585b 100644
--- a/src/pkgcheck/checks/metadata_xml.py
+++ b/src/pkgcheck/checks/metadata_xml.py
@@ -577,8 +577,8 @@ class MissingRemoteId(results.PackageResult, results.Info):
@property
def desc(self):
- return (f'missing remote-id of type {self.remote_type!r} with '
- f'value {self.value!r} (inferred from URI {self.uri!r})')
+ return (f'missing <remote-id type="{self.remote_type}">'
+ f'{self.value}</remote-id> (inferred from URI {self.uri!r})')
class MissingRemoteIdCheck(Check):
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2022-12-27 19:15 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2022-12-27 19:15 UTC (permalink / raw
To: gentoo-commits
commit: 5870fb301a195c17d481af90a3669e9ee8338085
Author: Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Tue Dec 27 08:51:19 2022 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 27 19:08:53 2022 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=5870fb30
Fix API compatibility w/ pkgcore revision eb6f4edd2
In that revision, USE flag validation is moved to eapi objects; EAPI
ultimately arbitrates that, and it cleaned up some internal issues in atom.
However, it broke pkgcheck's metadata check which was using that regex
directly; that code's broken anyways- any demandloaded object must not be
imported into another scope; the lazy replacement only affects the original scope,
thus that `self.valid_use = ` was pinning the proxied regex.
Either way; since EAPI objects now have a use flag validation method, use that.
Resolves: https://github.com/pkgcore/pkgcheck/issues/502
Signed-off-by: Brian Harring <ferringb <AT> gmail.com>
Closes: https://github.com/pkgcore/pkgcheck/pull/503
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/metadata.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/pkgcheck/checks/metadata.py b/src/pkgcheck/checks/metadata.py
index 6e087c5f..56d54529 100644
--- a/src/pkgcheck/checks/metadata.py
+++ b/src/pkgcheck/checks/metadata.py
@@ -210,11 +210,10 @@ class IuseCheck(Check):
def __init__(self, *args, use_addon):
super().__init__(*args)
self.iuse_handler = use_addon
- self.valid_use = atom_mod.valid_use_flag.match
self.bad_defaults = tuple(['-'] + [f'+{x}_' for x in self.use_expand_groups])
def feed(self, pkg):
- if invalid := sorted(x for x in pkg.iuse_stripped if not self.valid_use(x)):
+ if invalid := sorted(x for x in pkg.iuse_stripped if not pkg.eapi.is_valid_use_flag(x)):
yield InvalidUseFlags(invalid, pkg=pkg)
if pkg.eapi.options.iuse_defaults and (bad_defaults := sorted(
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-01-14 20:31 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-01-14 20:31 UTC (permalink / raw
To: gentoo-commits
commit: d10bd72a993057c7faab0c49fdc852444da9ef09
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 14 19:04:53 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Jan 14 20:30:58 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=d10bd72a
VariableScopeCheck: Disallow D and ED in pkg_postinst
According to QA policy PG 107:
https://projects.gentoo.org/qa/policy-guide/ebuild-format.html#pg0107
(Note that "pkg_postinst" was misspelt as "pkg_postint", so it would
have warned already.)
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
Closes: https://github.com/pkgcore/pkgcheck/pull/523
Closes: https://github.com/pkgcore/pkgcheck/issues/516
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/codingstyle.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pkgcheck/checks/codingstyle.py b/src/pkgcheck/checks/codingstyle.py
index ea315259..2145e2de 100644
--- a/src/pkgcheck/checks/codingstyle.py
+++ b/src/pkgcheck/checks/codingstyle.py
@@ -966,8 +966,8 @@ class VariableScopeCheck(Check):
"SYSROOT": ("src_", "pkg_setup"),
"ESYSROOT": ("src_", "pkg_setup"),
"BROOT": ("src_", "pkg_setup"),
- "D": ("src_install", "pkg_preinst", "pkg_postint"),
- "ED": ("src_install", "pkg_preinst", "pkg_postint"),
+ "D": ("src_install", "pkg_preinst"),
+ "ED": ("src_install", "pkg_preinst"),
"DESTTREE": "src_install",
"INSDESTTREE": "src_install",
"MERGE_TYPE": "pkg_",
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-01-20 13:20 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-01-20 13:20 UTC (permalink / raw
To: gentoo-commits
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)
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-01-20 15:01 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-01-20 15:01 UTC (permalink / raw
To: gentoo-commits
commit: c81bc6cde6a37c9f590a5f9a42346fe1f5fd220e
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 20 14:59:55 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Jan 20 14:59:55 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=c81bc6cd
EmptyDirsCheck: mark results' level as error
This check is done at repo level, so if you are inside a package dir, it
will be skipped. As a solution, mark those results as errors, so the bot
will fail to regen metadata and we can notice the issue.
Resolves: https://github.com/pkgcore/pkgcheck/issues/499
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/repo.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/pkgcheck/checks/repo.py b/src/pkgcheck/checks/repo.py
index 8b12f68d..eefc523e 100644
--- a/src/pkgcheck/checks/repo.py
+++ b/src/pkgcheck/checks/repo.py
@@ -50,7 +50,7 @@ class RepoDirCheck(GentooRepoCheck, RepoCheck):
yield BinaryFile(rel_path)
-class EmptyCategoryDir(results.CategoryResult, results.Warning):
+class EmptyCategoryDir(results.CategoryResult, results.Error):
"""Empty category directory in the repository."""
scope = base.repo_scope
@@ -60,7 +60,7 @@ class EmptyCategoryDir(results.CategoryResult, results.Warning):
return f"empty category directory: {self.category}"
-class EmptyPackageDir(results.PackageResult, results.Warning):
+class EmptyPackageDir(results.PackageResult, results.Error):
"""Empty package directory in the repository."""
scope = base.repo_scope
@@ -74,7 +74,7 @@ class EmptyDirsCheck(GentooRepoCheck, RepoCheck):
"""Scan for empty category or package directories."""
_source = (sources.EmptySource, (base.repo_scope,))
- known_results = frozenset([EmptyCategoryDir, EmptyPackageDir])
+ known_results = frozenset({EmptyCategoryDir, EmptyPackageDir})
def __init__(self, *args):
super().__init__(*args)
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-01-20 15:01 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-01-20 15:01 UTC (permalink / raw
To: gentoo-commits
commit: 59e9fd40f4a696f262f302b71daec703c719c413
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 20 15:01:36 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Jan 20 15:01:36 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=59e9fd40
checks.git: add type annotations
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/git.py | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py
index a54ce61e..6e48d47f 100644
--- a/src/pkgcheck/checks/git.py
+++ b/src/pkgcheck/checks/git.py
@@ -34,7 +34,7 @@ class GitCommitsRepoSource(sources.RepoSource):
required_addons = (git.GitAddon,)
- def __init__(self, options, git_addon):
+ def __init__(self, options, git_addon: git.GitAddon):
source = git_addon.commits_repo(git.GitChangedRepo)
super().__init__(options, source)
@@ -49,7 +49,7 @@ class GitCommitsSource(sources.Source):
scope = base.commit_scope
required_addons = (git.GitAddon,)
- def __init__(self, *args, git_addon):
+ def __init__(self, *args, git_addon: git.GitAddon):
super().__init__(*args, source=git_addon.commits())
@@ -100,9 +100,7 @@ class _DroppedKeywords(results.PackageResult):
def desc(self):
s = pluralism(self.keywords)
keywords = ", ".join(self.keywords)
- return (
- f"commit {self.commit} (or later) dropped {self._status} " f"keyword{s}: [ {keywords} ]"
- )
+ return f"commit {self.commit} (or later) dropped {self._status} keyword{s}: [ {keywords} ]"
class DroppedUnstableKeywords(_DroppedKeywords, results.Error):
@@ -243,11 +241,11 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
# package categories that are committed with stable keywords
allowed_direct_stable = frozenset(["acct-user", "acct-group"])
- def __init__(self, *args, git_addon):
+ def __init__(self, *args, git_addon: git.GitAddon):
super().__init__(*args)
self.today = datetime.today()
self.repo = self.options.target_repo
- self.valid_arches = self.options.target_repo.known_arches
+ self.valid_arches: frozenset[str] = self.options.target_repo.known_arches
self._git_addon = git_addon
self._cleanup = []
@@ -280,7 +278,7 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
old_keywords = set().union(*(p.keywords for p in removal_repo.match(pkg.unversioned_atom)))
new_keywords = set().union(*(p.keywords for p in self.repo.match(pkg.unversioned_atom)))
- dropped_keywords = old_keywords - new_keywords
+ dropped_keywords: set[str] = old_keywords - new_keywords
dropped_stable_keywords = dropped_keywords & self.valid_arches
dropped_unstable_keywords = set()
for keyword in (x for x in dropped_keywords if x[0] == "~"):
@@ -482,7 +480,7 @@ class BadCommitSummary(results.CommitResult, results.Style):
return f"commit {self.commit}, {self.error}: {self.summary!r}"
-def verify_tags(*tags, required=False):
+def verify_tags(*tags: str, required: bool = False):
"""Decorator to register commit tag verification methods."""
class decorator:
@@ -534,21 +532,20 @@ class GitCommitMessageCheck(GentooRepoCheck, GitCommitsCheck):
)
@verify_tags("Signed-off-by", required=True)
- def _signed_off_by_tag(self, tag, values, commit):
+ def _signed_off_by_tag(self, tag: str, values: list[str], commit: git.GitCommit):
"""Verify commit contains all required sign offs in accordance with GLEP 76."""
required_sign_offs = {commit.author, commit.committer}
- missing_sign_offs = required_sign_offs.difference(values)
- if missing_sign_offs:
+ if missing_sign_offs := required_sign_offs.difference(values):
yield MissingSignOff(sorted(missing_sign_offs), commit=commit)
@verify_tags("Gentoo-Bug")
- def _deprecated_tag(self, tag, values, commit):
+ def _deprecated_tag(self, tag: str, values: list[str], commit: git.GitCommit):
"""Flag deprecated tags that shouldn't be used."""
for value in values:
yield InvalidCommitTag(tag, value, f"{tag} tag is no longer valid", commit=commit)
@verify_tags("Bug", "Closes")
- def _bug_tag(self, tag, values, commit):
+ def _bug_tag(self, tag: str, values: list[str], commit: git.GitCommit):
"""Verify values are URLs for Bug/Closes tags."""
for value in values:
parsed = urlparse(value)
@@ -574,7 +571,7 @@ class GitCommitMessageCheck(GentooRepoCheck, GitCommitsCheck):
)
@verify_tags("Fixes", "Reverts")
- def _commit_tag(self, tag, values, commit):
+ def _commit_tag(self, tag, values, commit: git.GitCommit):
"""Verify referenced commits exist for Fixes/Reverts tags."""
self.git_cat_file.stdin.write("\n".join(values) + "\n")
if self.git_cat_file.poll() is None:
@@ -586,7 +583,7 @@ class GitCommitMessageCheck(GentooRepoCheck, GitCommitsCheck):
if not status.startswith("commit "):
yield InvalidCommitTag(tag, value, f"{status} commit", commit=commit)
- def feed(self, commit):
+ def feed(self, commit: git.GitCommit):
if len(commit.message) == 0:
yield InvalidCommitMessage("no commit message", commit=commit)
return
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-01-24 18:57 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-01-24 18:57 UTC (permalink / raw
To: gentoo-commits
commit: 0883521640398078ae4f363ffad78eaa1626ee55
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 24 18:57:01 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 24 18:57:01 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=08835216
RdependChange: skip when revbumped in same batch
Resolves: https://github.com/pkgcore/pkgcheck/issues/459
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/git.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py
index adc16874..c7c78bc8 100644
--- a/src/pkgcheck/checks/git.py
+++ b/src/pkgcheck/checks/git.py
@@ -340,7 +340,7 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
else:
yield MissingMove(old_key, new_key, pkg=pkg)
- def modified_checks(self, pkgs):
+ def modified_checks(self, pkgs, added):
"""Check for issues due to package modifications."""
pkg = pkgs[0]
@@ -361,7 +361,7 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
# ignore broken ebuild
return
- if old_pkg.rdepend != new_pkg.rdepend:
+ if pkg not in added and old_pkg.rdepend != new_pkg.rdepend:
yield RdependChange(pkg=new_pkg)
old_slot, new_slot = old_pkg.slot, new_pkg.slot
@@ -437,7 +437,7 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
yield from self.rename_checks(list(pkg_map["R"]))
# run modified package checks
if modified := [pkg for pkg in pkg_map["M"] if pkg not in pkg_map["D"]]:
- yield from self.modified_checks(modified)
+ yield from self.modified_checks(modified, list(pkg_map["A"]))
for git_pkg in pkgset:
# remaining checks are irrelevant for removed packages
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-01-31 16:44 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-01-31 16:44 UTC (permalink / raw
To: gentoo-commits
commit: 4438566500fdf116ba36c3c407022e89541867d6
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 29 14:50:41 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 31 16:17:53 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=44385665
checks: Add a check for Python pkgnames matching PyPI
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Closes: https://github.com/pkgcore/pkgcheck/pull/534
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/python.py | 47 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py
index 510689bb..6965d2a9 100644
--- a/src/pkgcheck/checks/python.py
+++ b/src/pkgcheck/checks/python.py
@@ -24,6 +24,8 @@ GITHUB_ARCHIVE_RE = re.compile(r"^https://github\.com/[^/]+/[^/]+/archive/")
SNAPSHOT_RE = re.compile(r"[a-fA-F0-9]{40}\.tar\.gz$")
USE_FLAGS_PYTHON_USEDEP = re.compile(r"\[(.+,)?\$\{PYTHON_USEDEP\}(,.+)?\]$")
+PEP503_SYMBOL_NORMALIZE_RE = re.compile(r"[-_.]")
+
def get_python_eclass(pkg):
eclasses = ECLASSES.intersection(pkg.inherited)
@@ -694,3 +696,48 @@ class PythonGHDistfileSuffixCheck(Check):
if GITHUB_ARCHIVE_RE.match(uri):
yield PythonGHDistfileSuffix(f.filename, uri, pkg=pkg)
break
+
+
+class PythonMismatchedPackageName(results.PackageResult, results.Info):
+ """Package name does not follow PyPI-based naming policy"""
+
+ def __init__(self, recommended: str, **kwargs):
+ super().__init__(**kwargs)
+ self.recommended = recommended
+
+ @property
+ def desc(self) -> str:
+ return ("package name does not match remote-id, recommended name: "
+ f"{self.recommended!r}")
+
+
+class PythonPackageNameCheck(Check):
+ """Check ebuild names in dev-python/*."""
+
+ _source = sources.PackageRepoSource
+ known_results = frozenset([PythonMismatchedPackageName])
+
+ def feed(self, pkgs):
+ pkg = next(iter(pkgs))
+
+ # the policy applies to dev-python/* only
+ if pkg.category != "dev-python":
+ return
+
+ # consider only packages with a single pypi remote-id
+ pypi_remotes = [x for x in pkg.upstreams if x.type == "pypi"]
+ if len(pypi_remotes) != 1:
+ return
+
+ def normalize(project: str) -> str:
+ """
+ Normalize project name using PEP 503 rules
+
+ https://peps.python.org/pep-0503/#normalized-names
+ """
+ return PEP503_SYMBOL_NORMALIZE_RE.sub("-", project).lower()
+
+ pypi_name = pypi_remotes[0].name
+ if normalize(pkg.package) != normalize(pypi_name):
+ yield PythonMismatchedPackageName(pypi_name.replace(".", "-"),
+ pkg=pkg)
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-01-31 17:08 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-01-31 17:08 UTC (permalink / raw
To: gentoo-commits
commit: e8a4b35b90c6c3ab1b7029770d2e47c4be0dbeb2
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 31 17:07:00 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 31 17:07:00 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=e8a4b35b
checks.python: small modernization
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/python.py | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py
index 41edac21..2b20ee93 100644
--- a/src/pkgcheck/checks/python.py
+++ b/src/pkgcheck/checks/python.py
@@ -41,7 +41,7 @@ def is_python_interpreter(pkg):
# ignore python:2.7 deps since they are being phased out from eclass
# support
return pkg.slot is None or not pkg.slot.startswith("2")
- return pkg.key in ["dev-python/pypy3"]
+ return pkg.key in ("dev-python/pypy3",)
class MissingPythonEclass(results.VersionResult, results.Warning):
@@ -74,9 +74,7 @@ class PythonMissingRequiredUse(results.VersionResult, results.Warning):
used conditionally, it can be wrapped in appropriate USE conditionals.
"""
- @property
- def desc(self):
- return 'missing REQUIRED_USE="${PYTHON_REQUIRED_USE}"'
+ desc = 'missing REQUIRED_USE="${PYTHON_REQUIRED_USE}"'
class PythonMissingDeps(results.VersionResult, results.Warning):
@@ -138,9 +136,7 @@ class PythonEclassError(results.VersionResult, results.Error):
class DistutilsNonPEP517Build(results.VersionResult, results.Warning):
"""Ebuild uses the deprecated non-PEP517 build"""
- @property
- def desc(self):
- return "uses deprecated non-PEP517 build mode, please switch to " "DISTUTILS_USE_PEP517=..."
+ desc = "uses deprecated non-PEP517 build mode, please switch to DISTUTILS_USE_PEP517=..."
class PythonHasVersionUsage(results.LinesResult, results.Style):
@@ -173,7 +169,7 @@ class PythonHasVersionMissingPythonUseDep(results.LineResult, results.Error):
@property
def desc(self):
return (
- f'line: {self.lineno}: missing [${{PYTHON_USEDEP}}] suffix for argument "{self.line}"'
+ f"line: {self.lineno}: missing [${{PYTHON_USEDEP}}] suffix for argument {self.line!r}"
)
@@ -270,8 +266,7 @@ class PythonCheck(Check):
def scan_tree_recursively(self, deptree, expected_cls):
for x in deptree:
if not isinstance(x, expected_cls):
- for y in self.scan_tree_recursively(x, expected_cls):
- yield y
+ yield from self.scan_tree_recursively(x, expected_cls)
yield deptree
def check_required_use(self, requse, flags, prefix, container_cls):
@@ -576,12 +571,12 @@ class PythonCompatCheck(Check):
def deps(self, pkg, attrs=None):
"""Set of dependencies for a given package's attributes."""
attrs = attrs if attrs is not None else pkg.eapi.dep_keys
- deps = set()
- for attr in (x.lower() for x in attrs):
- for p in iflatten_instance(getattr(pkg, attr), atom):
- if not p.blocks:
- deps.add(p)
- return deps
+ return {
+ p
+ for attr in (x.lower() for x in attrs)
+ for p in iflatten_instance(getattr(pkg, attr), atom)
+ if not p.blocks
+ }
def feed(self, pkg):
try:
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-02-05 17:18 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-02-05 17:18 UTC (permalink / raw
To: gentoo-commits
commit: f0afcf79495fb4220258bae1acd1304a755dbc66
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 5 17:15:31 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Feb 5 17:15:31 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=f0afcf79
SuspiciousSrcUriChange: compare with expanded mirror
Resolves: https://github.com/pkgcore/pkgcheck/issues/542
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/git.py | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py
index c7c78bc8..4a9466c6 100644
--- a/src/pkgcheck/checks/git.py
+++ b/src/pkgcheck/checks/git.py
@@ -375,13 +375,15 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
else:
yield MissingSlotmove(old_slot, new_slot, pkg=new_pkg)
- @staticmethod
- def _fetchable_str(fetch: fetchable) -> str:
+ def _fetchable_str(self, fetch: fetchable) -> tuple[str, str]:
uri = tuple(fetch.uri._uri_source)[0]
if isinstance(uri, tuple):
- return f"mirror://{uri[0].mirror_name}/{uri[1]}"
+ mirror = uri[0].mirror_name
+ expands = self.repo.mirrors.get(mirror)
+ expand = (expands or (f"mirror://{mirror}",))[0].lstrip("/")
+ return f"{expand}/{uri[1]}", f"mirror://{uri[0].mirror_name}/{uri[1]}"
else:
- return str(uri)
+ return (str(uri),) * 2
def src_uri_changes(self, pkgset):
pkg = pkgset[0].unversioned_atom
@@ -403,11 +405,11 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
return
for filename in old_checksums.keys() & new_checksums.keys():
- old_checksum, old_uri = old_checksums[filename]
- new_checksum, new_uri = new_checksums[filename]
+ old_checksum, (old_expand, old_uri) = old_checksums[filename]
+ new_checksum, (new_expand, new_uri) = new_checksums[filename]
if old_checksum != new_checksum:
yield SrcUriChecksumChange(filename, pkg=pkg)
- elif old_uri != new_uri:
+ elif old_expand != new_expand:
yield SuspiciousSrcUriChange(old_uri, new_uri, filename, pkg=pkg)
def feed(self, pkgset: list[git.GitPkgChange]):
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-02-05 17:56 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-02-05 17:56 UTC (permalink / raw
To: gentoo-commits
commit: 5727b3be6b1b99ae6d47873585a8e92e96147a9f
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 5 17:53:32 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Feb 5 17:53:32 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=5727b3be
UnusedInherits: fix false positives for eclasses defining special vars
Skip unused warning for eclasses which define special variables like
SRC_URI, HOMEPAGE, etc. In practice it makes any inherit for pypi,
ruby-fakegem, ruby-ng-gnome2, gstreamer-meson to never be considered
unused.
Resolves: https://github.com/pkgcore/pkgcheck/issues/361
Resolves: https://github.com/pkgcore/pkgcheck/issues/540
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/codingstyle.py | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/pkgcheck/checks/codingstyle.py b/src/pkgcheck/checks/codingstyle.py
index 6fec22ca..a9eb70fa 100644
--- a/src/pkgcheck/checks/codingstyle.py
+++ b/src/pkgcheck/checks/codingstyle.py
@@ -3,7 +3,7 @@
import re
from collections import defaultdict
-from pkgcore.ebuild.eapi import EAPI
+from pkgcore.ebuild.eapi import EAPI, common_mandatory_metadata_keys
from snakeoil.mappings import ImmutableDict
from snakeoil.sequences import stable_unique
from snakeoil.strings import pluralism
@@ -758,10 +758,9 @@ class InheritsCheck(Check):
# register EAPI-related vars to ignore
# TODO: add ebuild env vars via pkgcore setting, e.g. PN, PV, P, FILESDIR, etc
- self.eapi_vars = {}
- for eapi in EAPI.known_eapis.values():
- s = set(eapi.eclass_keys)
- self.eapi_vars[eapi] = frozenset(s)
+ self.eapi_vars = {eapi: frozenset(eapi.eclass_keys) for eapi in EAPI.known_eapis.values()}
+
+ self.unused_eclass_skiplist = frozenset(common_mandatory_metadata_keys) - {"IUSE"}
def get_eclass(self, export, pkg):
"""Return the eclass related to a given exported variable or function name."""
@@ -851,10 +850,12 @@ class InheritsCheck(Check):
# ignore eclasses with parsing failures
unused.discard(eclass)
else:
- exported_eclass_keys = pkg.eapi.eclass_keys.intersection(
+ exported_eclass_keys: set[str] = pkg.eapi.eclass_keys.intersection(
self.eclass_cache[eclass].exported_variable_names
)
- if not self.eclass_cache[eclass].exported_function_names and exported_eclass_keys:
+ if exported_eclass_keys.intersection(self.unused_eclass_skiplist):
+ unused.discard(eclass)
+ elif not self.eclass_cache[eclass].exported_function_names and exported_eclass_keys:
# ignore eclasses that export ebuild metadata (e.g.
# SRC_URI, S, ...) and no functions
unused.discard(eclass)
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-02-16 18:44 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-02-16 18:44 UTC (permalink / raw
To: gentoo-commits
commit: eeee8f39dd01df91dd64c33f54b2c95ae3bcc337
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 13 07:03:36 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed Feb 15 17:49:27 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=eeee8f39
python: Use a more generic name for the project normalization regex
Do not reference PEP 503 in the project name normalization regex.
The same regex will be used for other kinds of project name
normalization, notably wheel and sdist normalization.
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/python.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py
index 29b3db8e..7cff5f12 100644
--- a/src/pkgcheck/checks/python.py
+++ b/src/pkgcheck/checks/python.py
@@ -25,7 +25,7 @@ GITHUB_ARCHIVE_RE = re.compile(r"^https://github\.com/[^/]+/[^/]+/archive/")
SNAPSHOT_RE = re.compile(r"[a-fA-F0-9]{40}\.tar\.gz$")
USE_FLAGS_PYTHON_USEDEP = re.compile(r"\[(.+,)?\$\{PYTHON_USEDEP\}(,.+)?\]$")
-PEP503_SYMBOL_NORMALIZE_RE = re.compile(r"[-_.]+")
+PROJECT_SYMBOL_NORMALIZE_RE = re.compile(r"[-_.]+")
def get_python_eclass(pkg):
@@ -768,7 +768,7 @@ class PythonPackageNameCheck(Check):
https://peps.python.org/pep-0503/#normalized-names
"""
- return PEP503_SYMBOL_NORMALIZE_RE.sub("-", project).lower()
+ return PROJECT_SYMBOL_NORMALIZE_RE.sub("-", project).lower()
pypi_name = pypi_remotes[0].name
if normalize(pkg.package) != normalize(pypi_name):
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-02-17 10:10 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-02-17 10:10 UTC (permalink / raw
To: gentoo-commits
commit: fcdd1698e17876d0f45bf07de09320275b512898
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 17 10:04:19 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Feb 17 10:04:19 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=fcdd1698
InvalidCommitTag: fix false positive for advanced fixes format
Support more advanced format for Fixes and Reverts, which can have
explanation text after the commit hash, and can end in a dot.
Resolves: https://github.com/pkgcore/pkgcheck/issues/546
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/git.py | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py
index 4a9466c6..23f984b4 100644
--- a/src/pkgcheck/checks/git.py
+++ b/src/pkgcheck/checks/git.py
@@ -507,7 +507,7 @@ class InvalidCommitTag(results.CommitResult, results.Style):
.. [#] https://www.gentoo.org/glep/glep-0066.html#commit-messages
"""
- def __init__(self, tag, value, error, **kwargs):
+ def __init__(self, tag: str, value: str, error: str, **kwargs):
super().__init__(**kwargs)
self.tag, self.value, self.error = tag, value, error
@@ -571,18 +571,19 @@ class GitCommitMessageCheck(GentooRepoCheck, GitCommitsCheck):
_source = GitCommitsSource
known_results = frozenset(
- [
+ {
MissingSignOff,
InvalidCommitTag,
InvalidCommitMessage,
BadCommitSummary,
- ]
+ }
)
# mapping between known commit tags and verification methods
known_tags = {}
_commit_footer_regex = re.compile(r"^(?P<tag>[a-zA-Z0-9_-]+): (?P<value>.*)$")
_git_cat_file_regex = re.compile(r"^(?P<object>.+?) (?P<status>.+)$")
+ _commit_ref_regex = re.compile(r"^(?P<object>[0-9a-fA-F]+?)( \(.+?\))?\.?$")
# categories exception for rule of having package version in summary
skipped_categories = frozenset(
@@ -642,15 +643,23 @@ class GitCommitMessageCheck(GentooRepoCheck, GitCommitsCheck):
@verify_tags("Fixes", "Reverts")
def _commit_tag(self, tag, values, commit: git.GitCommit):
"""Verify referenced commits exist for Fixes/Reverts tags."""
- self.git_cat_file.stdin.write("\n".join(values) + "\n")
+ commits: dict[str, str] = {}
+ for value in values:
+ if mo := self._commit_ref_regex.match(value):
+ commits[mo.group("object")] = value
+ else:
+ yield InvalidCommitTag(tag, value, "invalid format", commit=commit)
+ self.git_cat_file.stdin.write("\n".join(commits.keys()) + "\n")
if self.git_cat_file.poll() is None:
- for _ in range(len(values)):
+ for _ in range(len(commits)):
line = self.git_cat_file.stdout.readline().strip()
if mo := self._git_cat_file_regex.match(line):
value = mo.group("object")
status = mo.group("status")
if not status.startswith("commit "):
- yield InvalidCommitTag(tag, value, f"{status} commit", commit=commit)
+ yield InvalidCommitTag(
+ tag, commits[value], f"{status} commit", commit=commit
+ )
def feed(self, commit: git.GitCommit):
if len(commit.message) == 0:
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-02-18 18:33 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-02-18 18:33 UTC (permalink / raw
To: gentoo-commits
commit: e02e7c0db8c358e4fa2b9acb1fa9e2c04754fef7
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 17 10:09:15 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Feb 17 10:09:15 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=e02e7c0d
SuspiciousSrcUriChange: fix mirrors in fetchables
Resolves: https://github.com/pkgcore/pkgcheck/issues/548
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/git.py | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py
index 23f984b4..8b272531 100644
--- a/src/pkgcheck/checks/git.py
+++ b/src/pkgcheck/checks/git.py
@@ -392,13 +392,27 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
new_checksums = {
fetch.filename: (fetch.chksums, self._fetchable_str(fetch))
for pkg in self.repo.match(pkg)
- for fetch in iflatten_instance(pkg.fetchables, fetchable)
+ for fetch in iflatten_instance(
+ pkg.generate_fetchables(
+ allow_missing_checksums=True,
+ ignore_unknown_mirrors=True,
+ skip_default_mirrors=True,
+ ),
+ fetchable,
+ )
}
old_checksums = {
fetch.filename: (fetch.chksums, self._fetchable_str(fetch))
for pkg in self.modified_repo(pkgset).match(pkg)
- for fetch in iflatten_instance(pkg.fetchables, fetchable)
+ for fetch in iflatten_instance(
+ pkg.generate_fetchables(
+ allow_missing_checksums=True,
+ ignore_unknown_mirrors=True,
+ skip_default_mirrors=True,
+ ),
+ fetchable,
+ )
}
except (IndexError, FileNotFoundError, tarfile.ReadError):
# ignore broken ebuild
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-03-04 18:24 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-03-04 18:24 UTC (permalink / raw
To: gentoo-commits
commit: bf68177d4026b014f96e64ff3c3a632ecc30a5d2
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 4 18:24:17 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 4 18:24:17 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=bf68177d
PythonMissingSCMDependency: update to new pkg names
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/python.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py
index 291a56b4..19b87ef5 100644
--- a/src/pkgcheck/checks/python.py
+++ b/src/pkgcheck/checks/python.py
@@ -234,16 +234,16 @@ class PythonAnyMismatchedDepHasVersionCheck(results.VersionResult, results.Warni
class PythonMissingSCMDependency(results.VersionResult, results.Warning):
- """Package is missing BDEPEND on setuptools_scm or alike.
+ """Package is missing BDEPEND on setuptools-scm or alike.
Packages which define ``SETUPTOOLS_SCM_PRETEND_VERSION`` should BDEPEND
- on ``dev-python/setuptools_scm`` or a similar package [#]_.
+ on ``dev-python/setuptools-scm`` or a similar package [#]_.
.. [#] https://projects.gentoo.org/python/guide/distutils.html#setuptools-scm-flit-scm-hatch-vcs-and-snapshots
"""
desc = (
- "defines SETUPTOOLS_SCM_PRETEND_VERSION but is missing BDEPEND on setuptools_scm or alike"
+ "defines SETUPTOOLS_SCM_PRETEND_VERSION but is missing BDEPEND on setuptools-scm or alike"
)
@@ -291,8 +291,10 @@ class PythonCheck(Check):
setuptools_scm = frozenset(
{
- "dev-python/setuptools_scm",
- "dev-python/flit_scm",
+ "dev-python/setuptools-scm",
+ "dev-python/setuptools_scm", # legacy old name
+ "dev-python/flit-scm",
+ "dev-python/flit_scm", # legacy old name
"dev-python/hatch-vcs",
}
)
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-03-11 7:18 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-03-11 7:18 UTC (permalink / raw
To: gentoo-commits
commit: 94a1af3c65f8cecd05feabe1c25ac94d27c8db1c
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 11 07:17:00 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 11 07:17:00 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=94a1af3c
SrcUriChecksumChange: fix false positive with new ebuilds
When ebuilds are added and being modified in the same commit range, they
might result in thinking there is old checksum for the file, when in
fact it is empty dict.
Resolves: https://github.com/pkgcore/pkgcheck/issues/553
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/git.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py
index aec3b05f..c7785729 100644
--- a/src/pkgcheck/checks/git.py
+++ b/src/pkgcheck/checks/git.py
@@ -444,6 +444,7 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
),
fetchable,
)
+ if fetch.chksums
}
old_checksums = {
@@ -457,6 +458,7 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
),
fetchable,
)
+ if fetch.chksums
}
except (IndexError, FileNotFoundError, tarfile.ReadError):
# ignore broken ebuild
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-03-18 15:04 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-03-18 15:04 UTC (permalink / raw
To: gentoo-commits
commit: 6bb4201548e378bb2001610726022de50c79e711
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 18 15:03:54 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 18 15:03:54 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=6bb42015
UnknownCategoryDirs: enable for overlays, ignore scripts dir
Resolves: https://github.com/pkgcore/pkgcheck/issues/564
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/profiles.py | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/pkgcheck/checks/profiles.py b/src/pkgcheck/checks/profiles.py
index a0b8c618..5394dca7 100644
--- a/src/pkgcheck/checks/profiles.py
+++ b/src/pkgcheck/checks/profiles.py
@@ -536,7 +536,7 @@ class RepoProfilesCheck(RepoCheck):
_source = (sources.EmptySource, (base.profiles_scope,))
required_addons = (addons.profiles.ProfileAddon,)
known_results = frozenset(
- [
+ {
ArchesWithoutProfiles,
UnusedProfileDirs,
NonexistentProfilePath,
@@ -548,11 +548,13 @@ class RepoProfilesCheck(RepoCheck):
BannedProfileEapi,
DeprecatedProfileEapi,
ArchesOutOfSync,
- ]
+ }
)
# known profile status types for the gentoo repo
- known_profile_statuses = frozenset(["stable", "dev", "exp"])
+ known_profile_statuses = frozenset({"stable", "dev", "exp"})
+
+ unknown_categories_whitelist = ("scripts",)
def __init__(self, *args, profile_addon):
super().__init__(*args)
@@ -562,11 +564,10 @@ class RepoProfilesCheck(RepoCheck):
self.non_profile_dirs = profile_addon.non_profile_dirs
def finish(self):
- if self.options.gentoo_repo:
- if unknown_category_dirs := set(self.repo.category_dirs).difference(
- self.repo.categories
- ):
- yield UnknownCategoryDirs(sorted(unknown_category_dirs))
+ if unknown_category_dirs := set(self.repo.category_dirs).difference(
+ self.repo.categories, self.unknown_categories_whitelist
+ ):
+ yield UnknownCategoryDirs(sorted(unknown_category_dirs))
if nonexistent_categories := set(self.repo.config.categories).difference(
self.repo.category_dirs
):
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-03-24 13:56 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-03-24 13:56 UTC (permalink / raw
To: gentoo-commits
commit: 5704c77f5cabed06be363df78ca03b6e66566a97
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 21 16:09:02 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 24 13:56:06 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=5704c77f
python: Rewrite "one PyPI URL" check to reuse PYPI_SDIST_URI_RE
Technically this is less optimal than the original code but it opens up
the possibility of enabling PYPI_PN support next.
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/python.py | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py
index 19b87ef5..95295271 100644
--- a/src/pkgcheck/checks/python.py
+++ b/src/pkgcheck/checks/python.py
@@ -815,18 +815,17 @@ class PythonFetchableCheck(Check):
if len(pypi_uris) == 1:
uri, filename = pypi_uris[0]
- def matches_fn(expected_fn: str) -> bool:
- expected = f"{PYPI_URI_PREFIX}source/{pkg.package[0]}/{pkg.package}/{expected_fn}"
- return uri == expected and filename == expected_fn
-
- version = self.translate_version(pkg.version)
- append = len(uris) > 1
- if matches_fn(f"{self.normalize_distribution_name(pkg.package)}-{version}.tar.gz"):
- yield PythonInlinePyPIURI(uri, normalize=True, append=append, pkg=pkg)
- return
- if matches_fn(f"{pkg.package}-{version}.tar.gz"):
- yield PythonInlinePyPIURI(uri, normalize=False, append=append, pkg=pkg)
- return
+ if source_match := PYPI_SDIST_URI_RE.match(uri):
+ pn, filename_pn, pv, suffix = source_match.groups()
+ if pv == self.translate_version(pkg.version) and suffix == ".tar.gz":
+ append = len(uris) > 1
+ normalize = filename_pn == self.normalize_distribution_name(pn)
+ if not normalize and filename_pn != pn:
+ # ignore malformed URLs
+ return
+ if pn == pkg.package:
+ yield PythonInlinePyPIURI(uri, normalize=normalize, append=append, pkg=pkg)
+ return
# otherwise, yield result for every URL, with suggested replacement
for uri, dist_filename in pypi_uris:
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-05-12 17:21 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-05-12 17:21 UTC (permalink / raw
To: gentoo-commits
commit: eb6a62d9547f3de6677cbf64e6bd674ff8c5ba82
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri May 12 17:17:44 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri May 12 17:17:44 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=eb6a62d9
ProfilesCheck: fix handling of profiles with neg_action package
When a "packages" file under a profile declares "-*" (meaning to remove
all defaults), pkgcore pushes a special token (`True`) into the packages
set. This is taken by ProfileStack to clean up previous stack, but the
check wasn't expecting this token. Fixes by adding skip for that token.
Resolves: https://github.com/pkgcore/pkgcheck/issues/577
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/profiles.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pkgcheck/checks/profiles.py b/src/pkgcheck/checks/profiles.py
index 5394dca7..3420e471 100644
--- a/src/pkgcheck/checks/profiles.py
+++ b/src/pkgcheck/checks/profiles.py
@@ -278,7 +278,7 @@ class ProfilesCheck(Check):
)
def _pkg_atoms(self, filename, node, vals):
for x in iflatten_instance(vals, atom_cls):
- if not self.search_repo.match(x):
+ if not isinstance(x, bool) and not self.search_repo.match(x):
yield UnknownProfilePackage(pjoin(node.name, filename), x)
@verify_files(
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-06-24 7:52 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-06-24 7:52 UTC (permalink / raw
To: gentoo-commits
commit: afc779b8a445cf95f1ea907bb1ac651cf9440815
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 21 18:20:57 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 24 05:49:32 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=afc779b8
ProfilesCheck: for unknown packages, mention last match removed
https://github.com/pkgcore/pkgcheck/issues/588
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/profiles.py | 48 +++++++++++++++++++++++++++++++++++------
1 file changed, 42 insertions(+), 6 deletions(-)
diff --git a/src/pkgcheck/checks/profiles.py b/src/pkgcheck/checks/profiles.py
index 3420e471..b9108f83 100644
--- a/src/pkgcheck/checks/profiles.py
+++ b/src/pkgcheck/checks/profiles.py
@@ -1,5 +1,6 @@
"""Various profile-related checks."""
+from datetime import datetime
import os
from collections import defaultdict
from typing import Iterable
@@ -16,6 +17,21 @@ from .. import addons, base, results, sources
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."""
+
+ def __init__(self, path, atom, age):
+ super().__init__()
+ self.path = path
+ self.atom = str(atom)
+ self.age = float(age)
+
+ @property
+ def desc(self):
+ return f"{self.path!r}: outdated package entry: {self.atom!r}, last match removed {self.age} years ago"
+
+
class UnknownProfilePackage(results.ProfilesResult, results.Warning):
"""Profile files includes package entry that doesn't exist in the repo."""
@@ -190,9 +206,10 @@ class ProfilesCheck(Check):
"""Scan repo profiles for unknown flags/packages."""
_source = sources.ProfilesRepoSource
- required_addons = (addons.UseAddon, addons.KeywordsAddon)
+ required_addons = (addons.UseAddon, addons.KeywordsAddon, addons.git.GitAddon)
known_results = frozenset(
{
+ OutdatedProfilePackage,
UnknownProfilePackage,
UnmatchedProfilePackageUnmask,
UnknownProfilePackageUse,
@@ -210,12 +227,20 @@ class ProfilesCheck(Check):
# mapping between known files and verification methods
known_files = {}
- def __init__(self, *args, use_addon: addons.UseAddon, keywords_addon: addons.KeywordsAddon):
+ def __init__(
+ self,
+ *args,
+ use_addon: addons.UseAddon,
+ keywords_addon: addons.KeywordsAddon,
+ git_addon: addons.git.GitAddon,
+ ):
super().__init__(*args)
repo = self.options.target_repo
self.keywords = keywords_addon
self.search_repo = self.options.search_repo
self.profiles_dir = repo.config.profiles_base
+ self.today = datetime.today()
+ self.existence_repo = git_addon.cached_repo(addons.git.GitRemovedRepo)
self.use_expand_groups = {
use.upper(): frozenset({val.removeprefix(f"{use}_") for val, _desc in vals})
for use, vals in repo.config.use_expand_desc.items()
@@ -229,6 +254,17 @@ class ProfilesCheck(Check):
| use_addon.global_iuse_implicit
)
+ def _report_unknown_atom(self, path, atom):
+ if not isinstance(atom, atom_cls):
+ atom = atom_cls(atom)
+ if matches := self.existence_repo.match(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)
+
@verify_files(("parent", "parents"), ("eapi", "eapi"))
def _pull_attr(self, *args):
"""Verification only needs to pull the profile attr."""
@@ -279,7 +315,7 @@ class ProfilesCheck(Check):
def _pkg_atoms(self, filename, node, vals):
for x in iflatten_instance(vals, atom_cls):
if not isinstance(x, bool) and not self.search_repo.match(x):
- yield UnknownProfilePackage(pjoin(node.name, filename), x)
+ yield self._report_unknown_atom(pjoin(node.name, filename), x)
@verify_files(
("package.mask", "masks"),
@@ -292,10 +328,10 @@ class ProfilesCheck(Check):
unmasked, masked = vals
for x in masked:
if not self.search_repo.match(x):
- yield UnknownProfilePackage(pjoin(node.name, filename), x)
+ yield self._report_unknown_atom(pjoin(node.name, filename), x)
for x in unmasked:
if not self.search_repo.match(x):
- yield UnknownProfilePackage(pjoin(node.name, filename), x)
+ yield self._report_unknown_atom(pjoin(node.name, filename), x)
elif x not in all_masked:
yield UnmatchedProfilePackageUnmask(pjoin(node.name, filename), x)
@@ -324,7 +360,7 @@ class ProfilesCheck(Check):
pjoin(node.name, filename), a, unknown_enabled
)
else:
- yield UnknownProfilePackage(pjoin(node.name, filename), a)
+ yield self._report_unknown_atom(pjoin(node.name, filename), a)
@verify_files(("make.defaults", "make_defaults"))
def _make_defaults(self, filename: str, node: sources.ProfileNode, vals: dict[str, str]):
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-07-15 10:17 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-07-15 10:17 UTC (permalink / raw
To: gentoo-commits
commit: 56880290ded28c7cca414a958b48be4e8d12a4e1
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 10:14:59 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 15 10:14:59 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=56880290
GitPkgCommitsCheck: fix failure during compute of environment
In rare cases, ebd might fail for some ebuilds during the compute of
`.environment` property. For now let's eat up all of those cases since
other checks will catch the issues.
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/git.py | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py
index 8a80fb90..525bf693 100644
--- a/src/pkgcheck/checks/git.py
+++ b/src/pkgcheck/checks/git.py
@@ -1,5 +1,6 @@
"""Various git-related checks."""
+import contextlib
import os
import re
import subprocess
@@ -440,13 +441,14 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
else:
yield MissingSlotmove(old_slot, new_slot, pkg=new_pkg)
- for env_line in new_pkg.environment.data.splitlines():
- if mo := self.python_compat_declare_regex.match(env_line):
- if old_compat := {
- m.group("val")
- for m in re.finditer(self.env_array_elem_regex, mo.group("value"))
- }.difference(self.valid_python_targets):
- yield OldPythonCompat(sorted(old_compat), pkg=new_pkg)
+ with contextlib.suppress(Exception):
+ for env_line in new_pkg.environment.data.splitlines():
+ if mo := self.python_compat_declare_regex.match(env_line):
+ if old_compat := {
+ m.group("val")
+ for m in re.finditer(self.env_array_elem_regex, mo.group("value"))
+ }.difference(self.valid_python_targets):
+ yield OldPythonCompat(sorted(old_compat), pkg=new_pkg)
def _fetchable_str(self, fetch: fetchable) -> tuple[str, str]:
uri = tuple(fetch.uri._uri_source)[0]
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-08-02 11:59 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-08-02 11:59 UTC (permalink / raw
To: gentoo-commits
commit: a327dcfb96db1aba2499bdf8d84a298fa815adc5
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 2 10:42:32 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed Aug 2 11:22:10 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=a327dcfb
VariableScopeCheck: Disallow D and ED in pkg_postinst (again)
https://projects.gentoo.org/qa/policy-guide/ebuild-format.html#pg0107
Fixes: 2cfc92ccab6ddfedd79ec16b8ebdde4eae8d2ad4
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/codingstyle.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pkgcheck/checks/codingstyle.py b/src/pkgcheck/checks/codingstyle.py
index a05831cd..2b7dbafe 100644
--- a/src/pkgcheck/checks/codingstyle.py
+++ b/src/pkgcheck/checks/codingstyle.py
@@ -987,8 +987,8 @@ class VariableScopeCheck(Check):
"SYSROOT": ("src_", "pkg_setup"),
"ESYSROOT": ("src_", "pkg_setup"),
"BROOT": ("src_", "pkg_setup"),
- "D": ("src_install", "pkg_preinst", "pkg_postinst"),
- "ED": ("src_install", "pkg_preinst", "pkg_postinst"),
+ "D": ("src_install", "pkg_preinst"), # pkg_postinst is forbidden by QA policy PG 107
+ "ED": ("src_install", "pkg_preinst"), # pkg_postinst is forbidden by QA policy PG 107
"DESTTREE": "src_install",
"INSDESTTREE": "src_install",
"MERGE_TYPE": "pkg_",
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-08-03 17:28 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-08-03 17:28 UTC (permalink / raw
To: gentoo-commits
commit: aa668df52b198d1e1baaa3ce9d3836052e50a85f
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 2 12:45:53 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu Aug 3 17:28:35 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=aa668df5
VariableScopeCheck: BROOT is allowed also in pkg_{pre,post}{inst,rm}
PMS commit:
https://gitweb.gentoo.org/proj/pms.git/commit/?id=1a27729740e17ccd4b7a4527a46011fa62c9efb1
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
Closes: https://github.com/pkgcore/pkgcheck/pull/609
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/codingstyle.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pkgcheck/checks/codingstyle.py b/src/pkgcheck/checks/codingstyle.py
index 2b7dbafe..c99a8eca 100644
--- a/src/pkgcheck/checks/codingstyle.py
+++ b/src/pkgcheck/checks/codingstyle.py
@@ -986,7 +986,7 @@ class VariableScopeCheck(Check):
"EROOT": "pkg_",
"SYSROOT": ("src_", "pkg_setup"),
"ESYSROOT": ("src_", "pkg_setup"),
- "BROOT": ("src_", "pkg_setup"),
+ "BROOT": ("src_", "pkg_setup", "pkg_preinst", "pkg_prerm", "pkg_post"),
"D": ("src_install", "pkg_preinst"), # pkg_postinst is forbidden by QA policy PG 107
"ED": ("src_install", "pkg_preinst"), # pkg_postinst is forbidden by QA policy PG 107
"DESTTREE": "src_install",
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-08-29 18:58 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-08-29 18:58 UTC (permalink / raw
To: gentoo-commits
commit: e6df8ff65d9013d9ae76949a171fa65dede462f0
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 29 18:55:19 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 29 18:57:57 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=e6df8ff6
RedundantLongDescription: lower too short threshold
Resolves: https://github.com/pkgcore/pkgcheck/issues/614
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/metadata_xml.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pkgcheck/checks/metadata_xml.py b/src/pkgcheck/checks/metadata_xml.py
index f2b43af2..1f0a35d6 100644
--- a/src/pkgcheck/checks/metadata_xml.py
+++ b/src/pkgcheck/checks/metadata_xml.py
@@ -544,7 +544,7 @@ class PackageMetadataXmlCheck(_XmlBaseCheck):
if match_ratio > 0.75:
msg = "metadata.xml longdescription closely matches DESCRIPTION"
yield RedundantLongDescription(msg, pkg=pkg)
- elif len(pkg.longdescription) < 100:
+ elif len(pkg.longdescription) < 80:
msg = "metadata.xml longdescription is too short"
yield RedundantLongDescription(msg, pkg=pkg)
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-09-01 16:42 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-09-01 16:42 UTC (permalink / raw
To: gentoo-commits
commit: a159aca5222ca9ef08087ee7aa16325fe136080a
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 1 15:49:58 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Sep 1 15:49:58 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=a159aca5
checks: use stable sorting of fields + strip where needed
In preparation of new tree-sitter-bash, some small issues where found.
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/metadata.py | 2 +-
src/pkgcheck/checks/profiles.py | 4 ++--
src/pkgcheck/checks/rust.py | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/pkgcheck/checks/metadata.py b/src/pkgcheck/checks/metadata.py
index 555ea9a5..3219036f 100644
--- a/src/pkgcheck/checks/metadata.py
+++ b/src/pkgcheck/checks/metadata.py
@@ -681,7 +681,7 @@ class UseFlagsWithoutEffectsCheck(GentooRepoCheck):
flags = self.warn_use_small_files.intersection(pkg.iuse_stripped).difference(used_flags)
if flags:
- yield UseFlagWithoutDeps(flags, pkg=pkg)
+ yield UseFlagWithoutDeps(sorted(flags), pkg=pkg)
class MissingSlotDep(results.VersionResult, results.Warning):
diff --git a/src/pkgcheck/checks/profiles.py b/src/pkgcheck/checks/profiles.py
index b9108f83..8a8248c7 100644
--- a/src/pkgcheck/checks/profiles.py
+++ b/src/pkgcheck/checks/profiles.py
@@ -303,9 +303,9 @@ class ProfilesCheck(Check):
for _, disabled, enabled in entries:
if unknown_disabled := set(disabled) - self.available_iuse:
flags = ("-" + u for u in unknown_disabled)
- yield UnknownProfileUse(pjoin(node.name, filename), flags)
+ yield UnknownProfileUse(pjoin(node.name, filename), sorted(flags))
if unknown_enabled := set(enabled) - self.available_iuse:
- yield UnknownProfileUse(pjoin(node.name, filename), unknown_enabled)
+ yield UnknownProfileUse(pjoin(node.name, filename), sorted(unknown_enabled))
@verify_files(
("packages", "packages"),
diff --git a/src/pkgcheck/checks/rust.py b/src/pkgcheck/checks/rust.py
index 1a5e6770..397738b9 100644
--- a/src/pkgcheck/checks/rust.py
+++ b/src/pkgcheck/checks/rust.py
@@ -64,7 +64,7 @@ class RustCheck(Check):
call_name = pkg.node_str(node.child_by_field_name("name"))
if call_name == "cargo_crate_uris":
row, _ = node.start_point
- line = pkg.node_str(node.parent)
+ line = pkg.node_str(node.parent).strip()
if node.child_count == 1 or (
node.child_count == 2
and any(
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-09-14 17:02 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-09-14 17:02 UTC (permalink / raw
To: gentoo-commits
commit: 3e54cb89ae4ce9b9728cb58a5bb6e630ead57823
Author: Thomas Bracht Laumann Jespersen <t <AT> laumann <DOT> xyz>
AuthorDate: Thu Sep 14 11:00:27 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu Sep 14 17:02:33 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=3e54cb89
checks.metadata_xml: add codeberg as supported remote-id
Signed-off-by: Thomas Bracht Laumann Jespersen <t <AT> laumann.xyz>
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/metadata_xml.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/pkgcheck/checks/metadata_xml.py b/src/pkgcheck/checks/metadata_xml.py
index 1f0a35d6..a3a7b643 100644
--- a/src/pkgcheck/checks/metadata_xml.py
+++ b/src/pkgcheck/checks/metadata_xml.py
@@ -471,6 +471,7 @@ class PackageMetadataXmlCheck(_XmlBaseCheck):
"launchpad": (re.compile(r"^(?!lp:)[^/]+$"), "{project}"),
# {owner}/{name}-style remotes
"bitbucket": (_two_components_validator_re, "{username}/{project}"),
+ "codeberg": (_two_components_validator_re, "{username}/{project}"),
"github": (_two_components_validator_re, "{username}/{project}"),
# gitlab (2+ components)
"gitlab": (_gitlab_validator_re, "{username}/[{group}/...]{repo}"),
@@ -648,6 +649,7 @@ class MissingRemoteIdCheck(Check):
remotes_map = (
("bitbucket", r"https://bitbucket.org/(?P<value>[^/]+/[^/]+)"),
+ ("codeberg", r"https://codeberg.org/(?P<value>[^/]+/[^/]+)"),
("freedesktop-gitlab", rf"https://gitlab.freedesktop.org/{_gitlab_match}"),
("github", r"https://github.com/(?P<value>[^/]+/[^/]+)"),
("gitlab", rf"https://gitlab.com/{_gitlab_match}"),
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-09-14 17:02 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-09-14 17:02 UTC (permalink / raw
To: gentoo-commits
commit: 9374477e0ae1164133d76e8144d1abffbf31bed6
Author: Thomas Bracht Laumann Jespersen <t <AT> laumann <DOT> xyz>
AuthorDate: Thu Sep 14 11:00:59 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu Sep 14 17:02:36 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=9374477e
checks.network: add codeberg remote-id
Signed-off-by: Thomas Bracht Laumann Jespersen <t <AT> laumann.xyz>
Closes: https://github.com/pkgcore/pkgcheck/pull/620
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/network.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/pkgcheck/checks/network.py b/src/pkgcheck/checks/network.py
index 4b970716..64e54280 100644
--- a/src/pkgcheck/checks/network.py
+++ b/src/pkgcheck/checks/network.py
@@ -281,6 +281,7 @@ class MetadataUrlCheck(_UrlCheck):
self.protocols = ("http://", "https://", "ftp://")
self.remote_map = {
"bitbucket": "https://bitbucket.org/{project}",
+ "codeberg": "https://codeberg.org/{project}",
"cpan": "https://metacpan.org/dist/{project}",
# some packages include a lot of modules, and scanning them
# DoS-es metacpan
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-11-01 19:20 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-11-01 19:20 UTC (permalink / raw
To: gentoo-commits
commit: 013b8d678895caf3f66173f6dfd2379c5219d576
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 1 19:19:43 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 1 19:19:43 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=013b8d67
MissingInherits: add some specials to exclude list
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/codingstyle.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/pkgcheck/checks/codingstyle.py b/src/pkgcheck/checks/codingstyle.py
index 0c33c650..60f1ce98 100644
--- a/src/pkgcheck/checks/codingstyle.py
+++ b/src/pkgcheck/checks/codingstyle.py
@@ -825,7 +825,7 @@ class InheritsCheck(Check):
self.exported.setdefault(name, set()).add(eclass)
# collect all @USER_VARIABLEs, which are excluded from MissingInherits
- self.user_variables = frozenset(
+ user_variables = frozenset(
{
x.name
for eclass_obj in self.eclass_cache.values()
@@ -833,6 +833,7 @@ class InheritsCheck(Check):
if x.user_variable
}
)
+ self.exclude_missing_inherit = user_variables | {"CTARGET", "BUILD_DIR"}
# register EAPI-related funcs/cmds to ignore
self.eapi_funcs = {}
@@ -911,7 +912,7 @@ class InheritsCheck(Check):
if node.parent.type == "unset_command":
continue
if name not in self.eapi_vars[pkg.eapi] | assigned_vars.keys():
- if name in self.user_variables:
+ if name in self.exclude_missing_inherit:
continue
lineno, _colno = node.start_point
if eclass := self.get_eclass(name, pkg):
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-11-05 13:22 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-11-05 13:22 UTC (permalink / raw
To: gentoo-commits
commit: 1b246cfa75d0789b7e77ccf645ea3778340b8eda
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 5 13:20:58 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Nov 5 13:20:58 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=1b246cfa
whitespace: fix double "on" in result text
Resolves: https://github.com/pkgcore/pkgcheck/issues/633
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/whitespace.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/pkgcheck/checks/whitespace.py b/src/pkgcheck/checks/whitespace.py
index a853e0b0..9987cf7e 100644
--- a/src/pkgcheck/checks/whitespace.py
+++ b/src/pkgcheck/checks/whitespace.py
@@ -20,7 +20,7 @@ class WhitespaceFound(_Whitespace):
@property
def desc(self):
- return f"ebuild has {self.leadtrail} whitespace on {self.lines_str}"
+ return f"ebuild has {self.leadtrail} whitespace {self.lines_str}"
class WrongIndentFound(_Whitespace):
@@ -28,7 +28,7 @@ class WrongIndentFound(_Whitespace):
@property
def desc(self):
- return f"ebuild has whitespace in indentation on {self.lines_str}"
+ return f"ebuild has whitespace in indentation {self.lines_str}"
class DoubleEmptyLine(_Whitespace):
@@ -36,7 +36,7 @@ class DoubleEmptyLine(_Whitespace):
@property
def desc(self):
- return f"ebuild has unneeded empty line on {self.lines_str}"
+ return f"ebuild has unneeded empty line {self.lines_str}"
class TrailingEmptyLine(results.VersionResult, results.Style):
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-12-08 17:52 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-12-08 17:52 UTC (permalink / raw
To: gentoo-commits
commit: 8edda4238ef614dfd848ff0e05167ccf1e8892f3
Author: Alfred Wingate <parona <AT> protonmail <DOT> com>
AuthorDate: Mon Nov 27 10:58:11 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 8 17:52:22 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=8edda423
checks.git: Set tarfile filter
* Not setting it triggers a DeprecationWarning in python3.12.
* Despite tarballs by git-archive being trusted, there isn't benefit in
trusting it as the tarballs don't use metadata that would require it.
Signed-off-by: Alfred Wingate <parona <AT> protonmail.com>
Closes: https://github.com/pkgcore/pkgcheck/pull/638
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/git.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py
index 525bf693..31f1dc69 100644
--- a/src/pkgcheck/checks/git.py
+++ b/src/pkgcheck/checks/git.py
@@ -283,6 +283,10 @@ class _RemovalRepo(UnconfiguredTree):
if old_files.poll():
error = old_files.stderr.read().decode().strip()
raise PkgcheckUserException(f"failed populating archive repo: {error}")
+ # https://docs.python.org/3.12/library/tarfile.html#tarfile-extraction-filter
+ if hasattr(tarfile, "data_filter"):
+ # https://docs.python.org/3.12/library/tarfile.html#tarfile.TarFile.extraction_filter
+ tarfile.TarFile.extraction_filter = staticmethod(tarfile.data_filter)
with tarfile.open(mode="r|", fileobj=old_files.stdout) as tar:
tar.extractall(path=self.location)
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-12-08 18:38 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-12-08 18:38 UTC (permalink / raw
To: gentoo-commits
commit: 26f4edff6c429ff7b0d6583683a1a1d1954817e1
Author: Alfred Wingate <parona <AT> protonmail <DOT> com>
AuthorDate: Mon Nov 27 10:04:35 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Dec 8 18:32:42 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=26f4edff
MissingRemoteId: expand gitlab matching rules
* Notably handles the particular case with gitlab package hosting.
Bug: https://github.com/pkgcore/pkgcheck/issues/636
Signed-off-by: Alfred Wingate <parona <AT> protonmail.com>
Closes: https://github.com/pkgcore/pkgcheck/pull/637
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/metadata_xml.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/pkgcheck/checks/metadata_xml.py b/src/pkgcheck/checks/metadata_xml.py
index a3a7b643..fb574c0e 100644
--- a/src/pkgcheck/checks/metadata_xml.py
+++ b/src/pkgcheck/checks/metadata_xml.py
@@ -645,7 +645,9 @@ class MissingRemoteIdCheck(Check):
_source = sources.PackageRepoSource
known_results = frozenset([MissingRemoteId])
- _gitlab_match = r"(?P<value>(\w[^/]*/)*\w[^/]*/\w[^/]*)"
+ # Exclude api groups and raw project names to conform with https://docs.gitlab.com/ee/user/reserved_names.html
+ # with the URI's which are most likely to end up in SRC_URI
+ _gitlab_match = r"(?P<value>((?!api/)\w[^/]*/)+(?!raw/)\w[^/]*)"
remotes_map = (
("bitbucket", r"https://bitbucket.org/(?P<value>[^/]+/[^/]+)"),
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2023-12-10 20:07 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2023-12-10 20:07 UTC (permalink / raw
To: gentoo-commits
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):
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2024-03-01 21:06 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2024-03-01 21:06 UTC (permalink / raw
To: gentoo-commits
commit: 7e0e513cf05b88f6e13ce93f49c80159507feca5
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 1 20:59:32 2024 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 1 20:59:32 2024 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=7e0e513c
PkgBadlyFormedXml: convert to error
Resolves: https://github.com/pkgcore/pkgcheck/issues/668
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/metadata_xml.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pkgcheck/checks/metadata_xml.py b/src/pkgcheck/checks/metadata_xml.py
index fb574c0e..cfba70c8 100644
--- a/src/pkgcheck/checks/metadata_xml.py
+++ b/src/pkgcheck/checks/metadata_xml.py
@@ -28,7 +28,7 @@ class _MissingXml(results.Error):
return f"{self._attr} is missing {self.filename}"
-class _BadlyFormedXml(results.Warning):
+class _BadlyFormedXml(results.Error):
"""XML isn't well formed."""
def __init__(self, filename, error, **kwargs):
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2024-05-08 16:32 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2024-05-08 16:32 UTC (permalink / raw
To: gentoo-commits
commit: 4a7a02f60c9f87ad85670e0e798c5aadb8096c92
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed May 8 16:30:48 2024 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed May 8 16:30:48 2024 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=4a7a02f6
NewerEAPIAvailable: handle better when no eclasses EAPI
It might sometimes not find any intersection of eclasses EAPIs, in which
it is better to not report anything then to report a false positive or
worse, to explode with exception.
Resolves: https://github.com/pkgcore/pkgcheck/issues/679
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/git.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py
index a2619491..b6777161 100644
--- a/src/pkgcheck/checks/git.py
+++ b/src/pkgcheck/checks/git.py
@@ -388,7 +388,7 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
for eclass in new_pkg.inherit
)
current_eapi = int(str(new_pkg.eapi))
- common_max_eapi = max(frozenset.intersection(*eclass_eapis))
+ common_max_eapi = max(frozenset.intersection(*eclass_eapis), 0)
if common_max_eapi > current_eapi:
yield NewerEAPIAvailable(common_max_eapi, pkg=new_pkg)
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2024-05-09 19:39 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2024-05-09 19:39 UTC (permalink / raw
To: gentoo-commits
commit: 4f08057161483e92cd64febac44ffbc1dd3bc718
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Thu May 9 19:38:42 2024 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu May 9 19:38:42 2024 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=4f080571
NewerEAPIAvailable: fix code
Fixes: 4a7a02f60c9f87ad85670e0e798c5aadb8096c92
Resolves: https://github.com/pkgcore/pkgcheck/issues/679
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/git.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py
index b6777161..d4ab12ff 100644
--- a/src/pkgcheck/checks/git.py
+++ b/src/pkgcheck/checks/git.py
@@ -388,7 +388,7 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
for eclass in new_pkg.inherit
)
current_eapi = int(str(new_pkg.eapi))
- common_max_eapi = max(frozenset.intersection(*eclass_eapis), 0)
+ common_max_eapi = max(frozenset.intersection(*eclass_eapis), default=0)
if common_max_eapi > current_eapi:
yield NewerEAPIAvailable(common_max_eapi, pkg=new_pkg)
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2024-07-04 20:06 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2024-07-04 20:06 UTC (permalink / raw
To: gentoo-commits
commit: ccb467c9a661ac735e9c8fc72263647c6f8a0c7e
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 4 20:00:17 2024 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu Jul 4 20:00:17 2024 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=ccb467c9
DistutilsNonPEP517Build: handle false positive with eclass defined
Now that most ebuilds use PEP-517 mode, we can relax the check a little
to handle cases where the variable is set in the eclass (for example
tree-sitter based ebuilds).
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/python.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py
index ae448360..229bb3e9 100644
--- a/src/pkgcheck/checks/python.py
+++ b/src/pkgcheck/checks/python.py
@@ -376,7 +376,8 @@ class PythonCheck(Check):
bdepends = frozenset(map(attrgetter("key"), iflatten_instance(pkg.bdepend, atom)))
if pep517_value is None:
- yield DistutilsNonPEP517Build(pkg=pkg)
+ if "dev-python/gpep517" not in bdepends:
+ yield DistutilsNonPEP517Build(pkg=pkg)
elif has_distutils_optional and not has_distutils_deps and pep517_value != "no":
# We always need BDEPEND for these if != no.
# We are looking for USE-conditional on appropriate target
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/
@ 2024-07-06 16:28 Arthur Zamarin
0 siblings, 0 replies; 42+ messages in thread
From: Arthur Zamarin @ 2024-07-06 16:28 UTC (permalink / raw
To: gentoo-commits
commit: 722236d305e4fc745e9ba28e377d167e2914f3f7
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 6 16:23:36 2024 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 6 16:25:17 2024 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=722236d3
PythonCompatCheck: add whitelist for backports
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/python.py | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py
index 229bb3e9..13ec6311 100644
--- a/src/pkgcheck/checks/python.py
+++ b/src/pkgcheck/checks/python.py
@@ -579,6 +579,18 @@ class PythonCompatCheck(Check):
known_results = frozenset([PythonCompatUpdate])
+ whitelist_backports = frozenset(
+ {
+ "dev-python/backports-tarfile",
+ "dev-python/exceptiongroup",
+ "dev-python/importlib-metadata",
+ "dev-python/taskgroup",
+ "dev-python/typing-extensions",
+ "dev-python/unittest-or-fail",
+ "dev-python/zipp",
+ }
+ )
+
def __init__(self, *args):
super().__init__(*args)
repo = self.options.target_repo
@@ -621,7 +633,7 @@ class PythonCompatCheck(Check):
p
for attr in (x.lower() for x in attrs)
for p in iflatten_instance(getattr(pkg, attr), atom)
- if not p.blocks
+ if not p.blocks and p.key not in self.whitelist_backports
}
def feed(self, pkg):
^ permalink raw reply related [flat|nested] 42+ messages in thread
end of thread, other threads:[~2024-07-06 16:28 UTC | newest]
Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-05 17:18 [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/ Arthur Zamarin
-- strict thread matches above, loose matches on Subject: below --
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-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-20 13:20 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox