diff options
author | rillig <rillig@pkgsrc.org> | 2021-08-14 15:11:30 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2021-08-14 15:11:30 +0000 |
commit | 05f518320d5e4056f3df090a473cfe108b39b006 (patch) | |
tree | 8a6d5045df79cc9d0abdcabc16469274171c1a48 /pkgtools | |
parent | 75aba17edf6ccee82f26878085d1e81b8a807981 (diff) | |
download | pkgsrc-05f518320d5e4056f3df090a473cfe108b39b006.tar.gz |
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 (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pkglint/files/pkgsrc.go | 38 | ||||
-rw-r--r-- | pkgtools/pkglint/files/vartypecheck.go | 4 | ||||
-rw-r--r-- | pkgtools/pkglint/files/vartypecheck_test.go | 10 |
4 files changed, 36 insertions, 20 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile index 29cc0e9c4fc..fb23bbad75a 100644 --- a/pkgtools/pkglint/Makefile +++ b/pkgtools/pkglint/Makefile @@ -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 --git a/pkgtools/pkglint/files/pkgsrc.go b/pkgtools/pkglint/files/pkgsrc.go index 20787615288..ff11a717b12 100644 --- a/pkgtools/pkglint/files/pkgsrc.go +++ b/pkgtools/pkglint/files/pkgsrc.go @@ -363,30 +363,32 @@ func (*Pkgsrc) parseDocChange(line *Line, warn bool) *Change { 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 --git a/pkgtools/pkglint/files/vartypecheck.go b/pkgtools/pkglint/files/vartypecheck.go index 3db345c17d2..71e41860f25 100644 --- a/pkgtools/pkglint/files/vartypecheck.go +++ b/pkgtools/pkglint/files/vartypecheck.go @@ -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/") { diff --git a/pkgtools/pkglint/files/vartypecheck_test.go b/pkgtools/pkglint/files/vartypecheck_test.go index ad7905e43c4..bfc6637c471 100644 --- a/pkgtools/pkglint/files/vartypecheck_test.go +++ b/pkgtools/pkglint/files/vartypecheck_test.go @@ -1011,6 +1011,16 @@ func (s *Suite) Test_VartypeCheck_FetchURL(c *check.C) { "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) { |