pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint Updated pkglint to 5.4.12.
details: https://anonhg.NetBSD.org/pkgsrc/rev/79a08a5aa037
branches: trunk
changeset: 355526:79a08a5aa037
user: rillig <rillig%pkgsrc.org@localhost>
date: Sun Dec 04 15:28:36 2016 +0000
description:
Updated pkglint to 5.4.12.
Changes since 5.4.11:
* warn when PKGSRC_COMPILER is compared with "==", since it may be a chain
of compilers
* warn about listing Python .egg-info files directly in PLIST files, since
lang/python/egg.mk takes care of this
* code cleanup: unify Error{0,1,2,3} into Errorf to make understanding the
code easier; use interface{} for MkLine data; use regular expression
instead of handwritten matching code, since one line is easier to read
than 50
diffstat:
pkgtools/pkglint/Makefile | 6 +-
pkgtools/pkglint/files/buildlink3.go | 18 +-
pkgtools/pkglint/files/buildlink3_test.go | 24 +-
pkgtools/pkglint/files/category.go | 18 +-
pkgtools/pkglint/files/dir.go | 4 +-
pkgtools/pkglint/files/distinfo.go | 14 +-
pkgtools/pkglint/files/expecter.go | 4 +-
pkgtools/pkglint/files/files.go | 10 +-
pkgtools/pkglint/files/files_test.go | 4 +-
pkgtools/pkglint/files/getopt.go | 6 -
pkgtools/pkglint/files/globaldata.go | 8 +-
pkgtools/pkglint/files/globalvars.go | 2 +-
pkgtools/pkglint/files/licenses.go | 12 +-
pkgtools/pkglint/files/line.go | 21 +--
pkgtools/pkglint/files/line_test.go | 6 +-
pkgtools/pkglint/files/logging.go | 4 -
pkgtools/pkglint/files/mkline.go | 222 +++++++++++++++--------------
pkgtools/pkglint/files/mkline_test.go | 46 +++---
pkgtools/pkglint/files/mklines_test.go | 36 ++--
pkgtools/pkglint/files/mkparser.go | 6 +-
pkgtools/pkglint/files/package.go | 62 ++++----
pkgtools/pkglint/files/package_test.go | 8 +-
pkgtools/pkglint/files/patches.go | 32 ++--
pkgtools/pkglint/files/pkglint.go | 90 ++----------
pkgtools/pkglint/files/plist.go | 107 +++++++-------
pkgtools/pkglint/files/plist_test.go | 10 +
pkgtools/pkglint/files/regex.go | 112 +++++++++++++++
pkgtools/pkglint/files/shell.go | 98 ++++++------
pkgtools/pkglint/files/substcontext.go | 22 +-
pkgtools/pkglint/files/toplevel.go | 8 +-
pkgtools/pkglint/files/util.go | 116 ---------------
pkgtools/pkglint/files/vartypecheck.go | 204 +++++++++++++-------------
32 files changed, 636 insertions(+), 704 deletions(-)
diffs (truncated from 4060 to 300 lines):
diff -r e2f662cf70a6 -r 79a08a5aa037 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Sun Dec 04 13:50:08 2016 +0000
+++ b/pkgtools/pkglint/Makefile Sun Dec 04 15:28:36 2016 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.500 2016/11/14 01:08:23 rillig Exp $
+# $NetBSD: Makefile,v 1.501 2016/12/04 15:28:36 rillig Exp $
-PKGNAME= pkglint-5.4.11
+PKGNAME= pkglint-5.4.12
DISTFILES= # none
CATEGORIES= pkgtools
-OWNER= rillig%NetBSD.org@localhost
+MAINTAINER= rillig%NetBSD.org@localhost
HOMEPAGE= http://www.NetBSD.org/docs/pkgsrc/
COMMENT= Verifier for NetBSD packages
LICENSE= 2-clause-bsd
diff -r e2f662cf70a6 -r 79a08a5aa037 pkgtools/pkglint/files/buildlink3.go
--- a/pkgtools/pkglint/files/buildlink3.go Sun Dec 04 13:50:08 2016 +0000
+++ b/pkgtools/pkglint/files/buildlink3.go Sun Dec 04 15:28:36 2016 +0000
@@ -17,14 +17,14 @@
line := exp.PreviousLine()
// See pkgtools/createbuildlink/files/createbuildlink
if hasPrefix(line.Text, "# XXX This file was created automatically") {
- line.Error0("This comment indicates unfinished work (url2pkg).")
+ line.Errorf("This comment indicates unfinished work (url2pkg).")
}
}
exp.ExpectEmptyLine()
if exp.AdvanceIfMatches(`^BUILDLINK_DEPMETHOD\.(\S+)\?=.*$`) {
- exp.PreviousLine().Warn0("This line belongs inside the .ifdef block.")
+ exp.PreviousLine().Warnf("This line belongs inside the .ifdef block.")
for exp.AdvanceIfEquals("") {
}
}
@@ -35,7 +35,7 @@
// First paragraph: Introduction of the package identifier
if !exp.AdvanceIfMatches(`^BUILDLINK_TREE\+=\s*(\S+)$`) {
- exp.CurrentLine().Warn0("Expected a BUILDLINK_TREE line.")
+ exp.CurrentLine().Warnf("Expected a BUILDLINK_TREE line.")
return
}
pkgbase = exp.m[1]
@@ -48,13 +48,13 @@
{"${PHP_PKG_PREFIX}", "php"},
} {
if contains(pkgbase, pair.varuse) {
- pkgbaseLine.Warn2("Please use %q instead of %q (also in other variables in this file).", pair.simple, pair.varuse)
+ pkgbaseLine.Warnf("Please use %q instead of %q (also in other variables in this file).", pair.simple, pair.varuse)
warned = true
}
}
if !warned {
if m, varuse := match1(pkgbase, `(\$\{\w+\})`); m {
- pkgbaseLine.Warn1("Please replace %q with a simple string (also in other variables in this file).", varuse)
+ pkgbaseLine.Warnf("Please replace %q with a simple string (also in other variables in this file).", varuse)
warned = true
}
}
@@ -99,7 +99,7 @@
indentLevel := 1 // The first .if is from the second paragraph.
for {
if exp.EOF() {
- exp.CurrentLine().Warn0("Expected .endif")
+ exp.CurrentLine().Warnf("Expected .endif")
return
}
@@ -149,7 +149,7 @@
if varparam := mkline.Varparam(); varparam != "" && varparam != pkgbase {
if hasPrefix(varname, "BUILDLINK_") && mkline.Varcanon() != "BUILDLINK_API_DEPENDS.*" {
- line.Warn2("Only buildlink variables for %q, not %q may be set in this file.", pkgbase, varparam)
+ line.Warnf("Only buildlink variables for %q, not %q may be set in this file.", pkgbase, varparam)
}
}
@@ -181,7 +181,7 @@
}
}
if apiLine == nil {
- exp.CurrentLine().Warn0("Definition of BUILDLINK_API_DEPENDS is missing.")
+ exp.CurrentLine().Warnf("Definition of BUILDLINK_API_DEPENDS is missing.")
}
exp.ExpectEmptyLine()
@@ -191,7 +191,7 @@
}
if !exp.EOF() {
- exp.CurrentLine().Warn0("The file should end here.")
+ exp.CurrentLine().Warnf("The file should end here.")
}
if G.Pkg != nil {
diff -r e2f662cf70a6 -r 79a08a5aa037 pkgtools/pkglint/files/buildlink3_test.go
--- a/pkgtools/pkglint/files/buildlink3_test.go Sun Dec 04 13:50:08 2016 +0000
+++ b/pkgtools/pkglint/files/buildlink3_test.go Sun Dec 04 15:28:36 2016 +0000
@@ -7,7 +7,7 @@
func (s *Suite) Test_ChecklinesBuildlink3Mk(c *check.C) {
G.globalData.InitVartypes()
mklines := s.NewMkLines("buildlink3.mk",
- "# $"+"NetBSD$",
+ mkrcsid,
"# XXX This file was created automatically using createbuildlink-@PKGVERSION@",
"",
"BUILDLINK_TREE+= Xbae",
@@ -43,7 +43,7 @@
G.Pkg.EffectivePkgbase = "X11"
G.Pkg.EffectivePkgnameLine = NewMkLine(NewLine("Makefile", 3, "DISTNAME=\tX11-1.0", nil))
mklines := s.NewMkLines("buildlink3.mk",
- "# $"+"NetBSD$",
+ mkrcsid,
"",
"BUILDLINK_TREE+=\ths-X11",
"",
@@ -65,7 +65,7 @@
func (s *Suite) Test_ChecklinesBuildlink3Mk_name_mismatch_multiple_inclusion(c *check.C) {
G.globalData.InitVartypes()
mklines := s.NewMkLines("buildlink3.mk",
- "# $"+"NetBSD$",
+ mkrcsid,
"",
"BUILDLINK_TREE+=\tpkgbase1",
"",
@@ -86,7 +86,7 @@
func (s *Suite) Test_ChecklinesBuildlink3Mk_name_mismatch_abi_api(c *check.C) {
G.globalData.InitVartypes()
mklines := s.NewMkLines("buildlink3.mk",
- "# $"+"NetBSD$",
+ mkrcsid,
"",
"BUILDLINK_TREE+=\ths-X11",
"",
@@ -108,7 +108,7 @@
func (s *Suite) Test_ChecklinesBuildlink3Mk_abi_api_versions(c *check.C) {
G.globalData.InitVartypes()
mklines := s.NewMkLines("buildlink3.mk",
- "# $"+"NetBSD$",
+ mkrcsid,
"",
"BUILDLINK_TREE+=\ths-X11",
"",
@@ -131,7 +131,7 @@
func (s *Suite) Test_ChecklinesBuildlink3Mk_no_BUILDLINK_TREE_at_beginning(c *check.C) {
G.globalData.InitVartypes()
mklines := s.NewMkLines("buildlink3.mk",
- "# $"+"NetBSD$",
+ mkrcsid,
"",
".if !defined(HS_X11_BUILDLINK3_MK)",
"HS_X11_BUILDLINK3_MK:=",
@@ -152,7 +152,7 @@
func (s *Suite) Test_ChecklinesBuildlink3Mk_no_BUILDLINK_TREE_at_end(c *check.C) {
G.globalData.InitVartypes()
mklines := s.NewMkLines("buildlink3.mk",
- "# $"+"NetBSD$",
+ mkrcsid,
"",
"BUILDLINK_DEPMETHOD.hs-X11?=\tfull",
"",
@@ -179,7 +179,7 @@
func (s *Suite) Test_ChecklinesBuildlink3Mk_multiple_inclusion_wrong(c *check.C) {
G.globalData.InitVartypes()
mklines := s.NewMkLines("buildlink3.mk",
- "# $"+"NetBSD$",
+ mkrcsid,
"",
"BUILDLINK_TREE+=\ths-X11",
"",
@@ -196,7 +196,7 @@
func (s *Suite) Test_ChecklinesBuildlink3Mk_missing_endif(c *check.C) {
G.globalData.InitVartypes()
mklines := s.NewMkLines("buildlink3.mk",
- "# $"+"NetBSD$",
+ mkrcsid,
"",
"BUILDLINK_TREE+=\tpkgbase1",
"",
@@ -211,7 +211,7 @@
func (s *Suite) Test_ChecklinesBuildlink3Mk_unknown_dependency_patterns(c *check.C) {
G.globalData.InitVartypes()
mklines := s.NewMkLines("buildlink3.mk",
- "# $"+"NetBSD$",
+ mkrcsid,
"",
"BUILDLINK_TREE+= hs-X11",
"",
@@ -236,7 +236,7 @@
func (s *Suite) Test_ChecklinesBuildlink3Mk_PKGBASE_with_variable(c *check.C) {
G.globalData.InitVartypes()
mklines := s.NewMkLines("buildlink3.mk",
- "# $"+"NetBSD$",
+ mkrcsid,
"",
"BUILDLINK_TREE+=\t${PYPKGPREFIX}-wxWidgets",
"",
@@ -258,7 +258,7 @@
func (s *Suite) Test_ChecklinesBuildlink3Mk_PKGBASE_with_unknown_variable(c *check.C) {
G.globalData.InitVartypes()
mklines := s.NewMkLines("buildlink3.mk",
- "# $"+"NetBSD$",
+ mkrcsid,
"",
"BUILDLINK_TREE+=\t${LICENSE}-wxWidgets",
"",
diff -r e2f662cf70a6 -r 79a08a5aa037 pkgtools/pkglint/files/category.go
--- a/pkgtools/pkglint/files/category.go Sun Dec 04 13:50:08 2016 +0000
+++ b/pkgtools/pkglint/files/category.go Sun Dec 04 15:28:36 2016 +0000
@@ -25,7 +25,7 @@
if exp.AdvanceIfMatches(`^COMMENT=\t*(.*)`) {
mklines.mklines[exp.index-1].CheckValidCharactersInValue(`[- '(),/0-9A-Za-z]`)
} else {
- exp.CurrentLine().Error0("COMMENT= line expected.")
+ exp.CurrentLine().Errorf("COMMENT= line expected.")
}
exp.ExpectEmptyLine()
@@ -51,17 +51,17 @@
if m, commentFlag, indentation, name, comment := match4(text, `^(#?)SUBDIR\+=(\s*)(\S+)\s*(?:#\s*(.*?)\s*|)$`); m {
commentedOut := commentFlag == "#"
if commentedOut && comment == "" {
- line.Warn1("%q commented out without giving a reason.", name)
+ line.Warnf("%q commented out without giving a reason.", name)
}
if indentation != "\t" {
- line.Warn0("Indentation should be a single tab character.")
+ line.Warnf("Indentation should be a single tab character.")
}
if name == prevSubdir {
- line.Error1("%q must only appear once.", name)
+ line.Errorf("%q must only appear once.", name)
} else if name < prevSubdir {
- line.Warn2("%q should come before %q.", name, prevSubdir)
+ line.Warnf("%q should come before %q.", name, prevSubdir)
} else {
// correctly ordered
}
@@ -72,7 +72,7 @@
} else {
if line.Text != "" {
- line.Error0("SUBDIR+= line or empty line expected.")
+ line.Errorf("SUBDIR+= line or empty line expected.")
}
break
}
@@ -127,7 +127,7 @@
if !fAtend && (mAtend || fCurrent < mCurrent) {
if !mCheck[fCurrent] {
if !line.AutofixInsertBefore("SUBDIR+=\t" + fCurrent) {
- line.Error1("%q exists in the file system, but not in the Makefile.", fCurrent)
+ line.Errorf("%q exists in the file system, but not in the Makefile.", fCurrent)
}
}
fNeednext = true
@@ -135,7 +135,7 @@
} else if !mAtend && (fAtend || mCurrent < fCurrent) {
if !fCheck[mCurrent] {
if !line.AutofixDelete() {
- line.Error1("%q exists in the Makefile, but not in the file system.", mCurrent)
+ line.Errorf("%q exists in the Makefile, but not in the file system.", mCurrent)
}
}
mNeednext = true
@@ -158,7 +158,7 @@
exp.ExpectEmptyLine()
exp.ExpectText(".include \"../mk/misc/category.mk\"")
if !exp.EOF() {
- exp.CurrentLine().Error0("The file should end here.")
+ exp.CurrentLine().Errorf("The file should end here.")
}
SaveAutofixChanges(lines)
diff -r e2f662cf70a6 -r 79a08a5aa037 pkgtools/pkglint/files/dir.go
--- a/pkgtools/pkglint/files/dir.go Sun Dec 04 13:50:08 2016 +0000
+++ b/pkgtools/pkglint/files/dir.go Sun Dec 04 15:28:36 2016 +0000
@@ -24,7 +24,7 @@
G.Infrastructure = matches(absCurrentDir, `/mk/|/mk$`)
G.CurPkgsrcdir = findPkgsrcTopdir(G.CurrentDir)
if G.CurPkgsrcdir == "" {
- NewLineWhole(fname).Error1("Cannot determine the pkgsrc root directory for %q.", G.CurrentDir)
+ NewLineWhole(fname).Errorf("Cannot determine the pkgsrc root directory for %q.", G.CurrentDir)
return
}
@@ -44,6 +44,6 @@
case ".":
CheckdirToplevel()
default:
- NewLineWhole(fname).Error0("Cannot check directories outside a pkgsrc tree.")
+ NewLineWhole(fname).Errorf("Cannot check directories outside a pkgsrc tree.")
}
}
diff -r e2f662cf70a6 -r 79a08a5aa037 pkgtools/pkglint/files/distinfo.go
Home |
Main Index |
Thread Index |
Old Index