diff options
author | rillig <rillig@pkgsrc.org> | 2016-01-26 21:10:42 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2016-01-26 21:10:42 +0000 |
commit | 01f9ff90ac75f4dee55cd66b3d49734ac893b05c (patch) | |
tree | 3e38af1403b16e67747c32842be67ae00c6e01ba /pkgtools/pkglint/files | |
parent | 1b2e44e869e088742db3235dae2001c63ba4c1fc (diff) | |
download | pkgsrc-01f9ff90ac75f4dee55cd66b3d49734ac893b05c.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/pkglint/files')
-rw-r--r-- | pkgtools/pkglint/files/main.go | 18 | ||||
-rw-r--r-- | pkgtools/pkglint/files/mklines.go | 9 | ||||
-rw-r--r-- | pkgtools/pkglint/files/package.go | 12 | ||||
-rw-r--r-- | pkgtools/pkglint/files/package_test.go | 23 |
4 files changed, 49 insertions, 13 deletions
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, "") +} |