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 21.4.3



details:   https://anonhg.NetBSD.org/pkgsrc/rev/49eba7b02aec
branches:  trunk
changeset: 375265:49eba7b02aec
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Fri Mar 11 00:33:12 2022 +0000

description:
pkgtools/pkglint: update to 21.4.3

Changes since 21.4.2:

In simple Makefiles, do not allow the GitHub variables like
GITHUB_RELEASE to occur above DISTNAME anymore.  Previously, these
variables had 2 possible places in the "canonical" order.

diffstat:

 pkgtools/pkglint/Makefile              |   5 ++---
 pkgtools/pkglint/files/package.go      |   9 +++------
 pkgtools/pkglint/files/package_test.go |  21 +++++++++++++++------
 3 files changed, 20 insertions(+), 15 deletions(-)

diffs (119 lines):

diff -r 1ea7099ed284 -r 49eba7b02aec pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Thu Mar 10 23:50:46 2022 +0000
+++ b/pkgtools/pkglint/Makefile Fri Mar 11 00:33:12 2022 +0000
@@ -1,7 +1,6 @@
-# $NetBSD: Makefile,v 1.711 2022/03/07 09:14:10 bsiegert Exp $
+# $NetBSD: Makefile,v 1.712 2022/03/11 00:33:12 rillig Exp $
 
-PKGNAME=       pkglint-21.4.2
-PKGREVISION=   2
+PKGNAME=       pkglint-21.4.3
 CATEGORIES=    pkgtools
 DISTNAME=      tools
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=golang/}
diff -r 1ea7099ed284 -r 49eba7b02aec pkgtools/pkglint/files/package.go
--- a/pkgtools/pkglint/files/package.go Thu Mar 10 23:50:46 2022 +0000
+++ b/pkgtools/pkglint/files/package.go Fri Mar 11 00:33:12 2022 +0000
@@ -897,9 +897,6 @@
        // See doc/Makefile-example.
        // See https://netbsd.org/docs/pkgsrc/pkgsrc.html#components.Makefile.
        var variables = []Variable{
-               {"GITHUB_PROJECT", optional}, // either here or below MASTER_SITES
-               {"GITHUB_TAG", optional},
-               {"GITHUB_RELEASE", optional},
                {"DISTNAME", optional},
                {"PKGNAME", optional},
                {"R_PKGNAME", optional},
@@ -907,7 +904,7 @@
                {"PKGREVISION", optional},
                {"CATEGORIES", once},
                {"MASTER_SITES", many},
-               {"GITHUB_PROJECT", optional}, // either here or at the very top
+               {"GITHUB_PROJECT", optional},
                {"GITHUB_TAG", optional},
                {"GITHUB_RELEASE", optional},
                {"DIST_SUBDIR", optional},
@@ -915,9 +912,9 @@
                {"DISTFILES", many},
                {"SITES.*", many},
                emptyLine,
-               {"PATCH_SITES", optional}, // or once?
+               {"PATCH_SITES", optional},
                {"PATCH_SITE_SUBDIR", optional},
-               {"PATCHFILES", optional}, // or once?
+               {"PATCHFILES", optional},
                {"PATCH_DIST_ARGS", optional},
                {"PATCH_DIST_STRIP", optional},
                {"PATCH_DIST_CAT", optional},
diff -r 1ea7099ed284 -r 49eba7b02aec pkgtools/pkglint/files/package_test.go
--- a/pkgtools/pkglint/files/package_test.go    Thu Mar 10 23:50:46 2022 +0000
+++ b/pkgtools/pkglint/files/package_test.go    Fri Mar 11 00:33:12 2022 +0000
@@ -2014,9 +2014,12 @@
        pkg.CheckVarorder(mklines)
 
        // TODO: Make this warning more specific to the actual situation.
+
+       // Before 2022-03-11, the GitHub variables were allowed above DISTNAME,
+       // which allowed more variation than necessary and made the warning longer.
        t.CheckOutputLines(
                "WARN: Makefile:3: The canonical order of the variables is " +
-                       "GITHUB_PROJECT, DISTNAME, CATEGORIES, GITHUB_PROJECT, empty line, " +
+                       "DISTNAME, CATEGORIES, GITHUB_PROJECT, empty line, " +
                        "COMMENT, LICENSE.")
 }
 
@@ -2042,7 +2045,8 @@
 }
 
 // Ensure that comments and empty lines do not lead to panics.
-// This would be when accessing fields from the MkLine without checking the line type before.
+// This had been the case when the code accessed fields like Varname from the
+// MkLine without checking the line type before.
 func (s *Suite) Test_Package_CheckVarorder__comments_do_not_crash(c *check.C) {
        t := s.Init(c)
 
@@ -2062,7 +2066,7 @@
 
        t.CheckOutputLines(
                "WARN: Makefile:3: The canonical order of the variables is " +
-                       "GITHUB_PROJECT, DISTNAME, CATEGORIES, GITHUB_PROJECT, empty line, " +
+                       "DISTNAME, CATEGORIES, GITHUB_PROJECT, empty line, " +
                        "COMMENT, LICENSE.")
 }
 
@@ -2176,7 +2180,12 @@
 
        pkg.CheckVarorder(mklines)
 
-       t.CheckOutputEmpty()
+       // Before 2022-03-11, the GitHub variables were allowed above DISTNAME,
+       // which allowed more variation than necessary and made the warning longer.
+       t.CheckOutputLines(
+               "WARN: Makefile:3: The canonical order of the variables is " +
+                       "DISTNAME, CATEGORIES, MASTER_SITES, GITHUB_PROJECT, " +
+                       "GITHUB_TAG, empty line, COMMENT, LICENSE.")
 }
 
 func (s *Suite) Test_Package_CheckVarorder__GITHUB_PROJECT_at_the_bottom(c *check.C) {
@@ -2279,7 +2288,7 @@
 
        t.CheckOutputLines(
                "WARN: Makefile:3: The canonical order of the variables is " +
-                       "GITHUB_PROJECT, DISTNAME, PKGNAME, CATEGORIES, " +
+                       "DISTNAME, PKGNAME, CATEGORIES, " +
                        "MASTER_SITES, GITHUB_PROJECT, DIST_SUBDIR, empty line, " +
                        "MAINTAINER, HOMEPAGE, COMMENT, LICENSE.")
 
@@ -2287,11 +2296,11 @@
        mklines = t.NewMkLines("Makefile",
                MkCvsID,
                "",
-               "GITHUB_PROJECT= pkgbase",
                "DISTNAME=       v1.0",
                "PKGNAME=        ${GITHUB_PROJECT}-${DISTNAME}",
                "CATEGORIES=     net",
                "MASTER_SITES=   ${MASTER_SITE_GITHUB:=project/}",
+               "GITHUB_PROJECT= pkgbase",
                "DIST_SUBDIR=    ${GITHUB_PROJECT}",
                "",
                "MAINTAINER=     maintainer%example.org@localhost",



Home | Main Index | Thread Index | Old Index