Source-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 20.1.6



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4c13a9fd5e8d
branches:  trunk
changeset: 431883:4c13a9fd5e8d
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun May 17 07:07:18 2020 +0000

description:
pkgtools/pkglint: update to 20.1.6

Changes since 20.1.5:

Category Makefiles must only list subdirectories in SUBDIR that actually
contain a package.  There is no need to mention the other directories.
This is the same as in the top-level Makefile, where mk/ and regress/ are
not listed.

Packages from pkgsrc-wip may have a COMMIT_MSG file with a suggested
commit message for importing the package into main pkgsrc.

diffstat:

 pkgtools/pkglint/Makefile               |   4 +-
 pkgtools/pkglint/files/category.go      |  12 ++++-
 pkgtools/pkglint/files/category_test.go |  63 ++++++++++++++++++++++-----------
 pkgtools/pkglint/files/pkglint.go       |   3 +
 pkgtools/pkglint/files/pkglint_test.go  |  27 ++++++++++++++
 5 files changed, 83 insertions(+), 26 deletions(-)

diffs (226 lines):

diff -r d428dbe3f65f -r 4c13a9fd5e8d pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Sun May 17 07:00:46 2020 +0000
+++ b/pkgtools/pkglint/Makefile Sun May 17 07:07:18 2020 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.644 2020/05/09 19:26:11 rillig Exp $
+# $NetBSD: Makefile,v 1.645 2020/05/17 07:07:18 rillig Exp $
 
-PKGNAME=       pkglint-20.1.5
+PKGNAME=       pkglint-20.1.6
 CATEGORIES=    pkgtools
 DISTNAME=      tools
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=golang/}
diff -r d428dbe3f65f -r 4c13a9fd5e8d pkgtools/pkglint/files/category.go
--- a/pkgtools/pkglint/files/category.go        Sun May 17 07:00:46 2020 +0000
+++ b/pkgtools/pkglint/files/category.go        Sun May 17 07:07:18 2020 +0000
@@ -43,9 +43,15 @@
        // the (hopefully) sorted list of SUBDIRs. The first step is to
        // collect the SUBDIRs in the Makefile and in the file system.
 
-       fSubdirs := getSubdirs(dir)
+       var fSubdirs []RelPath
        var mSubdirs []subdir
 
+       for _, subdir := range getSubdirs(dir) {
+               if dir.JoinNoClean(subdir).JoinNoClean("Makefile").IsFile() {
+                       fSubdirs = append(fSubdirs, subdir)
+               }
+       }
+
        seen := make(map[RelPath]*MkLine)
        for !mlex.EOF() {
                mkline := mlex.CurrentMkLine()
@@ -114,7 +120,7 @@
                                }
 
                                fix := line.Autofix()
-                               fix.Errorf("%q exists in the file system but not in the Makefile.", fCurrent)
+                               fix.Errorf("Package %q must be listed here.", fCurrent)
                                fix.InsertAbove("SUBDIR+=\t" + fCurrent.String())
                                fix.Apply()
                        }
@@ -123,7 +129,7 @@
                } else if len(fRest) == 0 || mRest[0].name < fRest[0] {
                        if !fCheck[mRest[0].name] {
                                fix := mRest[0].line.Autofix()
-                               fix.Errorf("%q exists in the Makefile but not in the file system.", mRest[0].name)
+                               fix.Errorf("%q does not contain a package.", mRest[0].name)
                                fix.Delete()
                                fix.Apply()
                        }
diff -r d428dbe3f65f -r 4c13a9fd5e8d pkgtools/pkglint/files/category_test.go
--- a/pkgtools/pkglint/files/category_test.go   Sun May 17 07:00:46 2020 +0000
+++ b/pkgtools/pkglint/files/category_test.go   Sun May 17 07:07:18 2020 +0000
@@ -29,8 +29,8 @@
                "NOTE: ~/archivers/Makefile:2: Empty line expected above this line.",
                "WARN: ~/archivers/Makefile:3: \"aaaaa\" should come before \"pkg1\".",
                "ERROR: ~/archivers/Makefile:4: SUBDIR+= line or empty line expected.",
-               "ERROR: ~/archivers/Makefile:2: \"pkg1\" exists in the Makefile but not in the file system.",
-               "ERROR: ~/archivers/Makefile:3: \"aaaaa\" exists in the Makefile but not in the file system.",
+               "ERROR: ~/archivers/Makefile:2: \"pkg1\" does not contain a package.",
+               "ERROR: ~/archivers/Makefile:3: \"aaaaa\" does not contain a package.",
                "NOTE: ~/archivers/Makefile:4: Empty line expected above this line.",
                "WARN: ~/archivers/Makefile:4: This line should contain the following text: .include \"../mk/misc/category.mk\"",
                "ERROR: ~/archivers/Makefile:4: The file must end here.")
