summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2021-08-14 09:46:11 +0000
committerrillig <rillig@pkgsrc.org>2021-08-14 09:46:11 +0000
commit8c97cd8c836731f3b5b7e4db6753f758099d79fe (patch)
treef0f589e251c54e3cb16d69f2f40a9ebdc0ad254f /pkgtools
parented8bc1190c546c2918dd40e6969642247deddaa6 (diff)
downloadpkgsrc-8c97cd8c836731f3b5b7e4db6753f758099d79fe.tar.gz
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 (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/files/mkassignchecker.go2
-rw-r--r--pkgtools/pkglint/files/package.go10
-rw-r--r--pkgtools/pkglint/files/package_test.go14
-rw-r--r--pkgtools/pkglint/files/plist.go12
-rw-r--r--pkgtools/pkglint/files/plist_test.go1
-rw-r--r--pkgtools/pkglint/files/shell.go2
-rw-r--r--pkgtools/pkglint/files/shell_test.go4
-rw-r--r--pkgtools/pkglint/files/vartypecheck.go4
-rw-r--r--pkgtools/pkglint/files/vartypecheck_test.go7
9 files changed, 33 insertions, 23 deletions
diff --git a/pkgtools/pkglint/files/mkassignchecker.go b/pkgtools/pkglint/files/mkassignchecker.go
index a059e78ef42..22c1bf9dedb 100644
--- a/pkgtools/pkglint/files/mkassignchecker.go
+++ b/pkgtools/pkglint/files/mkassignchecker.go
@@ -607,7 +607,7 @@ func (ck *MkAssignChecker) checkMiscRedundantInstallationDirs() {
}
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 --git a/pkgtools/pkglint/files/package.go b/pkgtools/pkglint/files/package.go
index 3e34508f0d8..709921b506b 100644
--- a/pkgtools/pkglint/files/package.go
+++ b/pkgtools/pkglint/files/package.go
@@ -537,7 +537,9 @@ func (pkg *Package) loadPlistDirs(plistFilename CurrPath) {
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(includedFile PackagePath) {
// 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 --git a/pkgtools/pkglint/files/package_test.go b/pkgtools/pkglint/files/package_test.go
index 9a34cf7e319..b69d8881123 100644
--- a/pkgtools/pkglint/files/package_test.go
+++ b/pkgtools/pkglint/files/package_test.go
@@ -1265,12 +1265,12 @@ func (s *Suite) Test_Package_loadPlistDirs__empty(c *check.C) {
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_loadPlistDirs(c *check.C) {
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_loadPlistDirs(c *check.C) {
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 --git a/pkgtools/pkglint/files/plist.go b/pkgtools/pkglint/files/plist.go
index 40ab5519953..43ecb7094d1 100644
--- a/pkgtools/pkglint/files/plist.go
+++ b/pkgtools/pkglint/files/plist.go
@@ -399,14 +399,10 @@ func (ck *PlistChecker) checkPathMan(pline *PlistLine) {
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 --git a/pkgtools/pkglint/files/plist_test.go b/pkgtools/pkglint/files/plist_test.go
index 3df3b869483..7dce4efb98b 100644
--- a/pkgtools/pkglint/files/plist_test.go
+++ b/pkgtools/pkglint/files/plist_test.go
@@ -39,7 +39,6 @@ func (s *Suite) Test_CheckLinesPlist(c *check.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\".",
diff --git a/pkgtools/pkglint/files/shell.go b/pkgtools/pkglint/files/shell.go
index 55d055f99ca..68b9581e23c 100644
--- a/pkgtools/pkglint/files/shell.go
+++ b/pkgtools/pkglint/files/shell.go
@@ -277,7 +277,7 @@ func (scc *SimpleCommandChecker) checkAutoMkdirs() {
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 --git a/pkgtools/pkglint/files/shell_test.go b/pkgtools/pkglint/files/shell_test.go
index 2f13e033181..dade02f6a69 100644
--- a/pkgtools/pkglint/files/shell_test.go
+++ b/pkgtools/pkglint/files/shell_test.go
@@ -391,7 +391,7 @@ func (s *Suite) Test_SimpleCommandChecker_checkAutoMkdirs(c *check.C) {
"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_CheckShellCommandLine(c *check.C) {
"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 --git a/pkgtools/pkglint/files/vartypecheck.go b/pkgtools/pkglint/files/vartypecheck.go
index 393bf744919..3db345c17d2 100644
--- a/pkgtools/pkglint/files/vartypecheck.go
+++ b/pkgtools/pkglint/files/vartypecheck.go
@@ -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)
diff --git a/pkgtools/pkglint/files/vartypecheck_test.go b/pkgtools/pkglint/files/vartypecheck_test.go
index 9ffd896151c..ad7905e43c4 100644
--- a/pkgtools/pkglint/files/vartypecheck_test.go
+++ b/pkgtools/pkglint/files/vartypecheck_test.go
@@ -1823,6 +1823,13 @@ func (s *Suite) Test_VartypeCheck_PrefixPathname(c *check.C) {
"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) {