pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files pkgtools/pkglint: update to 21.2.5



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ecadb8d0384f
branches:  trunk
changeset: 457029:ecadb8d0384f
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Aug 14 09:46:11 2021 +0000

description:
pkgtools/pkglint: update to 21.2.5

Changes since 21.2.4:

Fixed wrong warning about man/man1 in INSTALLATION_DIRS.

Fixed outdated warning that preformatted manual pages should end in
'.0' since SunOS uses the section prefix for them.

diffstat:

 pkgtools/pkglint/files/mkassignchecker.go   |   2 +-
 pkgtools/pkglint/files/package.go           |  10 ++++++----
 pkgtools/pkglint/files/package_test.go      |  14 ++++++++++----
 pkgtools/pkglint/files/plist.go             |  12 ++++--------
 pkgtools/pkglint/files/plist_test.go        |   1 -
 pkgtools/pkglint/files/shell.go             |   2 +-
 pkgtools/pkglint/files/shell_test.go        |   4 ++--
 pkgtools/pkglint/files/vartypecheck.go      |   4 ++--
 pkgtools/pkglint/files/vartypecheck_test.go |   7 +++++++
 9 files changed, 33 insertions(+), 23 deletions(-)

diffs (182 lines):

diff -r d4cf9e4f8ef1 -r ecadb8d0384f pkgtools/pkglint/files/mkassignchecker.go
--- a/pkgtools/pkglint/files/mkassignchecker.go Sat Aug 14 08:58:45 2021 +0000
+++ b/pkgtools/pkglint/files/mkassignchecker.go Sat Aug 14 09:46:11 2021 +0000
@@ -607,7 +607,7 @@
                }
 
                rel := NewRelPathString(dir)
