proj/pkgcore/pkgdev:main commit in: tests/scripts/, /, src/pkgdev/scripts/
"Arthur Zamarin" <[email protected]>
| Newsgroups | gmane.linux.gentoo.cvs |
|---|---|
| Message-ID | <1786794131.bbac18ed4c84e60152ad0a6be611462f68aaf314.arthurzam@gentoo> |
commit: bbac18ed4c84e60152ad0a6be611462f68aaf314
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 15 11:42:11 2026 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Aug 15 11:42:11 2026 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgdev.git/commit/?id=bbac18ed
drop the nattka dependency
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
pyproject.toml | 3 +--
src/pkgdev/scripts/pkgdev_bugs.py | 30 +++++-------------------------
src/pkgdev/scripts/pkgdev_tatt.py | 16 +++-------------
tests/scripts/test_pkgdev_bugs.py | 6 ++++--
4 files changed, 13 insertions(+), 42 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index a204d71..56a72ba 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -29,7 +29,7 @@ dynamic = ["version"]
dependencies = [
"snakeoil~=0.11.1",
- "pkgcore~=0.12.38",
+ "pkgcore@git+https://github.com/pkgcore/pkgcore.git#master",
"pkgcheck~=0.10.42",
]
@@ -42,7 +42,6 @@ doc = [
"sphinx",
]
tatt = [
- "nattka",
"Jinja2",
]
diff --git a/src/pkgdev/scripts/pkgdev_bugs.py b/src/pkgdev/scripts/pkgdev_bugs.py
index e521f01..9d778f0 100644
--- a/src/pkgdev/scripts/pkgdev_bugs.py
+++ b/src/pkgdev/scripts/pkgdev_bugs.py
@@ -35,6 +35,7 @@ from pkgcore.bugzilla.changes import summarise
from pkgcore.ebuild.atom import atom
from pkgcore.ebuild.ebuild_src import package
from pkgcore.ebuild.errors import MalformedAtom
+from pkgcore.ebuild.keywording import suggested_keywords
from pkgcore.ebuild.misc import sort_keywords
from pkgcore.ebuild.repo_objs import LocalMetadataXml, ProjectsXml
from pkgcore.package.mutated import MutatedPkg
@@ -57,7 +58,7 @@ class StoreTargetArches(commandline.StoreTarget):
"""``StoreTarget`` variant accepting trailing arches after each atom.
A target may carry a whitespace separated list of arches after the atom,
- nattka-style, e.g. ``=cat/pkg-1.0 amd64 x86``. This produces 3-tuples
+ as a bug's package list does, e.g. ``=cat/pkg-1.0 amd64 x86``. This produces 3-tuples
``(token, restriction, arches)`` instead of the usual ``(token, restriction)``.
Note: this reimplements ``StoreTarget.__call__`` (it cannot inject the arch
@@ -278,27 +279,6 @@ def _validate_args(parser, namespace):
namespace.bugzilla = Bugzilla(namespace.api_key, user_agent=f"pkgdev-bugs/{__version__}")
-def _get_suggested_keywords(repo, pkg: package, streq: bool = True):
- # for stablereq only consider already stable keywords on other versions, for
- # keywordreq also consider ~arch keywords (those can be propagated as new keywords)
- disallow_prefix = "-~" if streq else "-"
- match_keywords = {
- x.lstrip("~")
- for pkgver in repo.match(pkg.unversioned_atom)
- for x in pkgver.keywords
- if x[0] not in disallow_prefix
- }
-
- if streq:
- # limit stablereq to whatever is ~arch right now
- match_keywords.intersection_update(x.lstrip("~") for x in pkg.keywords if x[0] == "~")
- else:
- # limit keywordreq to missing keywords (strip all keywords already present)
- match_keywords.difference_update(x.lstrip("~-") for x in pkg.keywords)
-
- return frozenset({x for x in match_keywords if "-" not in x})
-
-
def parse_atom(pkg: str):
try:
return atom(pkg)
@@ -369,7 +349,7 @@ class GraphNode:
previous = frozenset(keywords)
for pkg, keywords in self.pkgs:
- suggested = _get_suggested_keywords(repo, pkg, streq=not self.is_keywordreq)
+ suggested = suggested_keywords(repo, pkg, stable=not self.is_keywordreq)
if keywords == set(suggested):
keywords.clear()
keywords.add("*")
@@ -780,7 +760,7 @@ class DependencyGraph:
streq = category is STABLEREQ
verb = category.verb
if streq:
- keywords.update(_get_suggested_keywords(self.options.repo, pkg, streq=True))
+ keywords.update(suggested_keywords(self.options.repo, pkg, stable=True))
if not keywords:
# nothing left to stabilize (already stable or never keyworded)
self.out.write(f"Nothing to stable for {pkg.unversioned_atom}")
@@ -789,7 +769,7 @@ class DependencyGraph:
# explicit (command line) or dependency-driven arches are authoritative;
# only fall back to the other-versions heuristic when none were given
if not keywords:
- keywords.update(_get_suggested_keywords(self.options.repo, pkg, streq=False))
+ keywords.update(suggested_keywords(self.options.repo, pkg, stable=False))
if not keywords:
# keywordreq with no derivable arches: the user must specify them
bugs.error(
diff --git a/src/pkgdev/scripts/pkgdev_tatt.py b/src/pkgdev/scripts/pkgdev_tatt.py
index c9310d9..7c2d0cd 100644
--- a/src/pkgdev/scripts/pkgdev_tatt.py
+++ b/src/pkgdev/scripts/pkgdev_tatt.py
@@ -9,6 +9,7 @@ from itertools import islice
from pathlib import Path
from typing import NamedTuple
+from pkgcore.bugzilla import Bug, BugCategory, Bugzilla
from pkgcore.bugzilla.apikey import BugzillaApiKey
from pkgcore.restrictions import boolean, packages, values
from pkgcore.restrictions.required_use import find_constraint_satisfaction, iter_flags
@@ -266,22 +267,11 @@ def _validate_args(parser, namespace):
def _get_bugzilla_packages(namespace):
- from nattka.package import match_package_list
-
- try:
- from nattka.bugzilla import BugCategory, NattkaBugzilla
-
- nattka_bugzilla = NattkaBugzilla(api_key=namespace.api_key)
- bug = next(iter(nattka_bugzilla.find_bugs(bugs=[namespace.bug]).values()))
- except ImportError:
- from pkgcore.bugzilla import BugCategory, Bugzilla
-
- bug = Bugzilla(api_key=namespace.api_key).get(namespace.bug)
-
+ bug: Bug = Bugzilla(namespace.api_key).get(namespace.bug)
namespace.keywording = bug.category == BugCategory.KEYWORDREQ
repo = namespace.domain.repos["gentoo"].raw_repo
src_repo = namespace.domain.source_repos_raw
- for pkg, _ in match_package_list(repo, bug, only_new=True, filter_arch=[namespace.domain.arch]):
+ for pkg, _ in bug.match_packages(repo, only_new=True, filter_arch=[namespace.domain.arch]):
yield src_repo.match(pkg.versioned_atom)[0]
diff --git a/tests/scripts/test_pkgdev_bugs.py b/tests/scripts/test_pkgdev_bugs.py
index 3a1216a..ff6565f 100644
--- a/tests/scripts/test_pkgdev_bugs.py
+++ b/tests/scripts/test_pkgdev_bugs.py
@@ -121,19 +121,21 @@ class TestBugFiling:
class TestSuggestedKeywords:
+ """pkgcore owns the rule; these pin the semantics pkgdev relies on."""
+
def test_stablereq(self, repo):
repo.create_ebuild("cat/a-1", KEYWORDS=["amd64", "x86"])
repo.create_ebuild("cat/a-2", KEYWORDS=["amd64", "~x86"])
pkg = max(repo.itermatch(atom("=cat/a-2")))
# only ~arch keywords here that are stable on another version may be stabilized
- assert bugs._get_suggested_keywords(repo, pkg, streq=True) == frozenset({"x86"})
+ assert bugs.suggested_keywords(repo, pkg, stable=True) == frozenset({"x86"})
def test_keywordreq(self, repo):
repo.create_ebuild("cat/a-1", KEYWORDS=["~amd64", "~x86"])
repo.create_ebuild("cat/a-2", KEYWORDS=["~amd64"])
pkg = max(repo.itermatch(atom("=cat/a-2")))
# keywords present on other versions but missing here are suggested
- assert bugs._get_suggested_keywords(repo, pkg, streq=False) == frozenset({"x86"})
+ assert bugs.suggested_keywords(repo, pkg, stable=False) == frozenset({"x86"})
def mk_graph(repo, category=BugCategory.STABLEREQ):