summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig>2016-01-26 21:10:42 +0000
committerrillig <rillig>2016-01-26 21:10:42 +0000
commitb79b67934ef57f49116499b6576308030ee8e25b (patch)
tree3e38af1403b16e67747c32842be67ae00c6e01ba /pkgtools
parent12e0044c887cf91687692b73d7500bfae19b3f45 (diff)
downloadpkgsrc-b79b67934ef57f49116499b6576308030ee8e25b.tar.gz
Updated pkglint to 5.3.3
Changes since 5.3.2: * The -e, -fs, -F options are advertised even when no warnings and errors occurred. In such a case, there were only notes, and some of these can also be autofixed. * Special handling for autoconf{,213} tools, since mentioning these in USE_TOOLS makes available more than just one tool command. * Downgrades from 1.0nb17 to 1.0 are no longer flagged as warnings. * Files in /wip/mk/ are scanned like all other files, to prevent warnings about undefined or unused variables.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/Makefile4
-rw-r--r--pkgtools/pkglint/files/main.go18
-rw-r--r--pkgtools/pkglint/files/mklines.go9
-rw-r--r--pkgtools/pkglint/files/package.go12
-rw-r--r--pkgtools/pkglint/files/package_test.go23
5 files changed, 51 insertions, 15 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile
index 9f6c62d8936..10b12094f7f 100644
--- a/pkgtools/pkglint/Makefile
+++ b/pkgtools/pkglint/Makefile
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.478 2016/01/24 02:03:28 rillig Exp $
+# $NetBSD: Makefile,v 1.479 2016/01/26 21:10:42 rillig Exp $
-PKGNAME= pkglint-5.3.2
+PKGNAME= pkglint-5.3.3
DISTFILES= # none
CATEGORIES= pkgtools
diff --git a/pkgtools/pkglint/files/main.go b/pkgtools/pkglint/files/main.go
index 5c5768af71a..9d39e47f869 100644
--- a/pkgtools/pkglint/files/main.go
+++ b/pkgtools/pkglint/files/main.go
@@ -164,17 +164,17 @@ func (pkglint *Pkglint) PrintSummary() {
fmt.Fprintf(G.logOut, "%d %s and %d %s found.\n",
G.errors, ifelseStr(G.errors == 1, "error", "errors"),
G.warnings, ifelseStr(G.warnings == 1, "warning", "warnings"))
- if G.explanationsAvailable && !G.opts.Explain {
- fmt.Fprint(G.logOut, "(Run \"pkglint -e\" to show explanations.)\n")
- }
- if G.autofixAvailable && !G.opts.PrintAutofix && !G.opts.Autofix {
- fmt.Fprint(G.logOut, "(Run \"pkglint -fs\" to show what can be fixed automatically.)\n")
- }
- if G.autofixAvailable && !G.opts.Autofix {
- fmt.Fprint(G.logOut, "(Run \"pkglint -F\" to automatically fix some issues.)\n")
- }
} else {
io.WriteString(G.logOut, "looks fine.\n")
}
+ if G.explanationsAvailable && !G.opts.Explain {
+ fmt.Fprint(G.logOut, "(Run \"pkglint -e\" to show explanations.)\n")
+ }
+ if G.autofixAvailable && !G.opts.PrintAutofix && !G.opts.Autofix {
+ fmt.Fprint(G.logOut, "(Run \"pkglint -fs\" to show what can be fixed automatically.)\n")
+ }
+ if G.autofixAvailable && !G.opts.Autofix {
+ fmt.Fprint(G.logOut, "(Run \"pkglint -F\" to automatically fix some issues.)\n")
+ }
}
}
diff --git a/pkgtools/pkglint/files/mklines.go b/pkgtools/pkglint/files/mklines.go
index 0e0146e08f9..be9ac0ff354 100644
--- a/pkgtools/pkglint/files/mklines.go
+++ b/pkgtools/pkglint/files/mklines.go
@@ -176,7 +176,14 @@ func (mklines *MkLines) determineDefinedVariables() {
}
case "USE_TOOLS":
- for _, tool := range splitOnSpace(mkline.Value()) {
+ tools := mkline.Value()
+ if matches(tools, `\bautoconf213\b`) {
+ tools += " autoconf autoheader-2.13 autom4te-2.13 autoreconf-2.13 autoscan-2.13 autoupdate-2.13 ifnames-2.13"
+ }
+ if matches(tools, `\bautoconf\b`) {
+ tools += " autoheader autom4te autoreconf autoscan autoupdate ifnames"
+ }
+ for _, tool := range splitOnSpace(tools) {
tool = strings.Split(tool, ":")[0]
mklines.tools[tool] = true
if G.opts.DebugMisc {
diff --git a/pkgtools/pkglint/files/package.go b/pkgtools/pkglint/files/package.go
index 75b0d972abd..527d49f7be0 100644
--- a/pkgtools/pkglint/files/package.go
+++ b/pkgtools/pkglint/files/package.go
@@ -82,8 +82,14 @@ func (pkg *Package) checkPossibleDowngrade() {
}
if change.Action == "Updated" {
- if pkgverCmp(pkgversion, change.Version) < 0 {
- mkline.Warn2("The package is being downgraded from %s to %s", change.Version, pkgversion)
+ changeVersion := regcomp(`nb\d+$`).ReplaceAllString(change.Version, "")
+ if pkgverCmp(pkgversion, changeVersion) < 0 {
+ mkline.Line.Warnf("The package is being downgraded from %s (see %s) to %s", change.Version, change.Line.ReferenceFrom(mkline.Line), pkgversion)
+ Explain4(
+ "The files in doc/CHANGES-*, in which all version changes are",
+ "recorded, have a higher version number than what the package says.",
+ "This is unusual, since packages are typically upgraded instead of",
+ "downgraded.")
}
}
}
@@ -288,7 +294,7 @@ func readMakefile(fname string, mainLines *MkLines, allLines *MkLines, including
G.Pkg.seenMakefileCommon = true
}
- if !contains(incDir, "/mk/") || strings.HasSuffix(includeFile, "/mk/haskell.mk") {
+ if !contains(incDir, "/mk/") || strings.HasSuffix(includeFile, "/mk/haskell.mk") || contains(incDir, "/wip/mk/") {
dirname, _ := path.Split(fname)
dirname = cleanpath(dirname)
diff --git a/pkgtools/pkglint/files/package_test.go b/pkgtools/pkglint/files/package_test.go
index 98672229767..04903ee7673 100644
--- a/pkgtools/pkglint/files/package_test.go
+++ b/pkgtools/pkglint/files/package_test.go
@@ -118,3 +118,26 @@ func (s *Suite) TestPackage_DetermineEffectivePkgVars_Precedence(c *check.C) {
c.Check(pkg.EffectivePkgname, equals, "pkgname-1.0nb13")
c.Check(pkg.EffectivePkgversion, equals, "1.0")
}
+
+func (s *Suite) TestPackage_CheckPossibleDowngrade(c *check.C) {
+ G.Pkg = NewPackage("category/pkgbase")
+ G.Pkg.EffectivePkgname = "package-1.0nb15"
+ G.Pkg.EffectivePkgnameLine = NewMkLine(NewLine("Makefile", 5, "PKGNAME=dummy", nil))
+ G.globalData.LastChange = map[string]*Change{
+ "category/pkgbase": &Change{
+ Action: "Updated",
+ Version: "1.8",
+ Line: NewLine("doc/CHANGES", 116, "dummy", nil),
+ },
+ }
+
+ G.Pkg.checkPossibleDowngrade()
+
+ c.Check(s.Output(), equals, "WARN: Makefile:5: The package is being downgraded from 1.8 (see doc/CHANGES:116) to 1.0nb15\n")
+
+ G.globalData.LastChange["category/pkgbase"].Version = "1.0nb22"
+
+ G.Pkg.checkPossibleDowngrade()
+
+ c.Check(s.Output(), equals, "")
+}