aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2023-10-01 23:10:53 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2023-10-01 23:10:53 +0300
commitef0ee73cdcfe27dc27e208afe36060e0e52a3165 (patch)
tree118c9dfeb0c14d34d79fe29301959c2f0e24f0ea /src
parentDuplicateFunctionDefinition: new check for duplicate global functions (diff)
downloadpkgcheck-ef0ee73cdcfe27dc27e208afe36060e0e52a3165.tar.gz
pkgcheck-ef0ee73cdcfe27dc27e208afe36060e0e52a3165.tar.bz2
pkgcheck-ef0ee73cdcfe27dc27e208afe36060e0e52a3165.zip
BannedEapiCommand: check for has_version --host-root
Catch ``has_version --host-root`` and ``best_version --host-root`` calls, which are not allowed in EAPI>=7. Resolves: https://github.com/pkgcore/pkgcheck/issues/630 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/pkgcheck/checks/codingstyle.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pkgcheck/checks/codingstyle.py b/src/pkgcheck/checks/codingstyle.py
index d0b5d861..317841bc 100644
--- a/src/pkgcheck/checks/codingstyle.py
+++ b/src/pkgcheck/checks/codingstyle.py
@@ -91,6 +91,15 @@ class BadCommandsCheck(Check):
)
elif name in pkg.eapi.phases.values():
yield BannedPhaseCall(line=name, lineno=lineno + 1, pkg=pkg)
+ elif name in ("has_version", "best_version"):
+ if not pkg.eapi.options.query_host_root and any(
+ pkg.node_str(n) == "--host-root"
+ for n in node.children_by_field_name("argument")
+ ):
+ name = f"{name} --host-root"
+ yield BannedEapiCommand(
+ name, line=call, lineno=lineno + 1, eapi=pkg.eapi, pkg=pkg
+ )
class EendMissingArg(results.LineResult, results.Warning):