pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint Update pkglint to 5.5.11



details:   https://anonhg.NetBSD.org/pkgsrc/rev/aed34c0f47cb
branches:  trunk
changeset: 380364:aed34c0f47cb
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon May 14 20:25:48 2018 +0000

description:
Update pkglint to 5.5.11

Changes since 5.5.10:
* Read JVMs and compiler languages from mk/* instead of predefined lists.
* Support TEST_DEPENDS.

diffstat:

 pkgtools/pkglint/Makefile         |   4 +-
 pkgtools/pkglint/files/util.go    |  10 +++++++
 pkgtools/pkglint/files/vardefs.go |  54 +++++++++++++++++++++++++++++++++++++-
 3 files changed, 64 insertions(+), 4 deletions(-)

diffs (124 lines):

diff -r e3cc80a7dbe4 -r aed34c0f47cb pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Mon May 14 19:15:35 2018 +0000
+++ b/pkgtools/pkglint/Makefile Mon May 14 20:25:48 2018 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.537 2018/05/01 23:30:11 rillig Exp $
+# $NetBSD: Makefile,v 1.538 2018/05/14 20:25:48 rillig Exp $
 
-PKGNAME=       pkglint-5.5.10
+PKGNAME=       pkglint-5.5.11
 DISTFILES=     # none
 CATEGORIES=    pkgtools
 
diff -r e3cc80a7dbe4 -r aed34c0f47cb pkgtools/pkglint/files/util.go
--- a/pkgtools/pkglint/files/util.go    Mon May 14 19:15:35 2018 +0000
+++ b/pkgtools/pkglint/files/util.go    Mon May 14 20:25:48 2018 +0000
@@ -9,6 +9,7 @@
        "path"
        "path/filepath"
        "regexp"
+       "sort"
        "strconv"
        "strings"
        "time"
@@ -47,6 +48,15 @@
        return b
 }
 
+func keysJoined(m map[string]bool) string {
+       var keys []string
+       for key := range m {
+               keys = append(keys, key)
+       }
+       sort.Strings(keys)
+       return strings.Join(keys, " ")
+}
+
 func imax(a, b int) int {
        if a > b {
                return a
diff -r e3cc80a7dbe4 -r aed34c0f47cb pkgtools/pkglint/files/vardefs.go
--- a/pkgtools/pkglint/files/vardefs.go Mon May 14 19:15:35 2018 +0000
+++ b/pkgtools/pkglint/files/vardefs.go Mon May 14 20:25:48 2018 +0000
@@ -2,6 +2,7 @@
 
 import (
        "fmt"
+       "netbsd.org/pkglint/trace"
        "path"
        "strings"
 )
@@ -70,7 +71,55 @@
                acl(varname, kindOfList, checker, "buildlink3.mk, builtin.mk:; *: use-loadtime, use")
        }
 
-       jvms := enum("openjdk8 oracle-jdk8 openjdk7 sun-jdk7 sun-jdk6 jdk16 jdk15 kaffe") // See mk/java-vm.mk:/_PKG_JVMS/
+       jvms := enum(func() string {
+               lines, _ := readLines(src.File("mk/java-vm.mk"), true)
+               mklines := NewMkLines(lines)
+               jvms := make(map[string]bool)
+               for _, mkline := range mklines.mklines {
+                       if mkline.IsVarassign() && mkline.Varcanon() == "_PKG_JVMS.*" {
+                               words, _ := splitIntoMkWords(mkline.Line, mkline.Value())
+                               for _, word := range words {
+                                       if !contains(word, "$") {
+                                               jvms[word] = true
+                                       }
+                               }
+                       }
+               }
+               if len(jvms) == 0 {
+                       return "openjdk8 oracle-jdk8 openjdk7 sun-jdk7 sun-jdk6 jdk16 jdk15 kaffe"
+               }
+               joined := keysJoined(jvms)
+               if trace.Tracing {
+                       trace.Stepf("JVMs from mk/java-vm.mk: %s", joined)
+               }
+               return joined
+       }())
+
+       languages := enum(
+               func() string {
+                       lines, _ := readLines(src.File("mk/compiler.mk"), true)
+                       mklines := NewMkLines(lines)
+                       languages := make(map[string]bool)
+                       for _, mkline := range mklines.mklines {
+                               if mkline.IsCond() && mkline.Directive() == "for" {
+                                       words := splitOnSpace(mkline.Args())
+                                       if len(words) > 2 && words[0] == "_version_" {
+                                               for _, word := range words[2:] {
+                                                       languages[word] = true
+                                               }
+                                       }
+                               }
+                       }
+                       for _, language := range splitOnSpace("ada c c99 c++ c++11 fortran fortran77 java objc obj-c++") {
+                               languages[language] = true
+                       }
+
+                       joined := keysJoined(languages)
+                       if trace.Tracing {
+                               trace.Stepf("Languages from mk/compiler.mk: %s", joined)
+                       }
+                       return joined
+               }())
 
        // Last synced with mk/defaults/mk.conf revision 1.269
        usr("USE_CWRAPPERS", lkNone, enum("yes no auto"))
@@ -949,6 +998,7 @@
        pkg("SUBST_STAGE.*", lkNone, BtStage)
        pkglist("SUBST_VARS.*", lkShell, BtVariableName)
        pkglist("SUPERSEDES", lkSpace, BtDependency)
+       acl("TEST_DEPENDS", lkSpace, BtDependencyWithPath, "Makefile, Makefile.common, *.mk: append")
        pkglist("TEST_DIRS", lkShell, BtWrksrcSubdirectory)
        pkglist("TEST_ENV", lkShell, BtShellWord)
        acl("TEST_TARGET", lkShell, BtIdentifier, "Makefile: set; Makefile.common: default, set; options.mk: set, append")
@@ -983,7 +1033,7 @@
        acl("USE_IMAKE", lkNone, BtYes, "Makefile: set")
        pkg("USE_JAVA", lkNone, enum("run yes build"))
        pkg("USE_JAVA2", lkNone, enum("YES yes no 1.4 1.5 6 7 8"))
-       acl("USE_LANGUAGES", lkShell, enum("ada c c99 c++ c++11 fortran fortran77 java objc"), "Makefile, Makefile.common, options.mk: set, append")
+       acl("USE_LANGUAGES", lkShell, languages, "Makefile, Makefile.common, options.mk: set, append")
        pkg("USE_LIBTOOL", lkNone, BtYes)
        pkg("USE_MAKEINFO", lkNone, BtYes)
        pkg("USE_MSGFMT_PLURALS", lkNone, BtYes)



Home | Main Index | Thread Index | Old Index