summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2022-03-21 22:30:06 +0000
committerrillig <rillig@pkgsrc.org>2022-03-21 22:30:06 +0000
commit32e200e76134132c82ec4cc9078d6734b92e2e74 (patch)
treec9264c61342101a71229c1526fad601db50acd12 /pkgtools
parent1aee2a56d58b9ae6f6d8cbce0a2fcc2e4086ce05 (diff)
downloadpkgsrc-32e200e76134132c82ec4cc9078d6734b92e2e74.tar.gz
pkgtools/pkglint: update to 22.1.0
Changes since 21.4.4: Python packages that declare 2.7 as an incompatible Python version no longer need to provide a rationale for this since it is common knowledge that Python 2.7 is old and therefore unsupported by many modern packages.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/Makefile4
-rw-r--r--pkgtools/pkglint/files/mkassignchecker.go11
-rw-r--r--pkgtools/pkglint/files/mkassignchecker_test.go14
3 files changed, 24 insertions, 5 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile
index 96fd82c49e2..3050e702e4c 100644
--- a/pkgtools/pkglint/Makefile
+++ b/pkgtools/pkglint/Makefile
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.713 2022/03/12 12:03:40 rillig Exp $
+# $NetBSD: Makefile,v 1.714 2022/03/21 22:30:06 rillig Exp $
-PKGNAME= pkglint-21.4.4
+PKGNAME= pkglint-22.1.0
CATEGORIES= pkgtools
DISTNAME= tools
MASTER_SITES= ${MASTER_SITE_GITHUB:=golang/}
diff --git a/pkgtools/pkglint/files/mkassignchecker.go b/pkgtools/pkglint/files/mkassignchecker.go
index 71ab1e155b7..ea6d07c2900 100644
--- a/pkgtools/pkglint/files/mkassignchecker.go
+++ b/pkgtools/pkglint/files/mkassignchecker.go
@@ -345,7 +345,8 @@ func (ck *MkAssignChecker) checkLeftRationale() {
}
mkline := ck.MkLine
- vartype := G.Pkgsrc.VariableType(ck.MkLines, mkline.Varname())
+ varname := mkline.Varname()
+ vartype := G.Pkgsrc.VariableType(ck.MkLines, varname)
if vartype == nil || !vartype.NeedsRationale() {
return
}
@@ -354,7 +355,13 @@ func (ck *MkAssignChecker) checkLeftRationale() {
return
}
- mkline.Warnf("Setting variable %s should have a rationale.", mkline.Varname())
+ if varname == "PYTHON_VERSIONS_INCOMPATIBLE" && mkline.Value() == "27" {
+ // No warning since it is rather common that a modern Python
+ // package supports all Python versions starting with 3.0.
+ return
+ }
+
+ mkline.Warnf("Setting variable %s should have a rationale.", varname)
mkline.Explain(
"Since this variable prevents the package from being built in some situations,",
"the reasons for this restriction should be documented.",
diff --git a/pkgtools/pkglint/files/mkassignchecker_test.go b/pkgtools/pkglint/files/mkassignchecker_test.go
index 825d5aa761c..6c937b81f0c 100644
--- a/pkgtools/pkglint/files/mkassignchecker_test.go
+++ b/pkgtools/pkglint/files/mkassignchecker_test.go
@@ -645,7 +645,19 @@ func (s *Suite) Test_MkAssignChecker_checkLeftRationale(c *check.C) {
"WARN: filename.mk:1: Setting variable NOT_FOR_PLATFORM should have a rationale.",
"WARN: filename.mk:2: Setting variable NOT_FOR_PLATFORM should have a rationale.")
- // The whole rationale check is only enabled when -Wextra is given.
+ // Many Python modules support Python 3 only.
+ // These don't need a rationale since this case is common knowledge.
+ testLines(
+ lines(
+ MkCvsID,
+ "",
+ "PYTHON_VERSIONS_INCOMPATIBLE=\t27",
+ "",
+ "PYTHON_VERSIONS_INCOMPATIBLE=\t38"),
+ "WARN: filename.mk:5: Setting variable "+
+ "PYTHON_VERSIONS_INCOMPATIBLE should have a rationale.")
+
+ // The rationale check is only enabled when -Wextra is given.
t.SetUpCommandLine()
test(