@@ -125,9 +125,9 @@
                "WARN: ~/category/Makefile:7: \"duplicate\" should come before \"in-wrong-order\".",
                "WARN: ~/category/Makefile:10: \"commented-mk-and-fs\" should come before \"mk-only\".",
                "WARN: ~/category/Makefile:12: \"commented-without-reason\" commented out without giving a reason.",
-               "ERROR: ~/category/Makefile:6: \"fs-only\" exists in the file system but not in the Makefile.",
-               "ERROR: ~/category/Makefile:9: \"mk-only\" exists in the Makefile but not in the file system.",
-               "ERROR: ~/category/Makefile:11: \"commented-mk-only\" exists in the Makefile but not in the file system.")
+               "ERROR: ~/category/Makefile:6: Package \"fs-only\" must be listed here.",
+               "ERROR: ~/category/Makefile:9: \"mk-only\" does not contain a package.",
+               "ERROR: ~/category/Makefile:11: \"commented-mk-only\" does not contain a package.")
 }
 
 func (s *Suite) Test_CheckdirCategory__only_in_Makefile(c *check.C) {
@@ -151,10 +151,10 @@
        CheckdirCategory(t.File("category"))
 
        t.CheckOutputLines(
-               "ERROR: ~/category/Makefile:5: \"above-only-in-makefile\" exists in the Makefile "+
-                       "but not in the file system.",
-               "ERROR: ~/category/Makefile:7: \"only-in-makefile\" exists in the Makefile "+
-                       "but not in the file system.")
+               "ERROR: ~/category/Makefile:5: "+
+                       "\"above-only-in-makefile\" does not contain a package.",
+               "ERROR: ~/category/Makefile:7: "+
+                       "\"only-in-makefile\" does not contain a package.")
 }
 
 func (s *Suite) Test_CheckdirCategory__only_in_file_system(c *check.C) {
@@ -178,10 +178,8 @@
        CheckdirCategory(t.File("category"))
 
        t.CheckOutputLines(
-               "ERROR: ~/category/Makefile:5: \"above-only-in-fs\" exists in the file system "+
-                       "but not in the Makefile.",
-               "ERROR: ~/category/Makefile:6: \"only-in-fs\" exists in the file system "+
-                       "but not in the Makefile.")
+               "ERROR: ~/category/Makefile:5: Package \"above-only-in-fs\" must be listed here.",
+               "ERROR: ~/category/Makefile:6: Package \"only-in-fs\" must be listed here.")
 }
 
 func (s *Suite) Test_CheckdirCategory__recursive(c *check.C) {
@@ -245,7 +243,7 @@
        CheckdirCategory(t.File("category"))
 
        t.CheckOutputLines(
-               "ERROR: ~/category/Makefile:6: \"zzz-fs-only\" exists in the file system but not in the Makefile.",
+               "ERROR: ~/category/Makefile:6: Package \"zzz-fs-only\" must be listed here.",
                "AUTOFIX: ~/category/Makefile:6: Inserting a line \"SUBDIR+=\\tzzz-fs-only\" above this line.")
 }
 
@@ -303,7 +301,7 @@
                "ERROR: ~/category/Makefile:3: COMMENT= line expected.",
                "NOTE: ~/category/Makefile:3: Empty line expected above this line.",
                "ERROR: ~/category/Makefile:3: SUBDIR+= line or empty line expected.",
-               "ERROR: ~/category/Makefile:3: \"package\" exists in the file system but not in the Makefile.",
+               "ERROR: ~/category/Makefile:3: Package \"package\" must be listed here.",
                "NOTE: ~/category/Makefile:3: Empty line expected above this line.",
                "WARN: ~/category/Makefile:3: This line should contain the following text: .include \"../mk/misc/category.mk\"",
                "ERROR: ~/category/Makefile:3: The file must end here.")
