dev-util/pkgcheck: Sync with Gentoo

It's from Gentoo commit 85847936c7cd4799f1b2407300fa481d072718e1.

Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
Flatcar Buildbot 2026-02-02 07:26:44 +00:00
parent 72d02e487a
commit 18f6cc390d
7 changed files with 65 additions and 184 deletions

View File

@ -1,3 +1,2 @@
DIST pkgcheck-0.10.34.tar.gz 382566 BLAKE2B d91302f673326bf4756e06c2bad1ad89b10f14a08ac54a24a6a00d7a95d4313e5e1755393aefa55e1057a396483b023cc38e67902238e2620a76961feb8b2a81 SHA512 57ec0ccea00cde4187219f85d23f755878e2298f6219cb9b18eb35f927a685aac2d9b9c73045f6750f90959abb6313a1ed99dedaae4f0ec6b59f08585253a410
DIST pkgcheck-0.10.36.tar.gz 383659 BLAKE2B 1129695650790409d338f0a885d305dd4713c7f5222ae812ea6381c004b4c28321929df963240cd2a27c5dd0db7dd96f1a2829fff72dc627cdbd1399c600bb4e SHA512 c6c87ccd2d63e558efd7613142b2ac6dcfe4b4ea55b0e78d4502760d508015158189debebe26579e0cb26447fc4529ccb779fa4462d78af75e1c216f8a85177b
DIST pkgcheck-0.10.37.tar.gz 388402 BLAKE2B 8e93290da49ed9d8231550a7602300c93d16f2dc4be040f88690bf4cf996b51f8aac3cb26b2478345b10dfb1faddc185d6316810d5bac091fc5cae504ced459d SHA512 84c1717fad6a7f41dcc069dbdb68e73062606d7e0497286cba7255e415e8b317cb4aa396d9bc46f873712a65fa0e3cd95216df368ca73381f81c160308329f15
DIST pkgcheck-0.10.39.tar.gz 402359 BLAKE2B d0bbf0e97e45a9beca56b59b810fe2fc3cc9778ea894a72e4a402f4bbaff68e0811525e1c1d8ed795c30bba2d0a53d879fecd777736e7fbe5c333801f0bf40f9 SHA512 11f0ec9ecdfd80a98312975175e4605b4986ea3aa7131496c4d7195f3373c2329fc03f463d9722f39e508bdd30674abcb5edc3fa8c6542414eb0e9322fbf14c0

View File

@ -1,66 +0,0 @@
Subject: [PATCH] bash: update support to tree-sitter~=0.25
Also add backward compatible code for tree-sitter < 0.25.
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,7 +6,7 @@ requires = [
"lazy-object-proxy",
"lxml",
"pathspec",
- "tree-sitter~=0.24.0",
+ "tree-sitter~=0.25.0",
"tree-sitter-bash~=0.23.1",
"snakeoil~=0.10.11",
"pkgcore~=0.12.30",
@@ -45,7 +45,7 @@ dependencies = [
"lazy-object-proxy",
"lxml",
"pathspec",
- "tree-sitter~=0.24.0",
+ "tree-sitter~=0.25.0",
"tree-sitter-bash~=0.23.1",
"snakeoil~=0.10.11",
"pkgcore~=0.12.30",
--- a/src/pkgcheck/bash/__init__.py
+++ b/src/pkgcheck/bash/__init__.py
@@ -6,7 +6,17 @@ import tree_sitter_bash
from tree_sitter import Language, Parser, Query
lang = Language(tree_sitter_bash.language())
-query = lang.query
+
+try:
+ from tree_sitter import QueryCursor
+
+ def query(query_str: str) -> "QueryCursor":
+ return QueryCursor(Query(lang, query_str))
+except ImportError: # tree-sitter < 0.25
+ QueryCursor = Query
+ query = lang.query
+
+
parser = Parser(language=lang)
# various parse tree queries
@@ -29,14 +39,14 @@ class ParseTree:
"""Return the ebuild string associated with a given parse tree node."""
return self.data[node.start_byte : node.end_byte].decode("utf8")
- def global_query(self, query: Query):
+ def global_query(self, query: QueryCursor):
"""Run a given parse tree query returning only those nodes in global scope."""
for x in self.tree.root_node.children:
# skip nodes in function scope
if x.type != "function_definition":
yield from chain.from_iterable(query.captures(x).values())
- def func_query(self, query: Query):
+ def func_query(self, query: QueryCursor):
"""Run a given parse tree query returning only those nodes in function scope."""
for x in self.tree.root_node.children:
# only return nodes in function scope
--
2.50.1

View File

@ -0,0 +1,44 @@
From efa950dc665e998e7fb31c41678579d52ee2e657 Mon Sep 17 00:00:00 2001
From: James Le Cuirot <chewi@gentoo.org>
Date: Mon, 22 Dec 2025 18:16:30 +0000
Subject: [PATCH] InheritsCheck: Whitelist branding.eclass from UnusedInherits
It can be used purely for variables recognised by external build tools
rather than the ebuild itself.
Resolves: https://github.com/pkgcore/pkgcheck/issues/765
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Closes: https://github.com/pkgcore/pkgcheck/pull/766
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
---
src/pkgcheck/checks/codingstyle.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/pkgcheck/checks/codingstyle.py b/src/pkgcheck/checks/codingstyle.py
index b2126429b..6cd07148d 100644
--- a/src/pkgcheck/checks/codingstyle.py
+++ b/src/pkgcheck/checks/codingstyle.py
@@ -817,6 +817,10 @@ class InheritsCheck(Check):
)
required_addons = (addons.eclass.EclassAddon,)
+ # branding.eclass can be used purely for variables recognised by external
+ # build tools rather than the ebuild itself.
+ unused_whitelist = frozenset({"branding"})
+
def __init__(self, *args, eclass_addon):
super().__init__(*args)
self.eclass_cache = eclass_addon.eclasses
@@ -961,7 +965,11 @@ def feed(self, pkg):
)
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:
+ elif (
+ not self.eclass_cache[eclass].exported_function_names
+ and exported_eclass_keys
+ or eclass in self.unused_whitelist
+ ):
# ignore eclasses that export ebuild metadata (e.g.
# SRC_URI, S, ...) and no functions
unused.discard(eclass)

