Sat Aug 14 09:46:11 2021 UTC ()
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.


(rillig)
diff -r1.10 -r1.11 pkgsrc/pkgtools/pkglint/files/mkassignchecker.go
diff -r1.102 -r1.103 pkgsrc/pkgtools/pkglint/files/package.go
diff -r1.85 -r1.86 pkgsrc/pkgtools/pkglint/files/package_test.go
diff -r1.61 -r1.62 pkgsrc/pkgtools/pkglint/files/plist.go
diff -r1.52 -r1.53 pkgsrc/pkgtools/pkglint/files/plist_test.go
diff -r1.64 -r1.65 pkgsrc/pkgtools/pkglint/files/shell.go
diff -r1.71 -r1.72 pkgsrc/pkgtools/pkglint/files/shell_test.go
diff -r1.96 -r1.97 pkgsrc/pkgtools/pkglint/files/vartypecheck.go
diff -r1.87 -r1.88 pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go

cvs diff -r1.10 -r1.11 pkgsrc/pkgtools/pkglint/files/Attic/mkassignchecker.go (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkglint/files/Attic/mkassignchecker.go 2021/08/08 22:04:15 1.10
+++ pkgsrc/pkgtools/pkglint/files/Attic/mkassignchecker.go 2021/08/14 09:46:11 1.11
@@ -597,27 +597,27 @@ func (ck *MkAssignChecker) checkMiscRedu @@ -597,27 +597,27 @@ func (ck *MkAssignChecker) checkMiscRedu
597 switch { 597 switch {
598 case pkg == nil, 598 case pkg == nil,
599 varname != "INSTALLATION_DIRS", 599 varname != "INSTALLATION_DIRS",
600 !matches(pkg.vars.LastValue("AUTO_MKDIRS"), `^[Yy][Ee][Ss]$`): 600 !matches(pkg.vars.LastValue("AUTO_MKDIRS"), `^[Yy][Ee][Ss]$`):
601 return 601 return
602 } 602 }
603 603
604 for _, dir := range mkline.ValueFields(mkline.Value()) { 604 for _, dir := range mkline.ValueFields(mkline.Value()) {
605 if NewPath(dir).IsAbs() { 605 if NewPath(dir).IsAbs() {
606 continue 606 continue
607 } 607 }
608 608
609 rel := NewRelPathString(dir) 609 rel := NewRelPathString(dir)
610 if pkg.Plist.Dirs[rel] != nil { 610 if pkg.Plist.UnconditionalDirs[rel] != nil {
611 mkline.Notef("The directory %q is redundant in %s.", rel, varname) 611 mkline.Notef("The directory %q is redundant in %s.", rel, varname)
612 mkline.Explain( 612 mkline.Explain(
613 "This package defines AUTO_MKDIR, and the directory is contained in the PLIST.", 613 "This package defines AUTO_MKDIR, and the directory is contained in the PLIST.",
614 "Therefore it will be created anyway.") 614 "Therefore it will be created anyway.")
615 } 615 }
616 } 616 }
617} 617}
618 618
619// checkRightVaruse checks that in a variable assignment, 619// checkRightVaruse checks that in a variable assignment,
620// each variable used on the right-hand side of the assignment operator 620// each variable used on the right-hand side of the assignment operator
621// has the correct data type and quoting. 621// has the correct data type and quoting.
622func (ck *MkAssignChecker) checkRightVaruse() { 622func (ck *MkAssignChecker) checkRightVaruse() {
623 if trace.Tracing { 623 if trace.Tracing {

cvs diff -r1.102 -r1.103 pkgsrc/pkgtools/pkglint/files/Attic/package.go (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkglint/files/Attic/package.go 2021/08/14 08:19:49 1.102
+++ pkgsrc/pkgtools/pkglint/files/Attic/package.go 2021/08/14 09:46:11 1.103
@@ -527,27 +527,29 @@ func (pkg *Package) loadPlistDirs(plistF @@ -527,27 +527,29 @@ func (pkg *Package) loadPlistDirs(plistF
527 ck := PlistChecker{ 527 ck := PlistChecker{
528 pkg, 528 pkg,
529 make(map[RelPath]*PlistLine), 529 make(map[RelPath]*PlistLine),
530 make(map[RelPath]*PlistLine), 530 make(map[RelPath]*PlistLine),
531 "", 531 "",
532 Once{}, 532 Once{},
533 false} 533 false}
534 plistLines := ck.Load(lines) 534 plistLines := ck.Load(lines)
535 535
536 for filename, pline := range ck.allFiles { 536 for filename, pline := range ck.allFiles {
537 pkg.Plist.Files[filename] = pline 537 pkg.Plist.Files[filename] = pline
538 } 538 }
539 for dirname, pline := range ck.allDirs { 539 for dirname, pline := range ck.allDirs {
540 pkg.Plist.Dirs[dirname] = pline 540 if len(pline.conditions) == 0 {
 541 pkg.Plist.UnconditionalDirs[dirname] = pline
 542 }
541 } 543 }
542 for _, plistLine := range plistLines { 544 for _, plistLine := range plistLines {
543 if plistLine.HasPath() { 545 if plistLine.HasPath() {
544 rank := NewPlistRank(plistLine.Line.Basename) 546 rank := NewPlistRank(plistLine.Line.Basename)
545 pkg.PlistLines.Add(plistLine, rank) 547 pkg.PlistLines.Add(plistLine, rank)
546 } 548 }
547 for _, cond := range plistLine.conditions { 549 for _, cond := range plistLine.conditions {
548 pkg.Plist.Conditions[strings.TrimPrefix(cond, "PLIST.")] = true 550 pkg.Plist.Conditions[strings.TrimPrefix(cond, "PLIST.")] = true
549 } 551 }
550 } 552 }
551} 553}
552 554
553func (pkg *Package) check(filenames []CurrPath, mklines, allLines *MkLines) { 555func (pkg *Package) check(filenames []CurrPath, mklines, allLines *MkLines) {
@@ -1777,29 +1779,29 @@ func (pkg *Package) FixAddInclude(includ @@ -1777,29 +1779,29 @@ func (pkg *Package) FixAddInclude(includ
1777 1779
1778 mklines.SaveAutofixChanges() 1780 mklines.SaveAutofixChanges()
1779} 1781}
1780 1782
1781// PlistContent lists the directories and files that appear in the 1783// PlistContent lists the directories and files that appear in the
1782// package's PLIST files. It serves two purposes: 1784// package's PLIST files. It serves two purposes:
1783// 1785//
1784// 1. Decide whether AUTO_MKDIRS can be used instead of listing 1786// 1. Decide whether AUTO_MKDIRS can be used instead of listing
1785// the INSTALLATION_DIRS redundantly. 1787// the INSTALLATION_DIRS redundantly.
1786// 1788//
1787// 2. Ensure that the entries mentioned in the ALTERNATIVES file 1789// 2. Ensure that the entries mentioned in the ALTERNATIVES file
1788// also appear in the PLIST files. 1790// also appear in the PLIST files.
1789type PlistContent struct { 1791type PlistContent struct {
1790 Dirs map[RelPath]*PlistLine 1792 UnconditionalDirs map[RelPath]*PlistLine
1791 Files map[RelPath]*PlistLine 1793 Files map[RelPath]*PlistLine
1792 Conditions map[string]bool // each ${PLIST.id} sets ["id"] = true. 1794 Conditions map[string]bool // each ${PLIST.id} sets ["id"] = true.
1793} 1795}
1794 1796
1795func NewPlistContent() PlistContent { 1797func NewPlistContent() PlistContent {
1796 return PlistContent{ 1798 return PlistContent{
1797 make(map[RelPath]*PlistLine), 1799 make(map[RelPath]*PlistLine),
1798 make(map[RelPath]*PlistLine), 1800 make(map[RelPath]*PlistLine),
1799 make(map[string]bool)} 1801 make(map[string]bool)}
1800} 1802}
1801 1803
1802// matchPkgname tests whether the string has the form of a package name that 1804// matchPkgname tests whether the string has the form of a package name that
1803// does not contain any variable expressions. 1805// does not contain any variable expressions.
1804func matchPkgname(s string) (m bool, base string, version string) { 1806func matchPkgname(s string) (m bool, base string, version string) {
1805 // TODO: Allow a hyphen in the middle of a version number. 1807 // TODO: Allow a hyphen in the middle of a version number.

cvs diff -r1.85 -r1.86 pkgsrc/pkgtools/pkglint/files/Attic/package_test.go (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkglint/files/Attic/package_test.go 2021/08/14 08:19:49 1.85
+++ pkgsrc/pkgtools/pkglint/files/Attic/package_test.go 2021/08/14 09:46:11 1.86
@@ -1255,55 +1255,61 @@ func (s *Suite) Test_Package_collectSeen @@ -1255,55 +1255,61 @@ func (s *Suite) Test_Package_collectSeen
1255// Just ensure that pkglint doesn't crash. 1255// Just ensure that pkglint doesn't crash.
1256func (s *Suite) Test_Package_loadPlistDirs__empty(c *check.C) { 1256func (s *Suite) Test_Package_loadPlistDirs__empty(c *check.C) {
1257 t := s.Init(c) 1257 t := s.Init(c)
1258 1258
1259 t.SetUpPackage("category/package") 1259 t.SetUpPackage("category/package")
1260 t.CreateFileLines("category/package/PLIST.common", 1260 t.CreateFileLines("category/package/PLIST.common",
1261 nil...) 1261 nil...)
1262 t.FinishSetUp() 1262 t.FinishSetUp()
1263 1263
1264 pkg := NewPackage(t.File("category/package")) 1264 pkg := NewPackage(t.File("category/package"))
1265 pkg.load() 1265 pkg.load()
1266 1266
1267 var dirs []RelPath 1267 var dirs []RelPath
1268 for dir := range pkg.Plist.Dirs { 1268 for dir := range pkg.Plist.UnconditionalDirs {
1269 dirs = append(dirs, dir) 1269 dirs = append(dirs, dir)
1270 } 1270 }
1271 sort.Slice(dirs, func(i, j int) bool { return dirs[i] < dirs[j] }) 1271 sort.Slice(dirs, func(i, j int) bool { return dirs[i] < dirs[j] })
1272 1272
1273 t.CheckDeepEquals(dirs, []RelPath{"bin"}) 1273 t.CheckDeepEquals(dirs, []RelPath{"bin"}) // see t.SetUpPackage
1274} 1274}
1275 1275
1276func (s *Suite) Test_Package_loadPlistDirs(c *check.C) { 1276func (s *Suite) Test_Package_loadPlistDirs(c *check.C) {
1277 t := s.Init(c) 1277 t := s.Init(c)
1278 1278
1279 t.SetUpPackage("category/package") 1279 t.SetUpPackage("category/package")
1280 t.CreateFileLines("category/package/PLIST.common", 1280 t.CreateFileLines("category/package/PLIST.common",
1281 PlistCvsID, 1281 PlistCvsID,
1282 "@exec echo hello", 1282 "@exec echo hello",
1283 "${PLIST.condition}dir/subdir/file", 1283 "${PLIST.condition}dir/subdir/file",
 1284 "${PLIST.condition}mixed/conditional-file",
 1285 "mixed/unconditional-file",
1284 "@unexec echo bye") 1286 "@unexec echo bye")
1285 t.FinishSetUp() 1287 t.FinishSetUp()
1286 1288
1287 pkg := NewPackage(t.File("category/package")) 1289 pkg := NewPackage(t.File("category/package"))
1288 pkg.load() 1290 pkg.load()
1289 1291
1290 var dirs []RelPath 1292 var dirs []RelPath
1291 for dir := range pkg.Plist.Dirs { 1293 for dir := range pkg.Plist.UnconditionalDirs {
1292 dirs = append(dirs, dir) 1294 dirs = append(dirs, dir)
1293 } 1295 }
1294 sort.Slice(dirs, func(i, j int) bool { return dirs[i] < dirs[j] }) 1296 sort.Slice(dirs, func(i, j int) bool { return dirs[i] < dirs[j] })
1295 1297
1296 t.CheckDeepEquals(dirs, []RelPath{"bin", "dir", "dir/subdir"}) 1298 t.CheckDeepEquals(dirs, []RelPath{
 1299 "bin", // from t.SetUpPackage
 1300 // dir is not listed because it is conditional.
 1301 // dir/subdir is not listed because it is conditional.
 1302 "mixed"})
1297} 1303}
1298 1304
1299func (s *Suite) Test_Package_check__files_Makefile(c *check.C) { 1305func (s *Suite) Test_Package_check__files_Makefile(c *check.C) {
1300 t := s.Init(c) 1306 t := s.Init(c)
1301 1307
1302 t.SetUpPackage("category/package") 1308 t.SetUpPackage("category/package")
1303 t.CreateFileLines("category/package/files/Makefile", 1309 t.CreateFileLines("category/package/files/Makefile",
1304 "This file may contain anything.") 1310 "This file may contain anything.")
1305 1311
1306 t.Main("category/package/files/Makefile") 1312 t.Main("category/package/files/Makefile")
1307 1313
1308 // Since there is nothing to check in files/*, pkglint could 1314 // Since there is nothing to check in files/*, pkglint could
1309 // as well report this as a usage error. 1315 // as well report this as a usage error.

cvs diff -r1.61 -r1.62 pkgsrc/pkgtools/pkglint/files/Attic/plist.go (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkglint/files/Attic/plist.go 2021/06/06 07:41:34 1.61
+++ pkgsrc/pkgtools/pkglint/files/Attic/plist.go 2021/08/14 09:46:11 1.62
@@ -389,34 +389,30 @@ func (ck *PlistChecker) checkPathMan(pli @@ -389,34 +389,30 @@ func (ck *PlistChecker) checkPathMan(pli
389 if !m { 389 if !m {
390 // maybe: line.Warnf("Invalid filename %q for manual page.", text) 390 // maybe: line.Warnf("Invalid filename %q for manual page.", text)
391 return 391 return
392 } 392 }
393 393
394 if !matches(section, `^[0-9ln]$`) { 394 if !matches(section, `^[0-9ln]$`) {
395 pline.Warnf("Unknown section %q for manual page.", section) 395 pline.Warnf("Unknown section %q for manual page.", section)
396 } 396 }
397 397
398 if catOrMan == "cat" && ck.allFiles[NewRelPathString("man/man"+section+"/"+manpage+"."+section)] == nil { 398 if catOrMan == "cat" && ck.allFiles[NewRelPathString("man/man"+section+"/"+manpage+"."+section)] == nil {
399 pline.Warnf("Preformatted manual page without unformatted one.") 399 pline.Warnf("Preformatted manual page without unformatted one.")
400 } 400 }
401 401
402 if catOrMan == "cat" { 402 if catOrMan == "man" && !hasPrefix(ext, section) {
403 if ext != "0" { 403 pline.Warnf("Mismatch between the section (%s) "+
404 pline.Warnf("Preformatted manual pages should end in \".0\".") 404 "and extension (%s) of the manual page.",
405 } 405 section, ext)
406 } else { 
407 if !hasPrefix(ext, section) { 
408 pline.Warnf("Mismatch between the section (%s) and extension (%s) of the manual page.", section, ext) 
409 } 
410 } 406 }
411 407
412 if gz != "" { 408 if gz != "" {
413 fix := pline.Autofix() 409 fix := pline.Autofix()
414 fix.Notef("The .gz extension is unnecessary for manual pages.") 410 fix.Notef("The .gz extension is unnecessary for manual pages.")
415 fix.Explain( 411 fix.Explain(
416 "Whether the manual pages are installed in compressed form or not is", 412 "Whether the manual pages are installed in compressed form or not is",
417 "configured by the pkgsrc user.", 413 "configured by the pkgsrc user.",
418 "Compression and decompression takes place automatically,", 414 "Compression and decompression takes place automatically,",
419 "no matter if the .gz extension is mentioned in the PLIST or not.") 415 "no matter if the .gz extension is mentioned in the PLIST or not.")
420 fix.ReplaceAt(0, len(pline.Line.Text)-len(".gz"), ".gz", "") 416 fix.ReplaceAt(0, len(pline.Line.Text)-len(".gz"), ".gz", "")
421 fix.Apply() 417 fix.Apply()
422 } 418 }

cvs diff -r1.52 -r1.53 pkgsrc/pkgtools/pkglint/files/Attic/plist_test.go (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkglint/files/Attic/plist_test.go 2021/06/06 07:41:34 1.52
+++ pkgsrc/pkgtools/pkglint/files/Attic/plist_test.go 2021/08/14 09:46:11 1.53
@@ -29,27 +29,26 @@ func (s *Suite) Test_CheckLinesPlist(c * @@ -29,27 +29,26 @@ func (s *Suite) Test_CheckLinesPlist(c *
29 29
30 CheckLinesPlist(pkg, lines) 30 CheckLinesPlist(pkg, lines)
31 31
32 t.CheckOutputLines( 32 t.CheckOutputLines(
33 "ERROR: PLIST:1: Expected \"@comment $"+"NetBSD$\".", 33 "ERROR: PLIST:1: Expected \"@comment $"+"NetBSD$\".",
34 "WARN: PLIST:1: The bin/ directory should not have subdirectories.", 34 "WARN: PLIST:1: The bin/ directory should not have subdirectories.",
35 "ERROR: PLIST:3: Configuration files must not be registered in the PLIST.", 35 "ERROR: PLIST:3: Configuration files must not be registered in the PLIST.",
36 "ERROR: PLIST:4: RCD_SCRIPTS must not be registered in the PLIST.", 36 "ERROR: PLIST:4: RCD_SCRIPTS must not be registered in the PLIST.",
37 "ERROR: PLIST:6: \"info/dir\" must not be listed. Use install-info to add/remove an entry.", 37 "ERROR: PLIST:6: \"info/dir\" must not be listed. Use install-info to add/remove an entry.",
38 "WARN: PLIST:8: Redundant library found. The libtool library is in line 9.", 38 "WARN: PLIST:8: Redundant library found. The libtool library is in line 9.",
39 "WARN: PLIST:9: \"lib/libc.la\" should be sorted before \"lib/libc.so.6\".", 39 "WARN: PLIST:9: \"lib/libc.la\" should be sorted before \"lib/libc.so.6\".",
40 "WARN: PLIST:9: Packages that install libtool libraries should define USE_LIBTOOL.", 40 "WARN: PLIST:9: Packages that install libtool libraries should define USE_LIBTOOL.",
41 "WARN: PLIST:10: Preformatted manual page without unformatted one.", 41 "WARN: PLIST:10: Preformatted manual page without unformatted one.",
42 "WARN: PLIST:10: Preformatted manual pages should end in \".0\".", 
43 "WARN: PLIST:11: IMAKE_MANNEWSUFFIX is not meant to appear in PLISTs.", 42 "WARN: PLIST:11: IMAKE_MANNEWSUFFIX is not meant to appear in PLISTs.",
44 "WARN: PLIST:12: Please remove this line. It is no longer necessary.", 43 "WARN: PLIST:12: Please remove this line. It is no longer necessary.",
45 "ERROR: PLIST:14: The package Makefile must include \"../../graphics/gnome-icon-theme/buildlink3.mk\".", 44 "ERROR: PLIST:14: The package Makefile must include \"../../graphics/gnome-icon-theme/buildlink3.mk\".",
46 "WARN: PLIST:14: Packages that install icon theme files should set ICON_THEMES.", 45 "WARN: PLIST:14: Packages that install icon theme files should set ICON_THEMES.",
47 "ERROR: PLIST:15: Packages that install hicolor icons "+ 46 "ERROR: PLIST:15: Packages that install hicolor icons "+
48 "must include \"../../graphics/hicolor-icon-theme/buildlink3.mk\" in the Makefile.", 47 "must include \"../../graphics/hicolor-icon-theme/buildlink3.mk\" in the Makefile.",
49 "ERROR: PLIST:18: Duplicate filename \"share/tzinfo\", already appeared in line 17.", 48 "ERROR: PLIST:18: Duplicate filename \"share/tzinfo\", already appeared in line 17.",
50 "ERROR: PLIST:19: Invalid line type: /absolute") 49 "ERROR: PLIST:19: Invalid line type: /absolute")
51} 50}
52 51
53func (s *Suite) Test_CheckLinesPlist__single_file_no_comment(c *check.C) { 52func (s *Suite) Test_CheckLinesPlist__single_file_no_comment(c *check.C) {
54 t := s.Init(c) 53 t := s.Init(c)
55 54

cvs diff -r1.64 -r1.65 pkgsrc/pkgtools/pkglint/files/Attic/shell.go (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkglint/files/Attic/shell.go 2020/07/01 13:17:41 1.64
+++ pkgsrc/pkgtools/pkglint/files/Attic/shell.go 2021/08/14 09:46:11 1.65
@@ -267,27 +267,27 @@ func (scc *SimpleCommandChecker) checkAu @@ -267,27 +267,27 @@ func (scc *SimpleCommandChecker) checkAu
267 267
268 m, dirname := match1(arg, `^(?:\$\{DESTDIR\})?\$\{PREFIX(?:|:Q)\}/+([^/]\S*)$`) 268 m, dirname := match1(arg, `^(?:\$\{DESTDIR\})?\$\{PREFIX(?:|:Q)\}/+([^/]\S*)$`)
269 if !m { 269 if !m {
270 continue 270 continue
271 } 271 }
272 272
273 prefixRel := NewRelPathString(dirname).Clean() 273 prefixRel := NewRelPathString(dirname).Clean()
274 if prefixRel == "." { 274 if prefixRel == "." {
275 continue 275 continue
276 } 276 }
277 277
278 autoMkdirs := false 278 autoMkdirs := false
279 if scc.mklines.pkg != nil { 279 if scc.mklines.pkg != nil {
280 plistLine := scc.mklines.pkg.Plist.Dirs[prefixRel] 280 plistLine := scc.mklines.pkg.Plist.UnconditionalDirs[prefixRel]
281 if plistLine != nil && !containsVarUse(plistLine.Line.Text) { 281 if plistLine != nil && !containsVarUse(plistLine.Line.Text) {
282 autoMkdirs = true 282 autoMkdirs = true
283 } 283 }
284 } 284 }
285 285
286 if autoMkdirs { 286 if autoMkdirs {
287 scc.Notef("You can use AUTO_MKDIRS=yes or \"INSTALLATION_DIRS+= %s\" instead of %q.", 287 scc.Notef("You can use AUTO_MKDIRS=yes or \"INSTALLATION_DIRS+= %s\" instead of %q.",
288 prefixRel.String(), cmdname) 288 prefixRel.String(), cmdname)
289 scc.Explain( 289 scc.Explain(
290 "Many packages include a list of all needed directories in their", 290 "Many packages include a list of all needed directories in their",
291 "PLIST file.", 291 "PLIST file.",
292 "In such a case, you can just set AUTO_MKDIRS=yes and be done.", 292 "In such a case, you can just set AUTO_MKDIRS=yes and be done.",
293 "The pkgsrc infrastructure will then create all directories in advance.", 293 "The pkgsrc infrastructure will then create all directories in advance.",

cvs diff -r1.71 -r1.72 pkgsrc/pkgtools/pkglint/files/Attic/shell_test.go (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkglint/files/Attic/shell_test.go 2020/10/06 18:40:50 1.71
+++ pkgsrc/pkgtools/pkglint/files/Attic/shell_test.go 2021/08/14 09:46:11 1.72
@@ -381,27 +381,27 @@ func (s *Suite) Test_SimpleCommandChecke @@ -381,27 +381,27 @@ func (s *Suite) Test_SimpleCommandChecke
381 t.CheckOutput(diagnostics) 381 t.CheckOutput(diagnostics)
382 } 382 }
383 383
384 // AUTO_MKDIRS applies only when installing directories. 384 // AUTO_MKDIRS applies only when installing directories.
385 test("${RUN} ${INSTALL} -c ${WRKSRC}/file ${PREFIX}/bin/", 385 test("${RUN} ${INSTALL} -c ${WRKSRC}/file ${PREFIX}/bin/",
386 nil...) 386 nil...)
387 387
388 // TODO: Warn that ${INSTALL} -d can only handle a single directory. 388 // TODO: Warn that ${INSTALL} -d can only handle a single directory.
389 test("${RUN} ${INSTALL} -m 0755 -d ${PREFIX}/first ${PREFIX}/second", 389 test("${RUN} ${INSTALL} -m 0755 -d ${PREFIX}/first ${PREFIX}/second",
390 "NOTE: filename.mk:1: You can use \"INSTALLATION_DIRS+= first\" instead of \"${INSTALL} -d\".", 390 "NOTE: filename.mk:1: You can use \"INSTALLATION_DIRS+= first\" instead of \"${INSTALL} -d\".",
391 "NOTE: filename.mk:1: You can use \"INSTALLATION_DIRS+= second\" instead of \"${INSTALL} -d\".") 391 "NOTE: filename.mk:1: You can use \"INSTALLATION_DIRS+= second\" instead of \"${INSTALL} -d\".")
392 392
393 pkg = NewPackage(t.File("category/pkgbase")) 393 pkg = NewPackage(t.File("category/pkgbase"))
394 pkg.Plist.Dirs["share/pkgbase"] = &PlistLine{ 394 pkg.Plist.UnconditionalDirs["share/pkgbase"] = &PlistLine{
395 t.NewLine("PLIST", 123, "share/pkgbase/file"), 395 t.NewLine("PLIST", 123, "share/pkgbase/file"),
396 nil, 396 nil,
397 "share/pkgbase/file"} 397 "share/pkgbase/file"}
398 398
399 // A directory that is found in the PLIST. 399 // A directory that is found in the PLIST.
400 // TODO: Add a test for using this command inside a conditional; 400 // TODO: Add a test for using this command inside a conditional;
401 // the note should not appear then. 401 // the note should not appear then.
402 test("${RUN} ${INSTALL_DATA_DIR} share/pkgbase ${PREFIX}/share/pkgbase", 402 test("${RUN} ${INSTALL_DATA_DIR} share/pkgbase ${PREFIX}/share/pkgbase",
403 "NOTE: filename.mk:1: You can use AUTO_MKDIRS=yes or \"INSTALLATION_DIRS+= share/pkgbase\" "+ 403 "NOTE: filename.mk:1: You can use AUTO_MKDIRS=yes or \"INSTALLATION_DIRS+= share/pkgbase\" "+
404 "instead of \"${INSTALL_DATA_DIR}\".", 404 "instead of \"${INSTALL_DATA_DIR}\".",
405 "WARN: filename.mk:1: The INSTALL_*_DIR commands can only handle one directory at a time.") 405 "WARN: filename.mk:1: The INSTALL_*_DIR commands can only handle one directory at a time.")
406 406
407 // Directories from .for loops are too dynamic to be replaced with AUTO_MKDIRS. 407 // Directories from .for loops are too dynamic to be replaced with AUTO_MKDIRS.
@@ -968,27 +968,27 @@ func (s *Suite) Test_ShellLineChecker_Ch @@ -968,27 +968,27 @@ func (s *Suite) Test_ShellLineChecker_Ch
968 "done", 968 "done",
969 nil...) 969 nil...)
970 970
971 test("@cp from to", 971 test("@cp from to",
972 "WARN: filename.mk:1: The shell command \"cp\" should not be hidden.") 972 "WARN: filename.mk:1: The shell command \"cp\" should not be hidden.")
973 973
974 test("-cp from to", 974 test("-cp from to",
975 "WARN: filename.mk:1: Using a leading \"-\" to suppress errors is deprecated.") 975 "WARN: filename.mk:1: Using a leading \"-\" to suppress errors is deprecated.")
976 976
977 test("-${MKDIR} deeply/nested/subdir", 977 test("-${MKDIR} deeply/nested/subdir",
978 "WARN: filename.mk:1: Using a leading \"-\" to suppress errors is deprecated.") 978 "WARN: filename.mk:1: Using a leading \"-\" to suppress errors is deprecated.")
979 979
980 pkg = NewPackage(t.File("category/pkgbase")) 980 pkg = NewPackage(t.File("category/pkgbase"))
981 pkg.Plist.Dirs["share/pkgbase"] = &PlistLine{ 981 pkg.Plist.UnconditionalDirs["share/pkgbase"] = &PlistLine{
982 t.NewLine("PLIST", 123, "share/pkgbase/file"), 982 t.NewLine("PLIST", 123, "share/pkgbase/file"),
983 nil, 983 nil,
984 "share/pkgbase/file"} 984 "share/pkgbase/file"}
985 985
986 // A directory that is found in the PLIST. 986 // A directory that is found in the PLIST.
987 // TODO: Add a test for using this command inside a conditional; 987 // TODO: Add a test for using this command inside a conditional;
988 // the note should not appear then. 988 // the note should not appear then.
989 test("${RUN} ${INSTALL_DATA_DIR} share/pkgbase ${PREFIX}/share/pkgbase", 989 test("${RUN} ${INSTALL_DATA_DIR} share/pkgbase ${PREFIX}/share/pkgbase",
990 "NOTE: filename.mk:1: You can use AUTO_MKDIRS=yes or \"INSTALLATION_DIRS+= share/pkgbase\" "+ 990 "NOTE: filename.mk:1: You can use AUTO_MKDIRS=yes or \"INSTALLATION_DIRS+= share/pkgbase\" "+
991 "instead of \"${INSTALL_DATA_DIR}\".", 991 "instead of \"${INSTALL_DATA_DIR}\".",
992 "WARN: filename.mk:1: The INSTALL_*_DIR commands can only handle one directory at a time.") 992 "WARN: filename.mk:1: The INSTALL_*_DIR commands can only handle one directory at a time.")
993 993
994 // A directory that is not found in the PLIST. 994 // A directory that is not found in the PLIST.

cvs diff -r1.96 -r1.97 pkgsrc/pkgtools/pkglint/files/Attic/vartypecheck.go (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkglint/files/Attic/vartypecheck.go 2021/06/25 14:15:01 1.96
+++ pkgsrc/pkgtools/pkglint/files/Attic/vartypecheck.go 2021/08/14 09:46:11 1.97
@@ -1179,28 +1179,28 @@ func (cv *VartypeCheck) PrefixPathname() @@ -1179,28 +1179,28 @@ func (cv *VartypeCheck) PrefixPathname()
1179 cv.Errorf("The pathname %q in %s must be relative to ${PREFIX}.", 1179 cv.Errorf("The pathname %q in %s must be relative to ${PREFIX}.",
1180 cv.Value, cv.Varname) 1180 cv.Value, cv.Varname)
1181 return 1181 return
1182 } 1182 }
1183 1183
1184 cv.MkLine.ForEachUsedText(cv.Value, VucRunTime, func(varUse *MkVarUse, time VucTime) { 1184 cv.MkLine.ForEachUsedText(cv.Value, VucRunTime, func(varUse *MkVarUse, time VucTime) {
1185 varname := varUse.varname 1185 varname := varUse.varname
1186 if varname == "PKG_SYSCONFDIR" || varname == "VARBASE" { 1186 if varname == "PKG_SYSCONFDIR" || varname == "VARBASE" {
1187 cv.Errorf("%s must not be used in %s since it is not relative to PREFIX.", 1187 cv.Errorf("%s must not be used in %s since it is not relative to PREFIX.",
1188 varname, cv.Varname) 1188 varname, cv.Varname)
1189 } 1189 }
1190 }) 1190 })
1191 1191
1192 if m, manSubdir := match1(cv.Value, `^man/(.+)`); m { 1192 if hasPrefix(cv.Value, "man/") && cv.Varname != "INSTALLATION_DIRS" {
1193 from := "${PKGMANDIR}/" + manSubdir 1193 from := "${PKGMANDIR}/" + cv.Value[4:]
1194 fix := cv.Autofix() 1194 fix := cv.Autofix()
1195 fix.Warnf("Please use %q instead of %q.", from, cv.Value) 1195 fix.Warnf("Please use %q instead of %q.", from, cv.Value)
1196 fix.Replace(cv.Value, from) 1196 fix.Replace(cv.Value, from)
1197 fix.Apply() 1197 fix.Apply()
1198 } 1198 }
1199} 1199}
1200 1200
1201func (cv *VartypeCheck) PythonDependency() { 1201func (cv *VartypeCheck) PythonDependency() {
1202 if cv.Value != cv.ValueNoVar { 1202 if cv.Value != cv.ValueNoVar {
1203 cv.Warnf("Python dependencies should not contain variables.") 1203 cv.Warnf("Python dependencies should not contain variables.")
1204 } else if !matches(cv.ValueNoVar, `^[+\-.0-9A-Z_a-z]+(?:|:link|:build|:test|:tool)$`) { 1204 } else if !matches(cv.ValueNoVar, `^[+\-.0-9A-Z_a-z]+(?:|:link|:build|:test|:tool)$`) {
1205 cv.Warnf("Invalid Python dependency %q.", cv.Value) 1205 cv.Warnf("Invalid Python dependency %q.", cv.Value)
1206 cv.Explain( 1206 cv.Explain(

cvs diff -r1.87 -r1.88 pkgsrc/pkgtools/pkglint/files/Attic/vartypecheck_test.go (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkglint/files/Attic/vartypecheck_test.go 2021/06/06 11:46:43 1.87
+++ pkgsrc/pkgtools/pkglint/files/Attic/vartypecheck_test.go 2021/08/14 09:46:11 1.88
@@ -1813,26 +1813,33 @@ func (s *Suite) Test_VartypeCheck_Prefix @@ -1813,26 +1813,33 @@ func (s *Suite) Test_VartypeCheck_Prefix
1813 "Please use \"${PKGMANDIR}/man1\" instead of \"man/man1\".", 1813 "Please use \"${PKGMANDIR}/man1\" instead of \"man/man1\".",
1814 "ERROR: filename.mk:3: The pathname \"/absolute\" in PKGMANDIR "+ 1814 "ERROR: filename.mk:3: The pathname \"/absolute\" in PKGMANDIR "+
1815 "must be relative to ${PREFIX}.") 1815 "must be relative to ${PREFIX}.")
1816 1816
1817 vt.Varname("INSTALLATION_DIRS") 1817 vt.Varname("INSTALLATION_DIRS")
1818 vt.Values( 1818 vt.Values(
1819 "bin ${PKG_SYSCONFDIR} ${VARBASE}") 1819 "bin ${PKG_SYSCONFDIR} ${VARBASE}")
1820 1820
1821 vt.Output( 1821 vt.Output(
1822 "ERROR: filename.mk:11: PKG_SYSCONFDIR must not be used in INSTALLATION_DIRS "+ 1822 "ERROR: filename.mk:11: PKG_SYSCONFDIR must not be used in INSTALLATION_DIRS "+
1823 "since it is not relative to PREFIX.", 1823 "since it is not relative to PREFIX.",
1824 "ERROR: filename.mk:11: VARBASE must not be used in INSTALLATION_DIRS "+ 1824 "ERROR: filename.mk:11: VARBASE must not be used in INSTALLATION_DIRS "+
1825 "since it is not relative to PREFIX.") 1825 "since it is not relative to PREFIX.")
 1826
 1827 // INSTALLATION_DIRS automatically replaces "man" with "${PKGMANDIR}".
 1828 vt.Varname("INSTALLATION_DIRS")
 1829 vt.Values(
 1830 "man/man1")
 1831
 1832 vt.OutputEmpty()
1826} 1833}
1827 1834
1828func (s *Suite) Test_VartypeCheck_PythonDependency(c *check.C) { 1835func (s *Suite) Test_VartypeCheck_PythonDependency(c *check.C) {
1829 vt := NewVartypeCheckTester(s.Init(c), BtPythonDependency) 1836 vt := NewVartypeCheckTester(s.Init(c), BtPythonDependency)
1830 1837
1831 vt.Varname("PYTHON_VERSIONED_DEPENDENCIES") 1838 vt.Varname("PYTHON_VERSIONED_DEPENDENCIES")
1832 vt.Values( 1839 vt.Values(
1833 "cairo", 1840 "cairo",
1834 "${PYDEP}", 1841 "${PYDEP}",
1835 "cairo,X") 1842 "cairo,X")
1836 1843
1837 vt.Output( 1844 vt.Output(
1838 "WARN: filename.mk:2: Python dependencies should not contain variables.", 1845 "WARN: filename.mk:2: Python dependencies should not contain variables.",