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:           Sat Aug 14 15:11:30 UTC 2021

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

Log Message:
pkgtools/pkglint: update to 21.2.6

Changes since 21.2.5:

Do not warn when a variable SITES.* refers to a GitHub URL directly
instead of using MASTER_SITE_GITHUB.  The variable expression for
supporting multiple master sites would become quite complicated for
human readers, especially with a leading '-' and a long trailing path.


To generate a diff of this commit:
cvs rdiff -u -r1.695 -r1.696 pkgsrc/pkgtools/pkglint/Makefile
cvs rdiff -u -r1.63 -r1.64 pkgsrc/pkgtools/pkglint/files/pkgsrc.go
cvs rdiff -u -r1.97 -r1.98 pkgsrc/pkgtools/pkglint/files/vartypecheck.go
cvs rdiff -u -r1.88 -r1.89 pkgsrc/pkgtools/pkglint/files/vartypecheck_test.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.695 pkgsrc/pkgtools/pkglint/Makefile:1.696
--- pkgsrc/pkgtools/pkglint/Makefile:1.695      Sat Aug 14 08:19:49 2021
+++ pkgsrc/pkgtools/pkglint/Makefile    Sat Aug 14 15:11:30 2021
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.695 2021/08/14 08:19:49 rillig Exp $
+# $NetBSD: Makefile,v 1.696 2021/08/14 15:11:30 rillig Exp $
 
-PKGNAME=       pkglint-21.2.4
+PKGNAME=       pkglint-21.2.6
 CATEGORIES=    pkgtools
 DISTNAME=      tools
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=golang/}

Index: pkgsrc/pkgtools/pkglint/files/pkgsrc.go
diff -u pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.63 pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.64
--- pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.63        Sat Aug 14 08:19:49 2021
+++ pkgsrc/pkgtools/pkglint/files/pkgsrc.go     Sat Aug 14 15:11:30 2021
@@ -363,30 +363,32 @@ func (*Pkgsrc) parseDocChange(line *Line
                author = f[n-2]
        }
 
-       parseAuthorAndDate := func(author *string, date *string) bool {
-               alex := textproc.NewLexer(*author)
+       parseAuthorAndDate := func(authorPtr *string, datePtr *string) bool {
+               alex := textproc.NewLexer(*authorPtr)
                if !alex.SkipByte('[') {
                        return false
                }
-               *author = alex.NextBytesSet(textproc.AlnumU)
+               *authorPtr = alex.NextBytesSet(textproc.AlnumU)
                if !alex.EOF() {
                        return false
                }
-               dlex := textproc.NewLexer(*date)
-               if len(*date) == 11 &&
-                       dlex.NextByteSet(textproc.Digit) != -1 &&
-                       dlex.NextByteSet(textproc.Digit) != -1 &&
-                       dlex.NextByteSet(textproc.Digit) != -1 &&
-                       dlex.NextByteSet(textproc.Digit) != -1 &&
-                       dlex.SkipByte('-') &&
-                       dlex.NextByteSet(textproc.Digit) != -1 &&
-                       dlex.NextByteSet(textproc.Digit) != -1 &&
-                       dlex.SkipByte('-') &&
-                       dlex.NextByteSet(textproc.Digit) != -1 &&
-                       dlex.NextByteSet(textproc.Digit) != -1 &&
-                       dlex.SkipByte(']') &&
-                       dlex.EOF() {
-                       *date = (*date)[:10]
+
+               isDigit := func(b byte) bool { return '0' <= b && b <= '9' }
+
+               date := *datePtr
+               if len(date) == 11 &&
+                       isDigit(date[0]) &&
+                       isDigit(date[1]) &&
+                       isDigit(date[2]) &&
+                       isDigit(date[3]) &&
+                       date[4] == '-' &&
+                       isDigit(date[5]) &&
+                       isDigit(date[6]) &&
+                       date[7] == '-' &&
+                       isDigit(date[8]) &&
+                       isDigit(date[9]) &&
+                       date[10] == ']' {
+                       *datePtr = date[:10]
                        return true
                }
 

Index: pkgsrc/pkgtools/pkglint/files/vartypecheck.go
diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.97 pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.98
--- pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.97  Sat Aug 14 09:46:11 2021
+++ pkgsrc/pkgtools/pkglint/files/vartypecheck.go       Sat Aug 14 15:11:30 2021
@@ -549,6 +549,10 @@ func (cv *VartypeCheck) FetchURL() {
                if !hasPrefix(trimURL, trimSiteURL) {
                        continue
                }
+               if siteName == "MASTER_SITE_GITHUB" &&
+                       hasPrefix(cv.Varname, "SITES.") {
+                       continue
+               }
 
                subdir := trimURL[len(trimSiteURL):]
                if hasPrefix(trimURL, "github.com/") {

Index: pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go
diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.88 pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.89
--- pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.88     Sat Aug 14 09:46:11 2021
+++ pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go  Sat Aug 14 15:11:30 2021
@@ -1011,6 +1011,16 @@ func (s *Suite) Test_VartypeCheck_FetchU
                "https://example.org/$@";)
 
        vt.OutputEmpty()
+
+       // For secondary distfiles, it does not make sense to refer to GitHub
+       // since pulling in the whole github.mk infrastructure is too much
+       // effort.
+       //
+       // Seen in net/unifi on 2021-08-14.
+       vt.Varname("SITES.secondary-distfile")
+       vt.Values("-https://github.com/org/proj/archive/v1.0.0.tar.gz";)
+
+       vt.OutputEmpty()
 }
 
 func (s *Suite) Test_VartypeCheck_FetchURL__without_package(c *check.C) {



Home | Main Index | Thread Index | Old Index