View File

@ -1,93 +0,0 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=standalone
PYTHON_COMPAT=( python3_{11..13} )
inherit elisp-common distutils-r1 optfeature
if [[ ${PV} == *9999 ]] ; then
EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/pkgcore/pkgcheck.git
https://github.com/pkgcore/pkgcheck.git"
inherit git-r3
else
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~x64-macos"
inherit pypi
fi
DESCRIPTION="pkgcore-based QA utility for ebuild repos"
HOMEPAGE="https://github.com/pkgcore/pkgcheck"
LICENSE="BSD MIT"
SLOT="0"
IUSE="emacs"
if [[ ${PV} == *9999 ]]; then
RDEPEND="
~dev-python/snakeoil-9999[${PYTHON_USEDEP}]
~sys-apps/pkgcore-9999[${PYTHON_USEDEP}]"
else
RDEPEND="
>=dev-python/snakeoil-0.10.10[${PYTHON_USEDEP}]
>=sys-apps/pkgcore-0.12.25[${PYTHON_USEDEP}]"
fi
RDEPEND+="
>=dev-libs/tree-sitter-bash-0.21.0[python,${PYTHON_USEDEP}]
dev-python/chardet[${PYTHON_USEDEP}]
dev-python/lazy-object-proxy[${PYTHON_USEDEP}]
dev-python/lxml[${PYTHON_USEDEP}]
dev-python/pathspec[${PYTHON_USEDEP}]
>=dev-python/tree-sitter-0.23.0[${PYTHON_USEDEP}]
<dev-python/tree-sitter-0.25.0[${PYTHON_USEDEP}]
emacs? (
>=app-editors/emacs-24.1:*
app-emacs/ebuild-mode
app-emacs/flycheck
)
"
BDEPEND="${RDEPEND}
>=dev-python/flit-core-3.8[${PYTHON_USEDEP}]
test? (
dev-python/requests[${PYTHON_USEDEP}]
dev-vcs/git
)
"
SITEFILE="50${PN}-gentoo.el"
distutils_enable_tests pytest
export USE_SYSTEM_TREE_SITTER_BASH=1
src_compile() {
distutils-r1_src_compile
if use emacs ; then
pushd "${S}"/contrib/emacs >/dev/null || die
elisp-compile *.el
popd >/dev/null || die
fi
}
python_install_all() {
local DOCS=( NEWS.rst )
[[ ${PV} == *9999 ]] || doman build/sphinx/man/*
distutils-r1_python_install_all
if use emacs ; then
elisp-install ${PN} "${S}"/contrib/emacs/*.el{,c}
elisp-site-file-install "${FILESDIR}/${SITEFILE}"
fi
}
pkg_postinst() {
use emacs && elisp-site-regen
optfeature "Network check support" dev-python/requests
optfeature "Perl module version check support" dev-perl/Gentoo-PerlMod-Version
}
pkg_postrm() {
use emacs && elisp-site-regen
}

View File

@ -1,4 +1,4 @@
# Copyright 1999-2025 Gentoo Authors
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@ -30,7 +30,8 @@ if [[ ${PV} == *9999 ]]; then
else
RDEPEND="
>=dev-python/snakeoil-0.10.11[${PYTHON_USEDEP}]
>=sys-apps/pkgcore-0.12.30[${PYTHON_USEDEP}]"
<dev-python/snakeoil-0.11.0[${PYTHON_USEDEP}]
~sys-apps/pkgcore-0.12.30[${PYTHON_USEDEP}]"
fi
RDEPEND+="
app-arch/zstd
@ -49,12 +50,18 @@ RDEPEND+="
BDEPEND="${RDEPEND}
>=dev-python/flit-core-3.8[${PYTHON_USEDEP}]
test? (
<app-shells/bash-5.3
dev-python/pytest[${PYTHON_USEDEP}]
dev-python/requests[${PYTHON_USEDEP}]
dev-vcs/git
)
"
PATCHES=(
# https://github.com/pkgcore/pkgcheck/issues/765
"${FILESDIR}"/${P}-branding.patch
)
SITEFILE="50${PN}-gentoo.el"
EPYTEST_PLUGINS=( pkgcore )

View File

@ -1,4 +1,4 @@
# Copyright 1999-2025 Gentoo Authors
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@ -12,7 +12,7 @@ if [[ ${PV} == *9999 ]] ; then
https://github.com/pkgcore/pkgcheck.git"
inherit git-r3
else
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~x64-macos"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos"
inherit pypi
fi
@ -29,17 +29,16 @@ if [[ ${PV} == *9999 ]]; then
~sys-apps/pkgcore-9999[${PYTHON_USEDEP}]"
else
RDEPEND="
>=dev-python/snakeoil-0.10.11[${PYTHON_USEDEP}]
>=sys-apps/pkgcore-0.12.30[${PYTHON_USEDEP}]"
>=dev-python/snakeoil-0.11.0[${PYTHON_USEDEP}]
>=sys-apps/pkgcore-0.12.31[${PYTHON_USEDEP}]"
fi
RDEPEND+="
app-arch/zstd
>=dev-libs/tree-sitter-bash-0.21.0[python,${PYTHON_USEDEP}]
>=dev-libs/tree-sitter-bash-0.25.1[python,${PYTHON_USEDEP}]
dev-python/chardet[${PYTHON_USEDEP}]
dev-python/lazy-object-proxy[${PYTHON_USEDEP}]
dev-python/lxml[${PYTHON_USEDEP}]
dev-python/pathspec[${PYTHON_USEDEP}]
>=dev-python/tree-sitter-0.23.0[${PYTHON_USEDEP}]
>=dev-python/tree-sitter-0.25.2[${PYTHON_USEDEP}]
emacs? (
>=app-editors/emacs-24.1:*
app-emacs/ebuild-mode
@ -55,17 +54,11 @@ BDEPEND="${RDEPEND}
)
"
PATCHES=(
"${FILESDIR}"/${P}-ts0.25.patch
)
SITEFILE="50${PN}-gentoo.el"
EPYTEST_PLUGINS=( pkgcore )
distutils_enable_tests pytest
export USE_SYSTEM_TREE_SITTER_BASH=1
src_prepare() {
distutils-r1_src_prepare

View File

@ -1,4 +1,4 @@
# Copyright 1999-2025 Gentoo Authors
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@ -29,17 +29,16 @@ if [[ ${PV} == *9999 ]]; then
~sys-apps/pkgcore-9999[${PYTHON_USEDEP}]"
else
RDEPEND="
>=dev-python/snakeoil-0.10.11[${PYTHON_USEDEP}]
>=sys-apps/pkgcore-0.12.30[${PYTHON_USEDEP}]"
>=dev-python/snakeoil-0.11.0[${PYTHON_USEDEP}]
>=sys-apps/pkgcore-0.12.31[${PYTHON_USEDEP}]"
fi
RDEPEND+="
app-arch/zstd
>=dev-libs/tree-sitter-bash-0.21.0[python,${PYTHON_USEDEP}]
>=dev-libs/tree-sitter-bash-0.25.1[python,${PYTHON_USEDEP}]
dev-python/chardet[${PYTHON_USEDEP}]
dev-python/lazy-object-proxy[${PYTHON_USEDEP}]
dev-python/lxml[${PYTHON_USEDEP}]
dev-python/pathspec[${PYTHON_USEDEP}]
>=dev-python/tree-sitter-0.25.0[${PYTHON_USEDEP}]
>=dev-python/tree-sitter-0.25.2[${PYTHON_USEDEP}]
emacs? (
>=app-editors/emacs-24.1:*
app-emacs/ebuild-mode
@ -60,8 +59,6 @@ SITEFILE="50${PN}-gentoo.el"
EPYTEST_PLUGINS=( pkgcore )
distutils_enable_tests pytest
export USE_SYSTEM_TREE_SITTER_BASH=1
src_prepare() {
distutils-r1_src_prepare