pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint pkgtools/pkglint: update to 21.2.6



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d6eebc276b19
branches:  trunk
changeset: 457038:d6eebc276b19
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Aug 14 15:11:30 2021 +0000

description:
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.

diffstat:

 pkgtools/pkglint/Makefile                   |   4 +-
 pkgtools/pkglint/files/pkgsrc.go            |  38 +++++++++++++++-------------
 pkgtools/pkglint/files/vartypecheck.go      |   4 +++
 pkgtools/pkglint/files/vartypecheck_test.go |  10 +++++++
 4 files changed, 36 insertions(+), 20 deletions(-)

diffs (100 lines):

diff -r d768c231a663 -r d6eebc276b19 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Sat Aug 14 14:59:02 2021 +0000
+++ b/pkgtools/pkglint/Makefile Sat Aug 14 15:11:30 2021 +0000
@@ -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/}
diff -r d768c231a663 -r d6eebc276b19 pkgtools/pkglint/files/pkgsrc.go
--- a/pkgtools/pkglint/files/pkgsrc.go  Sat Aug 14 14:59:02 2021 +0000
+++ b/pkgtools/pkglint/files/pkgsrc.go  Sat Aug 14 15:11:30 2021 +0000
@@ -363,30 +363,32 @@
                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
                }
 
diff -r d768c231a663 -r d6eebc276b19 pkgtools/pkglint/files/vartypecheck.go
--- a/pkgtools/pkglint/files/vartypecheck.go    Sat Aug 14 14:59:02 2021 +0000
+++ b/pkgtools/pkglint/files/vartypecheck.go    Sat Aug 14 15:11:30 2021 +0000
@@ -549,6 +549,10 @@
                if !hasPrefix(trimURL, trimSiteURL) {
                        continue
                }
+               if siteName == "MASTER_SITE_GITHUB" &&
+                       hasPrefix(cv.Varname, "SITES.") {
+                       continue
+               }
 
                subdir := trimURL[len(trimSiteURL):]
                if hasPrefix(trimURL, "github.com/") {
diff -r d768c231a663 -r d6eebc276b19 pkgtools/pkglint/files/vartypecheck_test.go
--- a/pkgtools/pkglint/files/vartypecheck_test.go       Sat Aug 14 14:59:02 2021 +0000
+++ b/pkgtools/pkglint/files/vartypecheck_test.go       Sat Aug 14 15:11:30 2021 +0000
@@ -1011,6 +1011,16 @@
                "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