diff options
-rw-r--r-- | pkgtools/pkglint/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pkglint/files/mkassignchecker.go | 11 | ||||
-rw-r--r-- | pkgtools/pkglint/files/mkassignchecker_test.go | 14 |
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( |