pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/pkgtools/pkglint



Module Name:    pkgsrc
Committed By:   rillig
Date:           Sun Jul 10 11:37:27 UTC 2016

Modified Files:
        pkgsrc/pkgtools/pkglint: Makefile
        pkgsrc/pkgtools/pkglint/files: mkshparser.go mkshparser_test.go
            vardefs.go vartypecheck.go vartypecheck_test.go

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.490 -r1.491 pkgsrc/pkgtools/pkglint/Makefile
cvs rdiff -u -r1.2 -r1.3 pkgsrc/pkgtools/pkglint/files/mkshparser.go \
    pkgsrc/pkgtools/pkglint/files/mkshparser_test.go
cvs rdiff -u -r1.12 -r1.13 pkgsrc/pkgtools/pkglint/files/vardefs.go \
    pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go
cvs rdiff -u -r1.16 -r1.17 pkgsrc/pkgtools/pkglint/files/vartypecheck.go

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/pkglint/Makefile
diff -u pkgsrc/pkgtools/pkglint/Makefile:1.490 pkgsrc/pkgtools/pkglint/Makefile:1.491
--- pkgsrc/pkgtools/pkglint/Makefile:1.490      Sat Jul  9 13:16:43 2016
+++ pkgsrc/pkgtools/pkglint/Makefile    Sun Jul 10 11:37:27 2016
@@ -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
 

Index: pkgsrc/pkgtools/pkglint/files/mkshparser.go
diff -u pkgsrc/pkgtools/pkglint/files/mkshparser.go:1.2 pkgsrc/pkgtools/pkglint/files/mkshparser.go:1.3
--- pkgsrc/pkgtools/pkglint/files/mkshparser.go:1.2     Thu Jul  7 12:09:27 2016
+++ pkgsrc/pkgtools/pkglint/files/mkshparser.go Sun Jul 10 11:37:27 2016
@@ -190,9 +190,6 @@ func (lex *ShellLexer) Lex(lval *shyySym
        }
 
        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
Index: pkgsrc/pkgtools/pkglint/files/mkshparser_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mkshparser_test.go:1.2 pkgsrc/pkgtools/pkglint/files/mkshparser_test.go:1.3
--- pkgsrc/pkgtools/pkglint/files/mkshparser_test.go:1.2        Thu Jul  7 12:09:27 2016
+++ pkgsrc/pkgtools/pkglint/files/mkshparser_test.go    Sun Jul 10 11:37:27 2016
@@ -25,7 +25,7 @@ func (s *ShSuite) Test_ShellParser_progr
                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 @@ func (s *ShSuite) Test_ShellParser_comma
        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 @@ func (s *ShSuite) Test_ShellParser_io_re
                                {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(program string, e
        }
 }
 
+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 {
 }
 

Index: pkgsrc/pkgtools/pkglint/files/vardefs.go
diff -u pkgsrc/pkgtools/pkglint/files/vardefs.go:1.12 pkgsrc/pkgtools/pkglint/files/vardefs.go:1.13
--- pkgsrc/pkgtools/pkglint/files/vardefs.go:1.12       Sat Jul  9 09:43:48 2016
+++ pkgsrc/pkgtools/pkglint/files/vardefs.go    Sun Jul 10 11:37:27 2016
@@ -152,6 +152,7 @@ func (gd *GlobalData) InitVartypes() {
        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 @@ func (gd *GlobalData) InitVartypes() {
        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 @@ func (gd *GlobalData) InitVartypes() {
        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 @@ func (gd *GlobalData) InitVartypes() {
        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 @@ func (gd *GlobalData) InitVartypes() {
        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 @@ func (gd *GlobalData) InitVartypes() {
        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 @@ func (gd *GlobalData) InitVartypes() {
        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 @@ func (gd *GlobalData) InitVartypes() {
        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 @@ func (gd *GlobalData) InitVartypes() {
        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 @@ func (gd *GlobalData) InitVartypes() {
        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 @@ func (gd *GlobalData) InitVartypes() {
        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 @@ func (gd *GlobalData) InitVartypes() {
        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 @@ func (gd *GlobalData) InitVartypes() {
        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 {
Index: pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go
diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.12 pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.13
--- pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.12     Sat Jul  9 09:43:48 2016
+++ pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go  Sun Jul 10 11:37:27 2016
@@ -386,6 +386,17 @@ func (s *Suite) Test_VartypeCheck_Variab
        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",

Index: pkgsrc/pkgtools/pkglint/files/vartypecheck.go
diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.16 pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.17
--- pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.16  Sat Jul  9 09:43:48 2016
+++ pkgsrc/pkgtools/pkglint/files/vartypecheck.go       Sun Jul 10 11:37:27 2016
@@ -970,7 +970,7 @@ func (cv *VartypeCheck) Version() {
                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)
        }
 }



Home | Main Index | Thread Index | Old Index