-               if pkg.Plist.Dirs[rel] != nil {
+               if pkg.Plist.UnconditionalDirs[rel] != nil {
                        mkline.Notef("The directory %q is redundant in %s.", rel, varname)
                        mkline.Explain(
                                "This package defines AUTO_MKDIR, and the directory is contained in the PLIST.",
diff -r d4cf9e4f8ef1 -r ecadb8d0384f pkgtools/pkglint/files/package.go
--- a/pkgtools/pkglint/files/package.go Sat Aug 14 08:58:45 2021 +0000
+++ b/pkgtools/pkglint/files/package.go Sat Aug 14 09:46:11 2021 +0000
@@ -537,7 +537,9 @@
                pkg.Plist.Files[filename] = pline
        }
        for dirname, pline := range ck.allDirs {
-               pkg.Plist.Dirs[dirname] = pline
+               if len(pline.conditions) == 0 {
+                       pkg.Plist.UnconditionalDirs[dirname] = pline
+               }
        }
        for _, plistLine := range plistLines {
                if plistLine.HasPath() {
@@ -1787,9 +1789,9 @@
 // 2. Ensure that the entries mentioned in the ALTERNATIVES file
 // also appear in the PLIST files.
 type PlistContent struct {
-       Dirs       map[RelPath]*PlistLine
-       Files      map[RelPath]*PlistLine
-       Conditions map[string]bool // each ${PLIST.id} sets ["id"] = true.
+       UnconditionalDirs map[RelPath]*PlistLine
+       Files             map[RelPath]*PlistLine
+       Conditions        map[string]bool // each ${PLIST.id} sets ["id"] = true.
 }
 
 func NewPlistContent() PlistContent {
diff -r d4cf9e4f8ef1 -r ecadb8d0384f pkgtools/pkglint/files/package_test.go
--- a/pkgtools/pkglint/files/package_test.go    Sat Aug 14 08:58:45 2021 +0000
+++ b/pkgtools/pkglint/files/package_test.go    Sat Aug 14 09:46:11 2021 +0000
@@ -1265,12 +1265,12 @@
        pkg.load()
 
        var dirs []RelPath
-       for dir := range pkg.Plist.Dirs {
+       for dir := range pkg.Plist.UnconditionalDirs {
                dirs = append(dirs, dir)
        }
        sort.Slice(dirs, func(i, j int) bool { return dirs[i] < dirs[j] })
 
-       t.CheckDeepEquals(dirs, []RelPath{"bin"})
+       t.CheckDeepEquals(dirs, []RelPath{"bin"}) // see t.SetUpPackage
 }
 
 func (s *Suite) Test_Package_loadPlistDirs(c *check.C) {
@@ -1281,6 +1281,8 @@
                PlistCvsID,
                "@exec echo hello",
                "${PLIST.condition}dir/subdir/file",
+               "${PLIST.condition}mixed/conditional-file",
+               "mixed/unconditional-file",
                "@unexec echo bye")
        t.FinishSetUp()
 
@@ -1288,12 +1290,16 @@
        pkg.load()
 
        var dirs []RelPath
-       for dir := range pkg.Plist.Dirs {
+       for dir := range pkg.Plist.UnconditionalDirs {
                dirs = append(dirs, dir)
        }
        sort.Slice(dirs, func(i, j int) bool { return dirs[i] < dirs[j] })
 
-       t.CheckDeepEquals(dirs, []RelPath{"bin", "dir", "dir/subdir"})
+       t.CheckDeepEquals(dirs, []RelPath{
+               "bin", // from t.SetUpPackage
+               // dir is not listed because it is conditional.
+               // dir/subdir is not listed because it is conditional.
+               "mixed"})
 }
 
 func (s *Suite) Test_Package_check__files_Makefile(c *check.C) {
diff -r d4cf9e4f8ef1 -r ecadb8d0384f pkgtools/pkglint/files/plist.go
--- a/pkgtools/pkglint/files/plist.go   Sat Aug 14 08:58:45 2021 +0000
+++ b/pkgtools/pkglint/files/plist.go   Sat Aug 14 09:46:11 2021 +0000
@@ -399,14 +399,10 @@
                pline.Warnf("Preformatted manual page without unformatted one.")
        }
 
-       if catOrMan == "cat" {
-               if ext != "0" {
-                       pline.Warnf("Preformatted manual pages should end in \".0\".")
-               }
-       } else {
-               if !hasPrefix(ext, section) {
-                       pline.Warnf("Mismatch between the section (%s) and extension (%s) of the manual page.", section, ext)
-               }
+       if catOrMan == "man" && !hasPrefix(ext, section) {
+               pline.Warnf("Mismatch between the section (%s) "+
+                       "and extension (%s) of the manual page.",
+                       section, ext)
        }
 
        if gz != "" {
diff -r d4cf9e4f8ef1 -r ecadb8d0384f pkgtools/pkglint/files/plist_test.go
--- a/pkgtools/pkglint/files/plist_test.go      Sat Aug 14 08:58:45 2021 +0000
+++ b/pkgtools/pkglint/files/plist_test.go      Sat Aug 14 09:46:11 2021 +0000
@@ -39,7 +39,6 @@
                "WARN: PLIST:9: \"lib/libc.la\" should be sorted before \"lib/libc.so.6\".",
                "WARN: PLIST:9: Packages that install libtool libraries should define USE_LIBTOOL.",
                "WARN: PLIST:10: Preformatted manual page without unformatted one.",
-               "WARN: PLIST:10: Preformatted manual pages should end in \".0\".",
                "WARN: PLIST:11: IMAKE_MANNEWSUFFIX is not meant to appear in PLISTs.",
                "WARN: PLIST:12: Please remove this line. It is no longer necessary.",
                "ERROR: PLIST:14: The package Makefile must include \"../../graphics/gnome-icon-theme/buildlink3.mk\".",
diff -r d4cf9e4f8ef1 -r ecadb8d0384f pkgtools/pkglint/files/shell.go
--- a/pkgtools/pkglint/files/shell.go   Sat Aug 14 08:58:45 2021 +0000
+++ b/pkgtools/pkglint/files/shell.go   Sat Aug 14 09:46:11 2021 +0000
@@ -277,7 +277,7 @@
 
                autoMkdirs := false
                if scc.mklines.pkg != nil {
-                       plistLine := scc.mklines.pkg.Plist.Dirs[prefixRel]
+                       plistLine := scc.mklines.pkg.Plist.UnconditionalDirs[prefixRel]
                        if plistLine != nil && !containsVarUse(plistLine.Line.Text) {
                                autoMkdirs = true
                        }
diff -r d4cf9e4f8ef1 -r ecadb8d0384f pkgtools/pkglint/files/shell_test.go
--- a/pkgtools/pkglint/files/shell_test.go      Sat Aug 14 08:58:45 2021 +0000
+++ b/pkgtools/pkglint/files/shell_test.go      Sat Aug 14 09:46:11 2021 +0000
@@ -391,7 +391,7 @@
                "NOTE: filename.mk:1: You can use \"INSTALLATION_DIRS+= second\" instead of \"${INSTALL} -d\".")
 
        pkg = NewPackage(t.File("category/pkgbase"))
-       pkg.Plist.Dirs["share/pkgbase"] = &PlistLine{
+       pkg.Plist.UnconditionalDirs["share/pkgbase"] = &PlistLine{
                t.NewLine("PLIST", 123, "share/pkgbase/file"),
                nil,
                "share/pkgbase/file"}
@@ -978,7 +978,7 @@
                "WARN: filename.mk:1: Using a leading \"-\" to suppress errors is deprecated.")
 
        pkg = NewPackage(t.File("category/pkgbase"))
-       pkg.Plist.Dirs["share/pkgbase"] = &PlistLine{
+       pkg.Plist.UnconditionalDirs["share/pkgbase"] = &PlistLine{
                t.NewLine("PLIST", 123, "share/pkgbase/file"),
                nil,
                "share/pkgbase/file"}
diff -r d4cf9e4f8ef1 -r ecadb8d0384f pkgtools/pkglint/files/vartypecheck.go
--- a/pkgtools/pkglint/files/vartypecheck.go    Sat Aug 14 08:58:45 2021 +0000
+++ b/pkgtools/pkglint/files/vartypecheck.go    Sat Aug 14 09:46:11 2021 +0000
@@ -1189,8 +1189,8 @@
                }
        })
 
-       if m, manSubdir := match1(cv.Value, `^man/(.+)`); m {
-               from := "${PKGMANDIR}/" + manSubdir
+       if hasPrefix(cv.Value, "man/") && cv.Varname != "INSTALLATION_DIRS" {
+               from := "${PKGMANDIR}/" + cv.Value[4:]
                fix := cv.Autofix()
                fix.Warnf("Please use %q instead of %q.", from, cv.Value)
                fix.Replace(cv.Value, from)
diff -r d4cf9e4f8ef1 -r ecadb8d0384f pkgtools/pkglint/files/vartypecheck_test.go
--- a/pkgtools/pkglint/files/vartypecheck_test.go       Sat Aug 14 08:58:45 2021 +0000
+++ b/pkgtools/pkglint/files/vartypecheck_test.go       Sat Aug 14 09:46:11 2021 +0000
@@ -1823,6 +1823,13 @@
                        "since it is not relative to PREFIX.",
                "ERROR: filename.mk:11: VARBASE must not be used in INSTALLATION_DIRS "+
                        "since it is not relative to PREFIX.")
+
+       // INSTALLATION_DIRS automatically replaces "man" with "${PKGMANDIR}".
+       vt.Varname("INSTALLATION_DIRS")
+       vt.Values(
+               "man/man1")
+
+       vt.OutputEmpty()
 }
 
 func (s *Suite) Test_VartypeCheck_PythonDependency(c *check.C) {



Home | Main Index | Thread Index | Old Index