@@ -364,10 +362,10 @@
        G.Check(t.File("category"))
 
        t.CheckOutputLines(
-               "ERROR: ~/category/Makefile:5: \"p5-Net-DNS\" "+
-                       "exists in the file system but not in the Makefile.",
-               "ERROR: ~/category/Makefile:5: \"p5-net-dns\" "+
-                       "exists in the Makefile but not in the file system.")
+               "ERROR: ~/category/Makefile:5: "+
+                       "Package \"p5-Net-DNS\" must be listed here.",
+               "ERROR: ~/category/Makefile:5: "+
+                       "\"p5-net-dns\" does not contain a package.")
 }
 
 func (s *Suite) Test_CheckdirCategory__dot(c *check.C) {
@@ -389,8 +387,7 @@
        G.Check(".")
 
        t.CheckOutputLines(
-               "ERROR: Makefile:5: \"package\" exists in the Makefile " +
-                       "but not in the file system.")
+               "ERROR: Makefile:5: \"package\" does not contain a package.")
 }
 
 func (s *Suite) Test_CheckdirCategory__absolute(c *check.C) {
@@ -416,3 +413,27 @@
                        "contains the invalid character \"/\".",
                "ERROR: Makefile:5: \"/other\" must be a relative path.")
 }
+
+func (s *Suite) Test_CheckdirCategory__subdir_that_is_not_a_package(c *check.C) {
+       t := s.Init(c)
+
+       t.SetUpPkgsrc()
+       t.CreateFileLines("mk/misc/category.mk")
+       t.CreateFileLines("category/Makefile",
+               MkCvsID,
+               "",
+               "COMMENT=\tCategory comment",
+               "",
+               "SUBDIR+=\tsub2",
+               "",
+               ".include \"../mk/misc/category.mk\"")
+       t.CreateFileLines("category/sub1/module.mk")
+       t.CreateFileLines("category/sub2/module.mk")
+       t.Chdir("category")
+       t.FinishSetUp()
+
+       G.Check(".")
+
+       t.CheckOutputLines(
+               "ERROR: Makefile:5: \"sub2\" does not contain a package.")
+}
diff -r d428dbe3f65f -r 4c13a9fd5e8d pkgtools/pkglint/files/pkglint.go
--- a/pkgtools/pkglint/files/pkglint.go Sun May 17 07:00:46 2020 +0000
+++ b/pkgtools/pkglint/files/pkglint.go Sun May 17 07:07:18 2020 +0000
@@ -581,6 +581,9 @@
                        CheckLinesBuildlink3Mk(mklines)
                }
 
+       case p.Wip && basename == "COMMIT_MSG":
+               // https://mail-index.netbsd.org/pkgsrc-users/2020/05/10/msg031174.html
+
        case hasPrefix(basename, "DESCR"):
                if lines := Load(filename, NotEmpty|LogErrors); lines != nil {
                        CheckLinesDescr(lines)
diff -r d428dbe3f65f -r 4c13a9fd5e8d pkgtools/pkglint/files/pkglint_test.go
--- a/pkgtools/pkglint/files/pkglint_test.go    Sun May 17 07:00:46 2020 +0000
+++ b/pkgtools/pkglint/files/pkglint_test.go    Sun May 17 07:07:18 2020 +0000
@@ -1171,6 +1171,33 @@
        t.CheckOutputEmpty()
 }
 
+func (s *Suite) Test_Pkglint_checkReg__main_commit_message(c *check.C) {
+       t := s.Init(c)
+
+       t.SetUpPackage("category/package")
+       t.Chdir("category/package")
+       t.CreateFileLines("COMMIT_MSG")
+       t.FinishSetUp()
+
+       G.Check(".")
+
+       t.CheckOutputLines(
+               "WARN: COMMIT_MSG: Unexpected file found.")
+}
+
+func (s *Suite) Test_Pkglint_checkReg__wip_commit_message(c *check.C) {
+       t := s.Init(c)
+
+       t.SetUpPackage("wip/package")
+       t.Chdir("wip/package")
+       t.CreateFileLines("COMMIT_MSG")
+       t.FinishSetUp()
+
+       G.Check(".")
+
+       t.CheckOutputEmpty()
+}
+
 func (s *Suite) Test_Pkglint_checkRegCvsSubst(c *check.C) {
        t := s.Init(c)
 



Home | Main Index | Thread Index | Old Index