pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/pkglint/files



Module Name:    pkgsrc
Committed By:   rillig
Date:           Sat Aug 14 09:46:11 UTC 2021

Modified Files:
        pkgsrc/pkgtools/pkglint/files: mkassignchecker.go package.go
            package_test.go plist.go plist_test.go shell.go shell_test.go
            vartypecheck.go vartypecheck_test.go

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 pkgsrc/pkgtools/pkglint/files/mkassignchecker.go
cvs rdiff -u -r1.102 -r1.103 pkgsrc/pkgtools/pkglint/files/package.go
cvs rdiff -u -r1.85 -r1.86 pkgsrc/pkgtools/pkglint/files/package_test.go
cvs rdiff -u -r1.61 -r1.62 pkgsrc/pkgtools/pkglint/files/plist.go
cvs rdiff -u -r1.52 -r1.53 pkgsrc/pkgtools/pkglint/files/plist_test.go
cvs rdiff -u -r1.64 -r1.65 pkgsrc/pkgtools/pkglint/files/shell.go
cvs rdiff -u -r1.71 -r1.72 pkgsrc/pkgtools/pkglint/files/shell_test.go
cvs rdiff -u -r1.96 -r1.97 pkgsrc/pkgtools/pkglint/files/vartypecheck.go
cvs rdiff -u -r1.87 -r1.88 pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/pkglint/files/mkassignchecker.go
diff -u pkgsrc/pkgtools/pkglint/files/mkassignchecker.go:1.10 pkgsrc/pkgtools/pkglint/files/mkassignchecker.go:1.11
--- pkgsrc/pkgtools/pkglint/files/mkassignchecker.go:1.10       Sun Aug  8 22:04:15 2021
+++ pkgsrc/pkgtools/pkglint/files/mkassignchecker.go    Sat Aug 14 09:46:11 2021
@@ -607,7 +607,7 @@ func (ck *MkAssignChecker) checkMiscRedu
                }
 
                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.",

Index: pkgsrc/pkgtools/pkglint/files/package.go
diff -u pkgsrc/pkgtools/pkglint/files/package.go:1.102 pkgsrc/pkgtools/pkglint/files/package.go:1.103
--- pkgsrc/pkgtools/pkglint/files/package.go:1.102      Sat Aug 14 08:19:49 2021
+++ pkgsrc/pkgtools/pkglint/files/package.go    Sat Aug 14 09:46:11 2021
@@ -537,7 +537,9 @@ func (pkg *Package) loadPlistDirs(plistF
                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 @@ func (pkg *Package) FixAddInclude(includ
 // 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 {

Index: pkgsrc/pkgtools/pkglint/files/package_test.go
diff -u pkgsrc/pkgtools/pkglint/files/package_test.go:1.85 pkgsrc/pkgtools/pkglint/files/package_test.go:1.86
--- pkgsrc/pkgtools/pkglint/files/package_test.go:1.85  Sat Aug 14 08:19:49 2021
+++ pkgsrc/pkgtools/pkglint/files/package_test.go       Sat Aug 14 09:46:11 2021
@@ -1265,12 +1265,12 @@ func (s *Suite) Test_Package_loadPlistDi
        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 @@ func (s *Suite) Test_Package_loadPlistDi
                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 @@ func (s *Suite) Test_Package_loadPlistDi
        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) {

Index: pkgsrc/pkgtools/pkglint/files/plist.go
diff -u pkgsrc/pkgtools/pkglint/files/plist.go:1.61 pkgsrc/pkgtools/pkglint/files/plist.go:1.62
--- pkgsrc/pkgtools/pkglint/files/plist.go:1.61 Sun Jun  6 07:41:34 2021
+++ pkgsrc/pkgtools/pkglint/files/plist.go      Sat Aug 14 09:46:11 2021
@@ -399,14 +399,10 @@ func (ck *PlistChecker) checkPathMan(pli
                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 != "" {

Index: pkgsrc/pkgtools/pkglint/files/plist_test.go
diff -u pkgsrc/pkgtools/pkglint/files/plist_test.go:1.52 pkgsrc/pkgtools/pkglint/files/plist_test.go:1.53
--- pkgsrc/pkgtools/pkglint/files/plist_test.go:1.52    Sun Jun  6 07:41:34 2021
+++ pkgsrc/pkgtools/pkglint/files/plist_test.go Sat Aug 14 09:46:11 2021
@@ -39,7 +39,6 @@ func (s *Suite) Test_CheckLinesPlist(c *
                "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\".",

Index: pkgsrc/pkgtools/pkglint/files/shell.go
diff -u pkgsrc/pkgtools/pkglint/files/shell.go:1.64 pkgsrc/pkgtools/pkglint/files/shell.go:1.65
--- pkgsrc/pkgtools/pkglint/files/shell.go:1.64 Wed Jul  1 13:17:41 2020
+++ pkgsrc/pkgtools/pkglint/files/shell.go      Sat Aug 14 09:46:11 2021
@@ -277,7 +277,7 @@ func (scc *SimpleCommandChecker) checkAu
 
                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
                        }

Index: pkgsrc/pkgtools/pkglint/files/shell_test.go
diff -u pkgsrc/pkgtools/pkglint/files/shell_test.go:1.71 pkgsrc/pkgtools/pkglint/files/shell_test.go:1.72
--- pkgsrc/pkgtools/pkglint/files/shell_test.go:1.71    Tue Oct  6 18:40:50 2020
+++ pkgsrc/pkgtools/pkglint/files/shell_test.go Sat Aug 14 09:46:11 2021
@@ -391,7 +391,7 @@ func (s *Suite) Test_SimpleCommandChecke
                "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 @@ func (s *Suite) Test_ShellLineChecker_Ch
                "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"}

Index: pkgsrc/pkgtools/pkglint/files/vartypecheck.go
diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.96 pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.97
--- pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.96  Fri Jun 25 14:15:01 2021
+++ pkgsrc/pkgtools/pkglint/files/vartypecheck.go       Sat Aug 14 09:46:11 2021
@@ -1189,8 +1189,8 @@ func (cv *VartypeCheck) PrefixPathname()
                }
        })
 
-       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)

Index: pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go
diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.87 pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.88
--- pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.87     Sun Jun  6 11:46:43 2021
+++ pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go  Sat Aug 14 09:46:11 2021
@@ -1823,6 +1823,13 @@ func (s *Suite) Test_VartypeCheck_Prefix
                        "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