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:           Mon Oct 26 22:13:23 UTC 2020

Modified Files:
        pkgsrc/pkgtools/pkglint: Makefile
        pkgsrc/pkgtools/pkglint/files: vardefs.go

Log Message:
pkgtools/pkglint: update to 20.3.2

Changes since 20.3.1:

The available Java versions are parsed from mk/java-vm.mk instead of
hard-coding them in pkglint.


To generate a diff of this commit:
cvs rdiff -u -r1.672 -r1.673 pkgsrc/pkgtools/pkglint/Makefile
cvs rdiff -u -r1.100 -r1.101 pkgsrc/pkgtools/pkglint/files/vardefs.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.672 pkgsrc/pkgtools/pkglint/Makefile:1.673
--- pkgsrc/pkgtools/pkglint/Makefile:1.672      Thu Oct 15 13:08:28 2020
+++ pkgsrc/pkgtools/pkglint/Makefile    Mon Oct 26 22:13:23 2020
@@ -1,7 +1,6 @@
-# $NetBSD: Makefile,v 1.672 2020/10/15 13:08:28 bsiegert Exp $
+# $NetBSD: Makefile,v 1.673 2020/10/26 22:13:23 rillig Exp $
 
-PKGNAME=       pkglint-20.3.1
-PKGREVISION=   1
+PKGNAME=       pkglint-20.3.2
 CATEGORIES=    pkgtools
 DISTNAME=      tools
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=golang/}

Index: pkgsrc/pkgtools/pkglint/files/vardefs.go
diff -u pkgsrc/pkgtools/pkglint/files/vardefs.go:1.100 pkgsrc/pkgtools/pkglint/files/vardefs.go:1.101
--- pkgsrc/pkgtools/pkglint/files/vardefs.go:1.100      Sat Jun 20 07:00:44 2020
+++ pkgsrc/pkgtools/pkglint/files/vardefs.go    Mon Oct 26 22:13:23 2020
@@ -370,6 +370,48 @@ func (reg *VarTypeRegistry) enumFrom(
        return enum(defval)
 }
 
+// enumFromVarnames parses the variable assignments from the given file and
+// extracts group 1 from each pattern. These groups form the allowed enum
+// values.
+func (reg *VarTypeRegistry) enumFromVarnames(
+       src *Pkgsrc, filename PkgsrcPath, defval string,
+       patterns ...regex.Pattern) *BasicType {
+
+       mklines := src.LoadMkExisting(filename)
+       if mklines == nil {
+               return enum(defval)
+       }
+
+       values := make(map[string]bool)
+       for _, mkline := range mklines.mklines {
+               if !mkline.IsVarassign() {
+                       continue
+               }
+
+               varname := mkline.Varname()
+               for _, pattern := range patterns {
+                       m, value := match1(varname, pattern)
+                       if m && !contains(value, "$") {
+                               values[intern(value)] = true
+                       }
+               }
+       }
+
+       if len(values) > 0 {
+               joined := keysJoined(values)
+               if trace.Tracing {
+                       trace.Stepf("Enum from %s with values: %s", filename, joined)
+               }
+               return enum(joined)
+       }
+
+       G.Logger.TechFatalf(
+               mklines.lines.Filename,
+               "Must contain at least 1 variable definition for %s.",
+               string(patterns[0]))
+       return nil // unreachable
+}
+
 // enumFromDirs reads the package directories from category, takes all
 // that have a single number in them (such as php72) and ranks them
 // from earliest to latest.
@@ -522,6 +564,10 @@ func (reg *VarTypeRegistry) Init(src *Pk
                "mk/java-vm.mk",
                "openjdk8 oracle-jdk8 openjdk7 sun-jdk7 jdk16 jdk15 kaffe",
                "_PKG_JVMS.*")
+       javaVersions := reg.enumFromVarnames(src,
+               "mk/java-vm.mk",
+               "yes 8 9",
+               `^_PKG_JVMS\.(.*)$`)
 
        operatingSystems := reg.enumFromFiles(src,
                "mk/platform",
@@ -1726,7 +1772,7 @@ func (reg *VarTypeRegistry) Init(src *Pk
        reg.pkgload("USE_GNU_ICONV", BtYes)
        reg.pkg("USE_IMAKE", BtYes)
        reg.pkg("USE_JAVA", enum("run yes build"))
-       reg.pkg("USE_JAVA2", enum("YES yes no 1.4 1.5 6 7 8"))
+       reg.pkg("USE_JAVA2", javaVersions)
        reg.pkglist("USE_LANGUAGES", reg.compilerLanguages(src))
        reg.pkg("USE_LIBTOOL", BtYes)
        reg.pkg("USE_MAKEINFO", BtYes)



Home | Main Index | Thread Index | Old Index