pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint pkgtools/pkglint: update to 22.1.0



details:   https://anonhg.NetBSD.org/pkgsrc/rev/9a40a8140062
branches:  trunk
changeset: 375718:9a40a8140062
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon Mar 21 22:30:06 2022 +0000

description:
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:

 pkgtools/pkglint/Makefile                      |   4 ++--
 pkgtools/pkglint/files/mkassignchecker.go      |  11 +++++++++--
 pkgtools/pkglint/files/mkassignchecker_test.go |  14 +++++++++++++-
 3 files changed, 24 insertions(+), 5 deletions(-)

diffs (64 lines):

diff -r 16261e361b72 -r 9a40a8140062 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Mon Mar 21 22:09:13 2022 +0000
+++ b/pkgtools/pkglint/Makefile Mon Mar 21 22:30:06 2022 +0000
@@ -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 -r 16261e361b72 -r 9a40a8140062 pkgtools/pkglint/files/mkassignchecker.go
--- a/pkgtools/pkglint/files/mkassignchecker.go Mon Mar 21 22:09:13 2022 +0000
+++ b/pkgtools/pkglint/files/mkassignchecker.go Mon Mar 21 22:30:06 2022 +0000
@@ -345,7 +345,8 @@
        }
 
        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 @@
                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 -r 16261e361b72 -r 9a40a8140062 pkgtools/pkglint/files/mkassignchecker_test.go
--- a/pkgtools/pkglint/files/mkassignchecker_test.go    Mon Mar 21 22:09:13 2022 +0000
+++ b/pkgtools/pkglint/files/mkassignchecker_test.go    Mon Mar 21 22:30:06 2022 +0000
@@ -645,7 +645,19 @@
                "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(



Home | Main Index | Thread Index | Old Index