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 5.7.17
details: https://anonhg.NetBSD.org/pkgsrc/rev/53eb6b27ca29
branches: trunk
changeset: 398795:53eb6b27ca29
user: rillig <rillig%pkgsrc.org@localhost>
date: Tue Jul 30 18:16:13 2019 +0000
description:
pkgtools/pkglint: update to 5.7.17
Changes since 5.7.16:
* The warnings for doc/CHANGES are only enabled when the -Cglobal option
is given. This is to avoid warnings that are unrelated to the package
that is being checked.
diffstat:
pkgtools/pkglint/Makefile | 4 +-
pkgtools/pkglint/files/check_test.go | 16 +++++++--
pkgtools/pkglint/files/mkline_test.go | 6 +-
pkgtools/pkglint/files/mklines_test.go | 1 -
pkgtools/pkglint/files/pkgsrc.go | 2 +-
pkgtools/pkglint/files/pkgsrc_test.go | 45 +++++++++++++++++++++++++++-
pkgtools/pkglint/files/vartypecheck.go | 4 +-
pkgtools/pkglint/files/vartypecheck_test.go | 11 +++++-
8 files changed, 72 insertions(+), 17 deletions(-)
diffs (229 lines):
diff -r 306c69aa00a1 -r 53eb6b27ca29 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Tue Jul 30 16:07:36 2019 +0000
+++ b/pkgtools/pkglint/Makefile Tue Jul 30 18:16:13 2019 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.588 2019/07/14 21:25:47 rillig Exp $
+# $NetBSD: Makefile,v 1.589 2019/07/30 18:16:13 rillig Exp $
-PKGNAME= pkglint-5.7.16
+PKGNAME= pkglint-5.7.17
CATEGORIES= pkgtools
DISTNAME= tools
MASTER_SITES= ${MASTER_SITE_GITHUB:=golang/}
diff -r 306c69aa00a1 -r 53eb6b27ca29 pkgtools/pkglint/files/check_test.go
--- a/pkgtools/pkglint/files/check_test.go Tue Jul 30 16:07:36 2019 +0000
+++ b/pkgtools/pkglint/files/check_test.go Tue Jul 30 18:16:13 2019 +0000
@@ -68,7 +68,8 @@
G.Pkgsrc = NewPkgsrc(t.File("."))
t.c = c
- t.SetUpCommandLine("-Wall") // To catch duplicate warnings
+ t.SetUpCommandLine("-Wall") // To catch duplicate warnings
+ t.seenSetUpCommandLine = false // This default call doesn't count.
// To improve code coverage and ensure that trace.Result works
// in all cases. The latter cannot be ensured at compile time.
@@ -131,9 +132,10 @@
prevdir string // The current working directory before the test started
relCwd string // See Tester.Chdir
- seenSetupPkgsrc int
- seenFinish bool
- seenMain bool
+ seenSetUpCommandLine bool
+ seenSetupPkgsrc int
+ seenFinish bool
+ seenMain bool
}
// SetUpCommandLine simulates a command line for the remainder of the test.
@@ -159,6 +161,8 @@
// It also reveals diagnostics that are logged multiple times per
// line and thus can easily get annoying to the pkgsrc developers.
G.Logger.Opts.LogVerbose = true
+
+ t.seenSetUpCommandLine = true
}
// SetUpVartypes registers a few hundred variables like MASTER_SITES,
@@ -673,6 +677,10 @@
t.Errorf("Calling t.FinishSetup() before t.Main() is redundant " +
"since t.Main() loads the pkgsrc infrastructure.")
}
+ if t.seenSetUpCommandLine {
+ t.Errorf("Calling t.SetupCommandLine() before t.Main() is redundant " +
+ "since t.Main() accepts the command line options directly.")
+ }
t.seenMain = true
diff -r 306c69aa00a1 -r 53eb6b27ca29 pkgtools/pkglint/files/mkline_test.go
--- a/pkgtools/pkglint/files/mkline_test.go Tue Jul 30 16:07:36 2019 +0000
+++ b/pkgtools/pkglint/files/mkline_test.go Tue Jul 30 18:16:13 2019 +0000
@@ -1514,17 +1514,17 @@
t := s.Init(c)
t.SetUpVartypes()
- mklines := t.SetUpFileMkLines("multimedia/totem/bla.mk",
+ mklines := t.SetUpFileMkLines("multimedia/totem/filename.mk",
MkCvsID,
"BUILDLINK_PKGSRCDIR.totem?=\t../../multimedia/totem")
mklines.Check()
t.CheckOutputLines(
- "WARN: ~/multimedia/totem/bla.mk:2: "+
+ "WARN: ~/multimedia/totem/filename.mk:2: "+
"The variable BUILDLINK_PKGSRCDIR.totem should not be given a default value in this file; "+
"it would be ok in buildlink3.mk.",
- "ERROR: ~/multimedia/totem/bla.mk:2: Relative path \"../../multimedia/totem/Makefile\" does not exist.")
+ "ERROR: ~/multimedia/totem/filename.mk:2: Relative path \"../../multimedia/totem/Makefile\" does not exist.")
}
// Just for code coverage
diff -r 306c69aa00a1 -r 53eb6b27ca29 pkgtools/pkglint/files/mklines_test.go
--- a/pkgtools/pkglint/files/mklines_test.go Tue Jul 30 16:07:36 2019 +0000
+++ b/pkgtools/pkglint/files/mklines_test.go Tue Jul 30 18:16:13 2019 +0000
@@ -1155,7 +1155,6 @@
func (s *Suite) Test_MkLines_Check__autofix_MASTER_SITE_in_HOMEPAGE_in_package(c *check.C) {
t := s.Init(c)
- t.SetUpCommandLine("-Wall", "--autofix")
t.SetUpPackage("category/package",
"MASTER_SITES=\thttps://cdn1.example.org/ https://cdn2.example.org/",
"HOMEPAGE=\t${MASTER_SITES}")
diff -r 306c69aa00a1 -r 53eb6b27ca29 pkgtools/pkglint/files/pkgsrc.go
--- a/pkgtools/pkglint/files/pkgsrc.go Tue Jul 30 16:07:36 2019 +0000
+++ b/pkgtools/pkglint/files/pkgsrc.go Tue Jul 30 18:16:13 2019 +0000
@@ -501,7 +501,7 @@
func (src *Pkgsrc) loadDocChangesFromFile(filename string) []*Change {
- warn := !G.Wip
+ warn := G.Opts.CheckGlobal && !G.Wip
// Each date in the file should be from the same year as the filename says.
// This check has been added in 2018.
diff -r 306c69aa00a1 -r 53eb6b27ca29 pkgtools/pkglint/files/pkgsrc_test.go
--- a/pkgtools/pkglint/files/pkgsrc_test.go Tue Jul 30 16:07:36 2019 +0000
+++ b/pkgtools/pkglint/files/pkgsrc_test.go Tue Jul 30 18:16:13 2019 +0000
@@ -340,6 +340,7 @@
func (s *Suite) Test_Pkgsrc_loadDocChangesFromFile(c *check.C) {
t := s.Init(c)
+ t.SetUpCommandLine("-Cglobal", "-Wall")
t.CreateFileLines("doc/CHANGES-2018",
"\tAdded category/package version 1.0 [author1 2015-01-01]", // Wrong year
"\tUpdated category/package to 1.5 [author2 2018-01-02]",
@@ -410,12 +411,51 @@
"\t\tWrong indentation",
"\tInvalid pkgpath to 1.16 [rillig 2019-06-16]")
- t.Main(t.File("wip/package"))
+ t.Main("-Cglobal", "-Wall", "wip/package")
t.CheckOutputLines(
"Looks fine.")
}
+// When a single package is checked, only the lines from doc/CHANGES
+// that are related to that package are shown. The others are too
+// unrelated.
+func (s *Suite) Test_Pkgsrc_loadDocChangesFromFile__default(c *check.C) {
+ t := s.Init(c)
+
+ t.SetUpPackage("category/package")
+ t.CreateFileLines("doc/CHANGES-2018",
+ CvsID,
+ "",
+ "Changes to the packages collection and infrastructure in 2018:",
+ "",
+ "\tUpdated sysutils/checkperms to 1.10 [rillig 2018-01-05]",
+ "\tUpdated sysutils/checkperms to 1.11 [rillig 2018-01-01]",
+ "\t\tWrong indentation",
+ "\tInvalid pkgpath to 1.16 [rillig 2019-06-16]",
+ "\tUpdated category/package to 2.0 [rillig 2019-07-24]")
+ t.CreateFileLines("Makefile",
+ MkCvsID)
+
+ t.Main("category/package")
+
+ t.CheckOutputLines(
+ "WARN: ~/category/package/Makefile:3: The package is being downgraded from 2.0 (see ../../doc/CHANGES-2018:9) to 1.0.",
+ "1 warning found.",
+ "(Run \"pkglint -e\" to show explanations.)")
+
+ // Only when the global checks are enabled, the errors from doc/CHANGES are shown.
+ t.Main("-Cglobal", "-Wall", ".")
+
+ t.CheckOutputLines(
+ "WARN: ~/doc/CHANGES-2018:6: Date \"2018-01-01\" for sysutils/checkperms is earlier than \"2018-01-05\" in line 5.",
+ "WARN: ~/doc/CHANGES-2018:7: Package changes should be indented using a single tab, not \"\\t\\t\".",
+ "WARN: ~/doc/CHANGES-2018:8: Unknown doc/CHANGES line: \tInvalid pkgpath to 1.16 [rillig 2019-06-16]",
+ "WARN: ~/doc/CHANGES-2018:9: Year \"2019\" for category/package does not match the filename ~/doc/CHANGES-2018.",
+ "4 warnings found.",
+ "(Run \"pkglint -e\" to show explanations.)")
+}
+
func (s *Suite) Test_Pkgsrc_loadDocChangesFromFile__wrong_indentation(c *check.C) {
t := s.Init(c)
@@ -428,7 +468,7 @@
" Updated sysutils/checkperms to 1.10 [rillig 2018-01-05]",
" \tUpdated sysutils/checkperms to 1.11 [rillig 2018-01-01]")
- t.Main(t.File("category/package"))
+ t.Main("-Cglobal", "-Wall", "category/package")
t.CheckOutputLines(
"WARN: ~/doc/CHANGES-2018:5: Package changes should be indented using a single tab, not \" \".",
@@ -548,6 +588,7 @@
func (s *Suite) Test_Pkgsrc_loadDocChangesFromFile__old(c *check.C) {
t := s.Init(c)
+ t.SetUpCommandLine("-Cglobal", "-Wall")
t.SetUpPkgsrc()
t.CreateFileLines("doc/CHANGES-2010",
CvsID,
diff -r 306c69aa00a1 -r 53eb6b27ca29 pkgtools/pkglint/files/vartypecheck.go
--- a/pkgtools/pkglint/files/vartypecheck.go Tue Jul 30 16:07:36 2019 +0000
+++ b/pkgtools/pkglint/files/vartypecheck.go Tue Jul 30 18:16:13 2019 +0000
@@ -502,8 +502,8 @@
subdir := cv.Value[len(siteURL):]
if hasPrefix(cv.Value, "https://github.com/") {
subdir = strings.SplitAfter(subdir, "/")[0]
- cv.Warnf("Please use ${%s:=%s} instead of %q and run %q for further tips.",
- siteName, subdir, cv.Value, makeHelp("github"))
+ cv.Warnf("Please use ${%s:=%s} instead of %q and run %q for further instructions.",
+ siteName, subdir, cv.Value[:len(siteURL)+len(subdir)], makeHelp("github"))
} else {
cv.Warnf("Please use ${%s:=%s} instead of %q.", siteName, subdir, cv.Value)
}
diff -r 306c69aa00a1 -r 53eb6b27ca29 pkgtools/pkglint/files/vartypecheck_test.go
--- a/pkgtools/pkglint/files/vartypecheck_test.go Tue Jul 30 16:07:36 2019 +0000
+++ b/pkgtools/pkglint/files/vartypecheck_test.go Tue Jul 30 18:16:13 2019 +0000
@@ -490,8 +490,8 @@
vt.Output(
"WARN: filename.mk:1: Please use ${MASTER_SITE_GITHUB:=example/} "+
- "instead of \"https://github.com/example/project/\" "+
- "and run \""+confMake+" help topic=github\" for further tips.",
+ "instead of \"https://github.com/example/\" "+
+ "and run \""+confMake+" help topic=github\" for further instructions.",
"WARN: filename.mk:2: Please use ${MASTER_SITE_GNU:=bison} "+
"instead of \"http://ftp.gnu.org/pub/gnu/bison\".",
"ERROR: filename.mk:3: The subdirectory in MASTER_SITE_GNU must end with a slash.",
@@ -525,6 +525,13 @@
vt.Values(
"${MASTER_SITE_GNU:S,$,subdir/,}")
vt.OutputEmpty()
+
+ vt.Values(
+ "https://github.com/transmission/transmission-releases/raw/master/")
+ vt.Output(
+ "WARN: filename.mk:51: Please use ${MASTER_SITE_GITHUB:=transmission/} " +
+ "instead of \"https://github.com/transmission/\" " +
+ "and run \"" + confMake + " help topic=github\" for further instructions.")
}
func (s *Suite) Test_VartypeCheck_FetchURL__without_package(c *check.C) {
Home |
Main Index |
Thread Index |
Old Index