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.6.
details: https://anonhg.NetBSD.org/pkgsrc/rev/8752e0cb90f9
branches: trunk
changeset: 349567:8752e0cb90f9
user: rillig <rillig%pkgsrc.org@localhost>
date: Sun Jul 10 11:37:27 2016 +0000
description:
Updated pkglint to 5.4.6.
Changes since 5.4.5:
* Fixed shell command parser to correctly parse redirections
* Added type definitions for several variables
* Allowed version numbers to be single digits
diffstat:
pkgtools/pkglint/Makefile | 4 +-
pkgtools/pkglint/files/mkshparser.go | 3 -
pkgtools/pkglint/files/mkshparser_test.go | 48 ++++++++++++++++++++++++++--
pkgtools/pkglint/files/vardefs.go | 25 +++++++++++++-
pkgtools/pkglint/files/vartypecheck.go | 2 +-
pkgtools/pkglint/files/vartypecheck_test.go | 11 ++++++
6 files changed, 81 insertions(+), 12 deletions(-)
diffs (275 lines):
diff -r 62c85d70045b -r 8752e0cb90f9 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Sun Jul 10 11:31:31 2016 +0000
+++ b/pkgtools/pkglint/Makefile Sun Jul 10 11:37:27 2016 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.490 2016/07/09 13:16:43 rillig Exp $
+# $NetBSD: Makefile,v 1.491 2016/07/10 11:37:27 rillig Exp $
-PKGNAME= pkglint-5.4.5
+PKGNAME= pkglint-5.4.6
DISTFILES= # none
CATEGORIES= pkgtools
diff -r 62c85d70045b -r 8752e0cb90f9 pkgtools/pkglint/files/mkshparser.go
--- a/pkgtools/pkglint/files/mkshparser.go Sun Jul 10 11:31:31 2016 +0000
+++ b/pkgtools/pkglint/files/mkshparser.go Sun Jul 10 11:37:27 2016 +0000
@@ -190,9 +190,6 @@
}
switch {
- case matches(token, `^\d+$`) && len(lex.remaining) != 0 && matches(lex.remaining[0], `^[<>]`):
- ttype = tkIO_NUMBER
- lval.IONum, _ = strconv.Atoi(token)
case lex.sinceFor == 2 && token == "in":
ttype = tkIN
lex.atCommandStart = false
diff -r 62c85d70045b -r 8752e0cb90f9 pkgtools/pkglint/files/mkshparser_test.go
--- a/pkgtools/pkglint/files/mkshparser_test.go Sun Jul 10 11:31:31 2016 +0000
+++ b/pkgtools/pkglint/files/mkshparser_test.go Sun Jul 10 11:37:27 2016 +0000
@@ -25,7 +25,7 @@
b.List().AddCommand(b.SimpleCommand("echo")))
s.test(""+
- "cd ${WRKSRC} && ${FIND} ${${_list_}} -type f ! -name '*.orig' 2 > /dev/null "+
+ "cd ${WRKSRC} && ${FIND} ${${_list_}} -type f ! -name '*.orig' 2> /dev/null "+
"| pax -rw -pm ${DESTDIR}${PREFIX}/${${_dir_}}",
b.List().AddAndOr(b.AndOr(
b.Pipeline(false, b.SimpleCommand("cd", "${WRKSRC}"))).Add("&&",
@@ -163,20 +163,20 @@
s.test("simple_command",
b.List().AddAndOr(b.AndOr(b.Pipeline(false, b.SimpleCommand("simple_command")))))
- s.test("while 1 ; do 2 ; done",
+ s.test("while 1; do 2; done",
b.List().AddAndOr(b.AndOr(b.Pipeline(false,
b.While(
b.List().AddCommand(b.SimpleCommand("1")).AddSeparator(";"),
b.List().AddCommand(b.SimpleCommand("2")).AddSeparator(";"))))))
- s.test("while 1 ; do 2 ; done 1 >& 2",
+ s.test("while 1; do 2; done 1>&2",
b.List().AddAndOr(b.AndOr(b.Pipeline(false,
b.While(
b.List().AddCommand(b.SimpleCommand("1")).AddSeparator(";"),
b.List().AddCommand(b.SimpleCommand("2")).AddSeparator(";"),
b.Redirection(1, ">&", "2"))))))
- s.test("func ( ) { echo hello ; } 2 >& 1",
+ s.test("func(){ echo hello;} 2>&1",
b.List().AddCommand(b.Function(
"func",
b.Brace(b.List().AddCommand(b.SimpleCommand("echo", "hello")).AddSeparator(";")).Compound,
@@ -439,6 +439,15 @@
{4, ">&", b.Token("5")},
{6, "<", b.Token("input")},
{-1, ">>", b.Token("append")}}}}))
+
+ s.test("${MAKE} print-summary-data 2>&1 > /dev/stderr",
+ b.List().AddCommand(&MkShCommand{Simple: &MkShSimpleCommand{
+ Assignments: nil,
+ Name: b.Token("${MAKE}"),
+ Args: []*ShToken{b.Token("print-summary-data")},
+ Redirections: []*MkShRedirection{
+ {2, ">&", b.Token("1")},
+ {-1, ">", b.Token("/dev/stderr")}}}}))
}
func (s *ShSuite) Test_ShellParser_io_here(c *check.C) {
@@ -479,6 +488,37 @@
}
}
+func (s *ShSuite) Test_ShellLexer_Lex__redirects(c *check.C) {
+ tokens, rest := splitIntoShellTokens(dummyLine, "${MAKE} print-summary-data 2>&1 > /dev/stderr")
+
+ c.Check(tokens, deepEquals, []string{"${MAKE}", "print-summary-data", "2>&", "1", ">", "/dev/stderr"})
+ c.Check(rest, equals, "")
+
+ lexer := NewShellLexer(tokens, rest)
+ var llval shyySymType
+
+ c.Check(lexer.Lex(&llval), equals, tkWORD)
+ c.Check(llval.Word.MkText, equals, "${MAKE}")
+
+ c.Check(lexer.Lex(&llval), equals, tkWORD)
+ c.Check(llval.Word.MkText, equals, "print-summary-data")
+
+ c.Check(lexer.Lex(&llval), equals, tkIO_NUMBER)
+ c.Check(llval.IONum, equals, 2)
+
+ c.Check(lexer.Lex(&llval), equals, tkGTAND)
+
+ c.Check(lexer.Lex(&llval), equals, tkWORD)
+ c.Check(llval.Word.MkText, equals, "1")
+
+ c.Check(lexer.Lex(&llval), equals, tkGT)
+
+ c.Check(lexer.Lex(&llval), equals, tkWORD)
+ c.Check(llval.Word.MkText, equals, "/dev/stderr")
+
+ c.Check(lexer.Lex(&llval), equals, 0)
+}
+
type MkShBuilder struct {
}
diff -r 62c85d70045b -r 8752e0cb90f9 pkgtools/pkglint/files/vardefs.go
--- a/pkgtools/pkglint/files/vardefs.go Sun Jul 10 11:31:31 2016 +0000
+++ b/pkgtools/pkglint/files/vardefs.go Sun Jul 10 11:37:27 2016 +0000
@@ -152,6 +152,7 @@
acl("BUILDLINK_TRANSFORM.*", lkShell, CheckvarWrapperTransform, "*: append")
acl("BUILDLINK_TREE", lkShell, CheckvarIdentifier, "buildlink3.mk: append")
acl("BUILD_DEFS", lkShell, CheckvarVariableName, "Makefile, Makefile.common, options.mk: append")
+ pkglist("BUILD_DEFS_EFFECTS", lkShell, CheckvarVariableName)
acl("BUILD_DEPENDS", lkSpace, CheckvarDependencyWithPath, "Makefile, Makefile.common, *.mk: append")
pkglist("BUILD_DIRS", lkShell, CheckvarWrksrcSubdirectory)
pkglist("BUILD_ENV", lkShell, CheckvarShellWord)
@@ -223,6 +224,7 @@
sys("CXX", lkNone, CheckvarShellCommand)
pkglist("CXXFLAGS", lkShell, CheckvarCFlag)
pkglist("CXXFLAGS.*", lkShell, CheckvarCFlag)
+ pkglist("CWRAPPERS_APPEND.*", lkShell, CheckvarShellWord)
acl("DEINSTALL_FILE", lkNone, CheckvarPathname, "Makefile: set")
acl("DEINSTALL_SRC", lkShell, CheckvarPathname, "Makefile: set; Makefile.common: default, set")
acl("DEINSTALL_TEMPLATES", lkShell, CheckvarPathname, "Makefile: set, append; Makefile.common: set, default, append")
@@ -297,6 +299,7 @@
sys("EXPORT_SYMBOLS_LDFLAGS", lkShell, CheckvarLdFlag)
sys("EXTRACT_CMD", lkNone, CheckvarShellCommand)
pkg("EXTRACT_DIR", lkNone, CheckvarPathname)
+ pkg("EXTRACT_DIR.*", lkNone, CheckvarPathname)
pkglist("EXTRACT_ELEMENTS", lkShell, CheckvarPathmask)
pkglist("EXTRACT_ENV", lkShell, CheckvarShellWord)
pkglist("EXTRACT_ONLY", lkShell, CheckvarPathname)
@@ -333,6 +336,7 @@
pkg("GITHUB_TAG", lkNone, CheckvarIdentifier)
pkg("GITHUB_RELEASE", lkNone, CheckvarFilename)
pkg("GITHUB_TYPE", lkNone, enum("tag release"))
+ pkg("GMAKE_REQD", lkNone, CheckvarVersion)
acl("GNU_ARCH", lkNone, enum("mips"), "")
acl("GNU_CONFIGURE", lkNone, CheckvarYes, "Makefile, Makefile.common: set")
acl("GNU_CONFIGURE_INFODIR", lkNone, CheckvarPathname, "Makefile, Makefile.common: set")
@@ -402,6 +406,7 @@
pkg("LICENSE_FILE", lkNone, CheckvarPathname)
sys("LINKER_RPATH_FLAG", lkNone, CheckvarShellWord)
sys("LOWER_OPSYS", lkNone, CheckvarIdentifier)
+ sys("LOWER_VENDOR", lkNone, CheckvarIdentifier)
acl("LTCONFIG_OVERRIDE", lkShell, CheckvarPathmask, "Makefile: set, append; Makefile.common: append")
sys("MACHINE_ARCH", lkNone, enumMachineArch)
sys("MACHINE_GNU_ARCH", lkNone, enumMachineGnuArch)
@@ -467,6 +472,7 @@
sys("NM", lkNone, CheckvarShellCommand)
sys("NONBINMODE", lkNone, CheckvarFileMode)
pkg("NOT_FOR_COMPILER", lkShell, enum("ccache ccc clang distcc f2c gcc hp icc ido mipspro mipspro-ucode pcc sunpro xlc"))
+ pkglist("NOT_FOR_BULK_PLATFORM", lkSpace, CheckvarMachinePlatformPattern)
pkglist("NOT_FOR_PLATFORM", lkSpace, CheckvarMachinePlatformPattern)
pkg("NOT_FOR_UNPRIVILEGED", lkNone, CheckvarYesNo)
acl("NO_BIN_ON_CDROM", lkNone, CheckvarRestricted, "Makefile, Makefile.common: set")
@@ -502,9 +508,10 @@
acl("PATCH_DIST_STRIP*", lkNone, CheckvarShellWord, "buildlink3.mk, builtin.mk:; Makefile, Makefile.common, *.mk: set")
acl("PATCH_SITES", lkShell, CheckvarFetchURL, "Makefile, Makefile.common, options.mk: set")
acl("PATCH_STRIP", lkNone, CheckvarShellWord, "")
- pkg("PERL5_USE_PACKLIST", lkNone, CheckvarYesNo)
acl("PERL5_PACKLIST", lkShell, CheckvarPerl5Packlist, "Makefile: set; options.mk: set, append")
acl("PERL5_PACKLIST_DIR", lkNone, CheckvarPathname, "")
+ pkg("PERL5_REQD", lkShell, CheckvarVersion)
+ pkg("PERL5_USE_PACKLIST", lkNone, CheckvarYesNo)
sys("PGSQL_PREFIX", lkNone, CheckvarPathname)
acl("PGSQL_VERSIONS_ACCEPTED", lkShell, enum("91 92 93 94"), "")
usr("PGSQL_VERSION_DEFAULT", lkNone, CheckvarVersion)
@@ -576,6 +583,7 @@
acl("PKG_SHLIBTOOL", lkNone, CheckvarPathname, "")
pkglist("PKG_SKIP_REASON", lkShell, CheckvarShellWord)
acl("PKG_SUGGESTED_OPTIONS", lkShell, CheckvarOption, "Makefile, Makefile.common, options.mk: set, append")
+ acl("PKG_SUGGESTED_OPTIONS.*", lkShell, CheckvarOption, "Makefile, Makefile.common, options.mk: set, append")
acl("PKG_SUPPORTED_OPTIONS", lkShell, CheckvarOption, "Makefile: set, append; Makefile.common: set; options.mk: set, append, use")
pkg("PKG_SYSCONFDIR*", lkNone, CheckvarPathname)
pkglist("PKG_SYSCONFDIR_PERMS", lkShell, CheckvarPerms)
@@ -613,7 +621,8 @@
pkglist("PYTHON_VERSIONED_DEPENDENCIES", lkShell, CheckvarPythonDependency)
sys("RANLIB", lkNone, CheckvarShellCommand)
pkglist("RCD_SCRIPTS", lkShell, CheckvarFilename)
- acl("RCD_SCRIPT_SRC.*", lkShell, CheckvarPathname, "Makefile: set")
+ acl("RCD_SCRIPT_SRC.*", lkNone, CheckvarPathname, "Makefile: set")
+ acl("RCD_SCRIPT_WRK.*", lkNone, CheckvarPathname, "Makefile: set")
acl("REPLACE.*", lkNone, CheckvarString, "Makefile: set")
pkglist("REPLACE_AWK", lkShell, CheckvarPathmask)
pkglist("REPLACE_BASH", lkShell, CheckvarPathmask)
@@ -640,6 +649,7 @@
sys("RUN_LDCONFIG", lkNone, CheckvarYesNo)
acl("SCRIPTS_ENV", lkShell, CheckvarShellWord, "Makefile, Makefile.common: append")
usr("SETUID_ROOT_PERMS", lkShell, CheckvarShellWord)
+ pkg("SET_LIBDIR", lkNone, CheckvarYes)
sys("SHAREGRP", lkNone, CheckvarUserGroupName)
sys("SHAREMODE", lkNone, CheckvarFileMode)
sys("SHAREOWN", lkNone, CheckvarUserGroupName)
@@ -648,6 +658,14 @@
acl("SHLIBTOOL", lkNone, CheckvarShellCommand, "Makefile: use")
acl("SHLIBTOOL_OVERRIDE", lkShell, CheckvarPathmask, "Makefile: set, append; Makefile.common: append")
acl("SITES.*", lkShell, CheckvarFetchURL, "Makefile, Makefile.common, options.mk: set, append, use")
+ usr("SMF_PREFIS", lkNone, CheckvarPathname)
+ pkg("SMF_SRCDIR", lkNone, CheckvarPathname)
+ pkg("SMF_NAME", lkNone, CheckvarFilename)
+ pkg("SMF_MANIFEST", lkNone, CheckvarPathname)
+ pkg("SMF_INSTANCES", lkShell, CheckvarIdentifier)
+ pkg("SMF_METHODS", lkShell, CheckvarFilename)
+ pkg("SMF_METHOD_SRC.*", lkNone, CheckvarPathname)
+ pkg("SMF_METHOD_SHELL", lkNone, CheckvarShellCommand)
pkglist("SPECIAL_PERMS", lkShell, CheckvarPerms)
sys("STEP_MSG", lkNone, CheckvarShellCommand)
acl("SUBDIR", lkShell, CheckvarFilename, "Makefile: append; *:")
@@ -683,6 +701,7 @@
usr("UNPRIVILEGED_GROUP", lkNone, CheckvarUserGroupName)
pkglist("UNWRAP_FILES", lkShell, CheckvarPathmask)
usr("UPDATE_TARGET", lkShell, CheckvarIdentifier)
+ pkg("USERGROUP_PHASE", lkNone, enum("configure build pre-install"))
pkg("USE_BSD_MAKEFILE", lkNone, CheckvarYes)
acl("USE_BUILTIN.*", lkNone, CheckvarYesNoIndirectly, "builtin.mk: set")
pkg("USE_CMAKE", lkNone, CheckvarYes)
@@ -709,12 +728,14 @@
sys("WARNING_MSG", lkNone, CheckvarShellCommand)
sys("WARNING_CAT", lkNone, CheckvarShellCommand)
acl("WRAPPER_REORDER_CMDS", lkShell, CheckvarWrapperReorder, "Makefile, Makefile.common, buildlink3.mk: append")
+ pkg("WRAPPER_SHELL", lkNone, CheckvarShellCommand)
acl("WRAPPER_TRANSFORM_CMDS", lkShell, CheckvarWrapperTransform, "Makefile, Makefile.common, buildlink3.mk: append")
sys("WRKDIR", lkNone, CheckvarPathname)
pkg("WRKSRC", lkNone, CheckvarWrkdirSubdirectory)
sys("X11_PKGSRCDIR.*", lkNone, CheckvarPathname)
usr("XAW_TYPE", lkNone, enum("3d neXtaw standard xpm"))
acl("XMKMF_FLAGS", lkShell, CheckvarShellWord, "")
+ pkglist("_WRAP_EXTRA_ARGS.*", lkShell, CheckvarShellWord)
}
func enum(values string) *VarChecker {
diff -r 62c85d70045b -r 8752e0cb90f9 pkgtools/pkglint/files/vartypecheck.go
--- a/pkgtools/pkglint/files/vartypecheck.go Sun Jul 10 11:31:31 2016 +0000
+++ b/pkgtools/pkglint/files/vartypecheck.go Sun Jul 10 11:37:27 2016 +0000
@@ -970,7 +970,7 @@
if !matches(cv.Value, `^[\d?\[][\w\-.*?\[\]]+$`) {
cv.Line.Warn1("Invalid version number pattern %q.", cv.Value)
}
- } else if cv.Value == cv.ValueNoVar && !matches(cv.Value, `^\d[\w.]+$`) {
+ } else if cv.Value == cv.ValueNoVar && !matches(cv.Value, `^\d[\w.]*$`) {
cv.Line.Warn1("Invalid version number %q.", cv.Value)
}
}
diff -r 62c85d70045b -r 8752e0cb90f9 pkgtools/pkglint/files/vartypecheck_test.go
--- a/pkgtools/pkglint/files/vartypecheck_test.go Sun Jul 10 11:31:31 2016 +0000
+++ b/pkgtools/pkglint/files/vartypecheck_test.go Sun Jul 10 11:37:27 2016 +0000
@@ -386,6 +386,17 @@
c.Check(s.Output(), equals, "WARN: fname:2: \"VarBase\" is not a valid variable name.\n")
}
+func (s *Suite) Test_VartypeCheck_Version(c *check.C) {
+ runVartypeChecks("PERL5_REQD", opAssignAppend, (*VartypeCheck).Version,
+ "0",
+ "1.2.3.4.5.6",
+ "4.1nb17",
+ "4.1-SNAPSHOT",
+ "4pre7")
+
+ c.Check(s.Output(), equals, "WARN: fname:4: Invalid version number \"4.1-SNAPSHOT\".\n")
+}
+
func (s *Suite) Test_VartypeCheck_Yes(c *check.C) {
runVartypeChecks("APACHE_MODULE", opAssign, (*VartypeCheck).Yes,
"yes",
Home |
Main Index |
Thread Index |
Old Index