pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint pkgtools/pkglint: update to 19.3.13
details: https://anonhg.NetBSD.org/pkgsrc/rev/ca9eb7e720bf
branches: trunk
changeset: 405604:ca9eb7e720bf
user: rillig <rillig%pkgsrc.org@localhost>
date: Mon Dec 02 23:32:09 2019 +0000
description:
pkgtools/pkglint: update to 19.3.13
Changes since 19.3.12:
The command line option -Wspace has been removed. Warnings and notes
about whitespace are now generated by default and cannot be switched
off. This is to ensure a consistent visual appearance of the package
Makefiles.
Shell programs that are indented unnecessarily deep generate a note by
default now. Before, the option -Wall was necessary to get these notes.
The check for unintended comments in multi-line shell programs is now
enabled again. It had been disabled some time ago as byproduct of a bug
fix in the shell parser.
The check for unique buildlink3 package identifiers now also works if
pkglint is run from a package directory instead of the pkgsrc root
directory.
diffstat:
pkgtools/pkglint/Makefile | 4 +-
pkgtools/pkglint/PLIST | 3 +-
pkgtools/pkglint/files/alternatives.go | 2 +-
pkgtools/pkglint/files/autofix.go | 6 +-
pkgtools/pkglint/files/buildlink3.go | 3 +-
pkgtools/pkglint/files/buildlink3_test.go | 28 +-
pkgtools/pkglint/files/category.go | 6 +-
pkgtools/pkglint/files/category_test.go | 4 +-
pkgtools/pkglint/files/check_test.go | 204 +++--
pkgtools/pkglint/files/distinfo.go | 12 +-
pkgtools/pkglint/files/distinfo_test.go | 3 +-
pkgtools/pkglint/files/files.go | 8 +-
pkgtools/pkglint/files/files_test.go | 22 +
pkgtools/pkglint/files/histogram/histogram.go | 2 +-
pkgtools/pkglint/files/intqa/qa.go | 42 +-
pkgtools/pkglint/files/intqa/qa_test.go | 30 +-
pkgtools/pkglint/files/licenses.go | 7 +-
pkgtools/pkglint/files/line.go | 17 +-
pkgtools/pkglint/files/linelexer.go | 23 +-
pkgtools/pkglint/files/linelexer_test.go | 15 +
pkgtools/pkglint/files/lines.go | 4 +-
pkgtools/pkglint/files/logging.go | 15 +-
pkgtools/pkglint/files/mklexer.go | 2 +-
pkgtools/pkglint/files/mkline.go | 36 +-
pkgtools/pkglint/files/mkline_test.go | 26 +-
pkgtools/pkglint/files/mklinechecker.go | 30 +-
pkgtools/pkglint/files/mklinechecker_test.go | 52 +-
pkgtools/pkglint/files/mklineparser_test.go | 8 +-
pkgtools/pkglint/files/mklines.go | 2 +-
pkgtools/pkglint/files/mklines_test.go | 85 +-
pkgtools/pkglint/files/mkparser.go | 2 +-
pkgtools/pkglint/files/mkshparser_test.go | 2 +-
pkgtools/pkglint/files/options_test.go | 31 +-
pkgtools/pkglint/files/package.go | 103 +-
pkgtools/pkglint/files/package_test.go | 89 +-
pkgtools/pkglint/files/patches.go | 2 +-
pkgtools/pkglint/files/path.go | 306 ++++++-
pkgtools/pkglint/files/path_test.go | 809 ++++++++++++++++++-
pkgtools/pkglint/files/pkglint.0 | 2 -
pkgtools/pkglint/files/pkglint.1 | 4 +-
pkgtools/pkglint/files/pkglint.go | 88 +-
pkgtools/pkglint/files/pkglint_test.go | 14 +-
pkgtools/pkglint/files/pkgsrc.go | 84 +-
pkgtools/pkglint/files/pkgsrc_test.go | 19 +-
pkgtools/pkglint/files/plist.go | 11 +-
pkgtools/pkglint/files/redundantscope.go | 8 +-
pkgtools/pkglint/files/redundantscope_test.go | 4 +-
pkgtools/pkglint/files/shell.go | 92 +-
pkgtools/pkglint/files/shell_test.go | 187 +++-
pkgtools/pkglint/files/shtokenizer.go | 9 +-
pkgtools/pkglint/files/substcontext_test.go | 122 +-
pkgtools/pkglint/files/testnames_test.go | 18 -
pkgtools/pkglint/files/textproc/lexer_bench_test.go | 2 +-
pkgtools/pkglint/files/tools_test.go | 22 +-
pkgtools/pkglint/files/toplevel.go | 8 +-
pkgtools/pkglint/files/trace/tracing_test.go | 34 +-
pkgtools/pkglint/files/util.go | 101 +-
pkgtools/pkglint/files/util_test.go | 75 +-
pkgtools/pkglint/files/varalignblock.go | 10 +-
pkgtools/pkglint/files/vardefs.go | 46 +-
pkgtools/pkglint/files/vardefs_test.go | 6 +-
pkgtools/pkglint/files/vartype.go | 6 +-
pkgtools/pkglint/files/vartypecheck.go | 22 +-
pkgtools/pkglint/files/vartypecheck_test.go | 41 +-
64 files changed, 2095 insertions(+), 985 deletions(-)
diffs (truncated from 6204 to 300 lines):
diff -r 810e6dca8cac -r ca9eb7e720bf pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Mon Dec 02 16:42:19 2019 +0000
+++ b/pkgtools/pkglint/Makefile Mon Dec 02 23:32:09 2019 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.612 2019/11/30 20:35:11 rillig Exp $
+# $NetBSD: Makefile,v 1.613 2019/12/02 23:32:09 rillig Exp $
-PKGNAME= pkglint-19.3.12
+PKGNAME= pkglint-19.3.13
CATEGORIES= pkgtools
DISTNAME= tools
MASTER_SITES= ${MASTER_SITE_GITHUB:=golang/}
diff -r 810e6dca8cac -r ca9eb7e720bf pkgtools/pkglint/PLIST
--- a/pkgtools/pkglint/PLIST Mon Dec 02 16:42:19 2019 +0000
+++ b/pkgtools/pkglint/PLIST Mon Dec 02 23:32:09 2019 +0000
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.18 2019/11/27 22:10:06 rillig Exp $
+@comment $NetBSD: PLIST,v 1.19 2019/12/02 23:32:09 rillig Exp $
bin/pkglint
gopkg/pkg/${GO_PLATFORM}/netbsd.org/pkglint.a
gopkg/pkg/${GO_PLATFORM}/netbsd.org/pkglint/getopt.a
@@ -105,7 +105,6 @@
gopkg/src/netbsd.org/pkglint/shtypes_test.go
gopkg/src/netbsd.org/pkglint/substcontext.go
gopkg/src/netbsd.org/pkglint/substcontext_test.go
-gopkg/src/netbsd.org/pkglint/testnames_test.go
gopkg/src/netbsd.org/pkglint/textproc/lexer.go
gopkg/src/netbsd.org/pkglint/textproc/lexer_bench_test.go
gopkg/src/netbsd.org/pkglint/textproc/lexer_test.go
diff -r 810e6dca8cac -r ca9eb7e720bf pkgtools/pkglint/files/alternatives.go
--- a/pkgtools/pkglint/files/alternatives.go Mon Dec 02 16:42:19 2019 +0000
+++ b/pkgtools/pkglint/files/alternatives.go Mon Dec 02 23:32:09 2019 +0000
@@ -5,7 +5,7 @@
"strings"
)
-func CheckFileAlternatives(filename Path) {
+func CheckFileAlternatives(filename CurrPath) {
lines := Load(filename, NotEmpty|LogErrors)
if lines == nil {
return
diff -r 810e6dca8cac -r ca9eb7e720bf pkgtools/pkglint/files/autofix.go
--- a/pkgtools/pkglint/files/autofix.go Mon Dec 02 16:42:19 2019 +0000
+++ b/pkgtools/pkglint/files/autofix.go Mon Dec 02 23:32:09 2019 +0000
@@ -443,12 +443,12 @@
if G.Testing {
abs := G.Abs(lines.Filename)
- absTmp := G.Abs(NewPathSlash(os.TempDir()))
+ absTmp := G.Abs(NewCurrPathSlash(os.TempDir()))
assertf(abs.HasPrefixPath(absTmp), "%q must be inside %q", abs, absTmp)
}
- changes := make(map[Path][]string)
- changed := make(map[Path]bool)
+ changes := make(map[CurrPath][]string)
+ changed := make(map[CurrPath]bool)
for _, line := range lines.Lines {
chlines := changes[line.Filename]
if fix := line.autofix; fix != nil {
diff -r 810e6dca8cac -r ca9eb7e720bf pkgtools/pkglint/files/buildlink3.go
--- a/pkgtools/pkglint/files/buildlink3.go Mon Dec 02 16:42:19 2019 +0000
+++ b/pkgtools/pkglint/files/buildlink3.go Mon Dec 02 23:32:09 2019 +0000
@@ -99,7 +99,8 @@
return
}
- base, name := trimCommon(pkgbase, mkline.Filename.Dir().Base())
+ dirname := G.Pkgsrc.ToRel(mkline.Filename.DirNoClean()).Base()
+ base, name := trimCommon(pkgbase, dirname)
if base == "" && matches(name, `^(\d*|-cvs|-fossil|-git|-hg|-svn|-devel|-snapshot)$`) {
return
}
diff -r 810e6dca8cac -r ca9eb7e720bf pkgtools/pkglint/files/buildlink3_test.go
--- a/pkgtools/pkglint/files/buildlink3_test.go Mon Dec 02 16:42:19 2019 +0000
+++ b/pkgtools/pkglint/files/buildlink3_test.go Mon Dec 02 23:32:09 2019 +0000
@@ -599,7 +599,7 @@
G.InterPackage.Enable()
- test := func(pkgbase string, pkgpath Path, diagnostics ...string) {
+ test := func(pkgbase string, pkgpath RelPath, diagnostics ...string) {
mkline := t.NewMkLine(t.File(pkgpath+"/buildlink3.mk"), 123, "")
(*Buildlink3Checker).checkUniquePkgbase(nil, pkgbase, mkline)
@@ -611,7 +611,7 @@
test("php", "lang/php56",
nil...)
- // No warning since "php" is a valid buildlink3 basename for "php56".
+ // No warning since "php" is a valid buildlink3 basename for "php72".
test("php", "lang/php72",
nil...)
@@ -647,6 +647,30 @@
nil...)
}
+func (s *Suite) Test_Buildlink3Checker_checkUniquePkgbase__chdir(c *check.C) {
+ t := s.Init(c)
+
+ G.InterPackage.Enable()
+ t.Chdir("lang/php56")
+
+ test := func(pkgbase string, path CurrPath, diagnostics ...string) {
+ mkline := t.NewMkLine(path.JoinNoClean("buildlink3.mk"), 123, "")
+
+ (*Buildlink3Checker).checkUniquePkgbase(nil, pkgbase, mkline)
+
+ t.CheckOutput(diagnostics)
+ }
+
+ test("php", "../../lang/php72",
+ nil...)
+
+ // Using the identifier "php" is ok in the current directory since
+ // its relative path from the pkgsrc root is "lang/php56", which
+ // starts with "php" as well.
+ test("php", ".",
+ nil...)
+}
+
func (s *Suite) Test_Buildlink3Checker_checkSecondParagraph__missing_mkbase(c *check.C) {
t := s.Init(c)
diff -r 810e6dca8cac -r ca9eb7e720bf pkgtools/pkglint/files/category.go
--- a/pkgtools/pkglint/files/category.go Mon Dec 02 16:42:19 2019 +0000
+++ b/pkgtools/pkglint/files/category.go Mon Dec 02 23:32:09 2019 +0000
@@ -6,7 +6,7 @@
"strings"
)
-func CheckdirCategory(dir Path) {
+func CheckdirCategory(dir CurrPath) {
if trace.Tracing {
defer trace.Call(dir)()
}
@@ -64,7 +64,7 @@
for !mlex.EOF() {
mkline := mlex.CurrentMkLine()
- if (mkline.IsVarassignMaybeCommented()) && mkline.Varname() == "SUBDIR" {
+ if mkline.IsVarassignMaybeCommented() && mkline.Varname() == "SUBDIR" {
mlex.Skip()
name := mkline.Value() // TODO: Maybe NewPath here already
@@ -155,7 +155,7 @@
mklines.SaveAutofixChanges()
if G.Opts.Recursive {
- var recurseInto []Path
+ var recurseInto []CurrPath
for _, msub := range mSubdirs {
if !msub.line.IsCommentedVarassign() {
recurseInto = append(recurseInto, dir.JoinNoClean(msub.name))
diff -r 810e6dca8cac -r ca9eb7e720bf pkgtools/pkglint/files/category_test.go
--- a/pkgtools/pkglint/files/category_test.go Mon Dec 02 16:42:19 2019 +0000
+++ b/pkgtools/pkglint/files/category_test.go Mon Dec 02 23:32:09 2019 +0000
@@ -208,12 +208,12 @@
// It is only removed in Pkglint.Main, therefore it stays there even
// after the call to CheckdirCategory. This is a bit unrealistic,
// but close enough for this test.
- t.CheckDeepEquals(G.Todo.entries, []Path{"."})
+ t.CheckDeepEquals(G.Todo.entries, []CurrPath{"."})
CheckdirCategory(".")
t.CheckOutputEmpty()
- t.CheckDeepEquals(G.Todo.entries, []Path{"./package", "."})
+ t.CheckDeepEquals(G.Todo.entries, []CurrPath{"./package", "."})
}
// Ensures that a directory in the file system can be added at the very
diff -r 810e6dca8cac -r ca9eb7e720bf pkgtools/pkglint/files/check_test.go
--- a/pkgtools/pkglint/files/check_test.go Mon Dec 02 16:42:19 2019 +0000
+++ b/pkgtools/pkglint/files/check_test.go Mon Dec 02 23:32:09 2019 +0000
@@ -5,6 +5,7 @@
"fmt"
"io"
"io/ioutil"
+ "netbsd.org/pkglint/intqa"
"netbsd.org/pkglint/regex"
"os"
"regexp"
@@ -74,7 +75,7 @@
prevdir, err := os.Getwd()
assertNil(err, "Cannot get current working directory: %s", err)
- t.prevdir = prevdir
+ t.prevdir = NewCurrPathString(prevdir)
// No longer usable; see https://github.com/go-check/check/issues/22
t.c = nil
@@ -84,7 +85,7 @@
t := s.Tester
t.c = nil // No longer usable; see https://github.com/go-check/check/issues/22
- err := os.Chdir(t.prevdir)
+ err := os.Chdir(t.prevdir.String())
assertNil(err, "Cannot chdir back to previous dir: %s", err)
if t.seenSetupPkgsrc > 0 && !t.seenFinish && !t.seenMain {
@@ -98,6 +99,19 @@
G = unusablePkglint()
}
+// Ensures that all test names follow a common naming scheme:
+//
+// Test_${Type}_${Method}__${description_using_underscores}
+func (s *Suite) Test__qa(c *check.C) {
+ ck := intqa.NewQAChecker(c.Errorf)
+ ck.Configure("*", "*", "*", -intqa.EMissingTest)
+ ck.Configure("path.go", "*", "*", +intqa.EMissingTest)
+ ck.Configure("*yacc.go", "*", "*", intqa.ENone)
+ ck.Configure("*", "*", "", -intqa.EMissingTest)
+ ck.Configure("*.go", "Suite", "*", -intqa.EMethodsSameFile)
+ ck.Check()
+}
+
var _ = check.Suite(new(Suite))
func Test(t *testing.T) { check.TestingT(t) }
@@ -113,9 +127,9 @@
stdout bytes.Buffer
stderr bytes.Buffer
- tmpdir Path
- prevdir string // The current working directory before the test started
- relCwd Path // See Tester.Chdir
+ tmpdir CurrPath
+ prevdir CurrPath // The current working directory before the test started
+ cwd RelPath // relative to tmpdir; see Tester.Chdir
seenSetUpCommandLine bool
seenSetupPkgsrc int
@@ -193,33 +207,33 @@
// The file is then read in, without interpreting line continuations.
//
// See SetUpFileMkLines for loading a Makefile fragment.
-func (t *Tester) SetUpFileLines(relativeFileName Path, lines ...string) *Lines {
- filename := t.CreateFileLines(relativeFileName, lines...)
- return Load(filename, MustSucceed)
+func (t *Tester) SetUpFileLines(filename RelPath, lines ...string) *Lines {
+ abs := t.CreateFileLines(filename, lines...)
+ return Load(abs, MustSucceed)
}
// SetUpFileLines creates a temporary file and writes the given lines to it.
// The file is then read in, handling line continuations for Makefiles.
//
// See SetUpFileLines for loading an ordinary file.
-func (t *Tester) SetUpFileMkLines(relativeFileName Path, lines ...string) *MkLines {
- filename := t.CreateFileLines(relativeFileName, lines...)
- return LoadMk(filename, MustSucceed)
+func (t *Tester) SetUpFileMkLines(filename RelPath, lines ...string) *MkLines {
+ abs := t.CreateFileLines(filename, lines...)
+ return LoadMk(abs, MustSucceed)
}
// LoadMkInclude loads the given Makefile fragment and all the files it includes,
// merging all the lines into a single MkLines object.
//
// This is useful for testing code related to Package.readMakefile.
-func (t *Tester) LoadMkInclude(relativeFileName Path) *MkLines {
+func (t *Tester) LoadMkInclude(filename RelPath) *MkLines {
var lines []*Line
// TODO: Include files with multiple-inclusion guard only once.
// TODO: Include files without multiple-inclusion guard as often as needed.
// TODO: Set an upper limit, to prevent denial of service.
- var load func(filename Path)
- load = func(filename Path) {
+ var load func(filename CurrPath)
+ load = func(filename CurrPath) {
for _, mkline := range NewMkLines(Load(filename, MustSucceed)).mklines {
lines = append(lines, mkline.Line)
@@ -229,11 +243,11 @@
}
}
- load(t.File(relativeFileName))
+ load(t.File(filename))
// This assumes that the test files do not contain parse errors.
// Otherwise the diagnostics would appear twice.
- return NewMkLines(NewLines(t.File(relativeFileName), lines))
+ return NewMkLines(NewLines(t.File(filename), lines))
}
// SetUpPkgsrc sets up a minimal but complete pkgsrc installation in the
@@ -319,8 +333,8 @@
// SetUpCategory makes the given category valid by creating a dummy Makefile.
// After that, it can be mentioned in the CATEGORIES variable of a package.
-func (t *Tester) SetUpCategory(name Path) {
- assert(name.Count() == 1)
+func (t *Tester) SetUpCategory(name RelPath) {
+ assert(G.Pkgsrc.ToRel(t.File(name)).Count() == 1)
Home |
Main Index |
Thread Index |
Old Index