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: Fri Oct 11 23:30:02 UTC 2019
Modified Files:
pkgsrc/pkgtools/pkglint: Makefile
pkgsrc/pkgtools/pkglint/files: buildlink3.go buildlink3_test.go
mkshparser_test.go package.go pkgsrc.go pkgsrc_test.go shell.y
vartypecheck.go vartypecheck_test.go
Log Message:
pkgtools/pkglint: update to 19.3.1
Changes since 19.3.0:
* In buildlink3.mk files, the package identifier doesn't have to match
the PKGBASE from the package Makefile exactly. The PKGBASE may have a
leading "lib" (for libiconv and libgettext), as well as a trailing
number (for emacs20 and netatalk22).
* GITHUB_RELEASE is added to the variables that should appear in a fixed
order in the package Makefile.
* In the MASTER_SITE URLs, the transport protocol is irrelevant for
matching direct URLs to the predefined MASTER_SITE_* variables.
To generate a diff of this commit:
cvs rdiff -u -r1.599 -r1.600 pkgsrc/pkgtools/pkglint/Makefile
cvs rdiff -u -r1.24 -r1.25 pkgsrc/pkgtools/pkglint/files/buildlink3.go
cvs rdiff -u -r1.32 -r1.33 pkgsrc/pkgtools/pkglint/files/buildlink3_test.go
cvs rdiff -u -r1.18 -r1.19 pkgsrc/pkgtools/pkglint/files/mkshparser_test.go
cvs rdiff -u -r1.63 -r1.64 pkgsrc/pkgtools/pkglint/files/package.go \
pkgsrc/pkgtools/pkglint/files/vartypecheck.go
cvs rdiff -u -r1.36 -r1.37 pkgsrc/pkgtools/pkglint/files/pkgsrc.go
cvs rdiff -u -r1.30 -r1.31 pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go
cvs rdiff -u -r1.5 -r1.6 pkgsrc/pkgtools/pkglint/files/shell.y
cvs rdiff -u -r1.55 -r1.56 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.599 pkgsrc/pkgtools/pkglint/Makefile:1.600
--- pkgsrc/pkgtools/pkglint/Makefile:1.599 Tue Oct 1 21:37:59 2019
+++ pkgsrc/pkgtools/pkglint/Makefile Fri Oct 11 23:30:02 2019
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.599 2019/10/01 21:37:59 rillig Exp $
+# $NetBSD: Makefile,v 1.600 2019/10/11 23:30:02 rillig Exp $
-PKGNAME= pkglint-19.3.0
+PKGNAME= pkglint-19.3.1
CATEGORIES= pkgtools
DISTNAME= tools
MASTER_SITES= ${MASTER_SITE_GITHUB:=golang/}
Index: pkgsrc/pkgtools/pkglint/files/buildlink3.go
diff -u pkgsrc/pkgtools/pkglint/files/buildlink3.go:1.24 pkgsrc/pkgtools/pkglint/files/buildlink3.go:1.25
--- pkgsrc/pkgtools/pkglint/files/buildlink3.go:1.24 Sun Jul 14 21:25:47 2019
+++ pkgsrc/pkgtools/pkglint/files/buildlink3.go Fri Oct 11 23:30:02 2019
@@ -119,8 +119,6 @@ func (ck *Buildlink3Checker) checkUnique
// introduces the uppercase package identifier.
func (ck *Buildlink3Checker) checkSecondParagraph(mlex *MkLinesLexer) bool {
pkgbase := ck.pkgbase
- pkgbaseLine := ck.pkgbaseLine
-
m := mlex.NextRegexp(`^\.if !defined\(([^\t ]+)_BUILDLINK3_MK\)$`)
if m == nil {
return false
@@ -136,18 +134,31 @@ func (ck *Buildlink3Checker) checkSecond
ucPkgbase := strings.ToUpper(strings.Replace(pkgbase, "-", "_", -1))
if ucPkgbase != pkgupper && !containsVarRef(pkgbase) {
pkgupperLine.Errorf("Package name mismatch between multiple-inclusion guard %q (expected %q) and package name %q (from %s).",
- pkgupper, ucPkgbase, pkgbase, pkgupperLine.RefTo(pkgbaseLine))
- }
- if G.Pkg != nil {
- if mkbase := G.Pkg.EffectivePkgbase; mkbase != "" && mkbase != pkgbase {
- pkgbaseLine.Errorf("Package name mismatch between %q in this file and %q from %s.",
- pkgbase, mkbase, pkgbaseLine.RefTo(G.Pkg.EffectivePkgnameLine))
- }
+ pkgupper, ucPkgbase, pkgbase, pkgupperLine.RefTo(ck.pkgbaseLine))
}
+ ck.checkPkgbaseMismatch(pkgbase)
return true
}
+func (ck *Buildlink3Checker) checkPkgbaseMismatch(bl3base string) {
+ if G.Pkg == nil {
+ return
+ }
+
+ mkbase := G.Pkg.EffectivePkgbase
+ if mkbase == "" || mkbase == bl3base || strings.TrimPrefix(mkbase, "lib") == bl3base {
+ return
+ }
+
+ if hasPrefix(mkbase, bl3base) && matches(mkbase[len(bl3base):], `^\d+$`) {
+ return
+ }
+
+ ck.pkgbaseLine.Errorf("Package name mismatch between %q in this file and %q from %s.",
+ bl3base, mkbase, ck.pkgbaseLine.RefTo(G.Pkg.EffectivePkgnameLine))
+}
+
// Third paragraph: Package information.
func (ck *Buildlink3Checker) checkMainPart(mlex *MkLinesLexer) bool {
pkgbase := ck.pkgbase
Index: pkgsrc/pkgtools/pkglint/files/buildlink3_test.go
diff -u pkgsrc/pkgtools/pkglint/files/buildlink3_test.go:1.32 pkgsrc/pkgtools/pkglint/files/buildlink3_test.go:1.33
--- pkgsrc/pkgtools/pkglint/files/buildlink3_test.go:1.32 Sun Jun 30 20:56:19 2019
+++ pkgsrc/pkgtools/pkglint/files/buildlink3_test.go Fri Oct 11 23:30:02 2019
@@ -164,6 +164,71 @@ func (s *Suite) Test_CheckLinesBuildlink
t.CheckOutputEmpty()
}
+func (s *Suite) Test_CheckLinesBuildlink3Mk__name_mismatch__lib(c *check.C) {
+ t := s.Init(c)
+
+ t.SetUpPackage("converters/libiconv")
+ t.CreateFileLines("converters/libiconv/buildlink3.mk",
+ MkCvsID,
+ "",
+ "BUILDLINK_TREE+=\ticonv",
+ "",
+ ".if !defined(ICONV_BUILDLINK3_MK)",
+ "ICONV_BUILDLINK3_MK:=",
+ "",
+ "BUILDLINK_API_DEPENDS.iconv+=\tlibiconv>=1.0",
+ "BUILDLINK_ABI_DEPENDS.iconv+=\tlibiconv>=1.0",
+ "",
+ ".endif\t# ICONV_BUILDLINK3_MK",
+ "",
+ "BUILDLINK_TREE+=\t-iconv")
+ t.FinishSetUp()
+
+ G.Check(t.File("converters/libiconv"))
+
+ // Up to 2019-10-12, pkglint complained about a mismatch
+ // between the package name from buildlink3.mk (iconv) and the
+ // one from the package Makefile (libiconv).
+ //
+ // This mismatch is not important enough to warrant a global
+ // renaming of the buildlink3 identifier, therefore the warning
+ // is suppressed in cases like this.
+ t.CheckOutputEmpty()
+}
+
+func (s *Suite) Test_CheckLinesBuildlink3Mk__name_mismatch__version(c *check.C) {
+ t := s.Init(c)
+
+ t.SetUpPackage("editors/emacs22",
+ "PKGNAME=\temacs22-22.0")
+ t.CreateFileLines("editors/emacs22/buildlink3.mk",
+ MkCvsID,
+ "",
+ "BUILDLINK_TREE+=\temacs",
+ "",
+ ".if !defined(EMACS_BUILDLINK3_MK)",
+ "EMACS_BUILDLINK3_MK:=",
+ "",
+ "BUILDLINK_API_DEPENDS.emacs+=\temacs22>=1.0",
+ "BUILDLINK_ABI_DEPENDS.emacs+=\temacs22>=1.0",
+ "",
+ ".endif\t# EMACS_BUILDLINK3_MK",
+ "",
+ "BUILDLINK_TREE+=\t-emacs")
+ t.FinishSetUp()
+
+ G.Check(t.File("editors/emacs22"))
+
+ // Up to 2019-10-12, pkglint complained about a mismatch
+ // between the package name from buildlink3.mk (emacs) and the
+ // one from the package Makefile (emacs22).
+ //
+ // This mismatch is not important enough to warrant a global
+ // renaming of the buildlink3 identifier, therefore the warning
+ // is suppressed in cases like this.
+ t.CheckOutputEmpty()
+}
+
func (s *Suite) Test_CheckLinesBuildlink3Mk__name_mismatch_multiple_inclusion(c *check.C) {
t := s.Init(c)
Index: pkgsrc/pkgtools/pkglint/files/mkshparser_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mkshparser_test.go:1.18 pkgsrc/pkgtools/pkglint/files/mkshparser_test.go:1.19
--- pkgsrc/pkgtools/pkglint/files/mkshparser_test.go:1.18 Wed Aug 21 16:45:17 2019
+++ pkgsrc/pkgtools/pkglint/files/mkshparser_test.go Fri Oct 11 23:30:02 2019
@@ -331,12 +331,24 @@ func (s *ShSuite) Test_ShellParser__for_
b.Words("a", "b", "c"),
b.List().AddCommand(b.SimpleCommand("echo", "$var")).AddSemicolon())))
+ s.test("for var \n in ; do echo $var ; done",
+ b.List().AddCommand(b.For(
+ "var",
+ nil,
+ b.List().AddCommand(b.SimpleCommand("echo", "$var")).AddSemicolon())))
+
s.test("for var in in esac ; do echo $var ; done",
b.List().AddCommand(b.For(
"var",
b.Words("in", "esac"),
b.List().AddCommand(b.SimpleCommand("echo", "$var")).AddSemicolon())))
+ s.test("for var in \n do : ; done",
+ b.List().AddCommand(b.For(
+ "var",
+ nil,
+ b.List().AddCommand(b.SimpleCommand(":")).AddSemicolon())))
+
// No semicolon necessary between the two "done".
s.test("for i in 1; do for j in 1; do echo $$i$$j; done done",
b.List().AddCommand(b.For(
@@ -385,6 +397,20 @@ func (s *ShSuite) Test_ShellParser__case
b.Words("pattern"),
b.List().AddCommand(b.SimpleCommand("case-item-action")), sepNone))))
+ s.test("case selector in pattern) \n case-item-action ; esac",
+ b.List().AddCommand(b.Case(
+ b.Token("selector"),
+ b.CaseItem(
+ b.Words("pattern"),
+ b.List().AddCommand(b.SimpleCommand("case-item-action")), sepSemicolon))))
+
+ s.test("case selector in pattern) action \n esac",
+ b.List().AddCommand(b.Case(
+ b.Token("selector"),
+ b.CaseItem(
+ b.Words("pattern"),
+ b.List().AddCommand(b.SimpleCommand("action")), sepNone))))
+
s.test("case $$expr in (if|then|else) ;; esac",
b.List().AddCommand(b.Case(
b.Token("$$expr"),
@@ -433,6 +459,14 @@ func (s *ShSuite) Test_ShellParser__if_c
b.List().AddCommand(b.If(
b.List().AddCommand(b.SimpleCommand("cond2")).AddSemicolon(),
b.List().AddCommand(b.SimpleCommand("action")).AddSemicolon())))))
+
+ s.test("if cond1; then action1; elif cond2; then action2; else action3; fi",
+ b.List().AddCommand(b.If(
+ b.List().AddCommand(b.SimpleCommand("cond1")).AddSemicolon(),
+ b.List().AddCommand(b.SimpleCommand("action1")).AddSemicolon(),
+ b.List().AddCommand(b.SimpleCommand("cond2")).AddSemicolon(),
+ b.List().AddCommand(b.SimpleCommand("action2")).AddSemicolon(),
+ b.List().AddCommand(b.SimpleCommand("action3")).AddSemicolon())))
}
func (s *ShSuite) Test_ShellParser__while_clause(c *check.C) {
@@ -526,7 +560,7 @@ func (s *ShSuite) Test_ShellParser__io_r
s.test("echo >> ${PLIST_SRC}",
b.List().AddCommand(b.SimpleCommand("echo", ">>${PLIST_SRC}")))
- s.test("echo 1>output 2>>append 3>|clobber 4>&5 6<input >>append",
+ s.test("echo 1>output 2>>append 3>|clobber 4>&5 6<input >>append <&input <>diamond <<-here",
b.List().AddCommand(&MkShCommand{Simple: &MkShSimpleCommand{
Assignments: nil,
Name: b.Token("echo"),
@@ -537,9 +571,12 @@ func (s *ShSuite) Test_ShellParser__io_r
{3, ">|", b.Token("clobber")},
{4, ">&", b.Token("5")},
{6, "<", b.Token("input")},
- {-1, ">>", b.Token("append")}}}}))
+ {-1, ">>", b.Token("append")},
+ {-1, "<&", b.Token("input")},
+ {-1, "<>", b.Token("diamond")},
+ {-1, "<<-", b.Token("here")}}}}))
- s.test("echo 1> output 2>> append 3>| clobber 4>& 5 6< input >> append",
+ s.test("echo 1> output 2>> append 3>| clobber 4>& 5 6< input >> append <& input <> diamond <<- here",
b.List().AddCommand(&MkShCommand{Simple: &MkShSimpleCommand{
Assignments: nil,
Name: b.Token("echo"),
@@ -550,7 +587,10 @@ func (s *ShSuite) Test_ShellParser__io_r
{3, ">|", b.Token("clobber")},
{4, ">&", b.Token("5")},
{6, "<", b.Token("input")},
- {-1, ">>", b.Token("append")}}}}))
+ {-1, ">>", b.Token("append")},
+ {-1, "<&", b.Token("input")},
+ {-1, "<>", b.Token("diamond")},
+ {-1, "<<-", b.Token("here")}}}}))
s.test("${MAKE} print-summary-data 2>&1 > /dev/stderr",
b.List().AddCommand(&MkShCommand{Simple: &MkShSimpleCommand{
@@ -560,11 +600,60 @@ func (s *ShSuite) Test_ShellParser__io_r
Redirections: []*MkShRedirection{
{2, ">&", b.Token("1")},
{-1, ">", b.Token("/dev/stderr")}}}}))
+
+ s.test("1> output command",
+ b.List().AddCommand(&MkShCommand{Simple: &MkShSimpleCommand{
+ Name: b.Token("command"),
+ Redirections: []*MkShRedirection{
+ {1, ">", b.Token("output")}}}}))
+
+ s.test("ENV=value 1> output command",
+ b.List().AddCommand(&MkShCommand{Simple: &MkShSimpleCommand{
+ Assignments: []*ShToken{b.Token("ENV=value")},
+ Name: b.Token("command"),
+ Redirections: []*MkShRedirection{
+ {1, ">", b.Token("output")}}}}))
+}
+
+func (s *ShSuite) Test_ShellParser__redirect_list(c *check.C) {
+ b := s.init(c)
+
+ s.test("(:) 1>out",
+ b.List().AddCommand(
+ b.Redirected(
+ b.Subshell(b.List().AddCommand(b.SimpleCommand(":"))),
+ b.Redirection(1, ">", "out"))))
+
+ s.test("(:) 1>out 2>out",
+ b.List().AddCommand(
+ b.Redirected(
+ b.Subshell(b.List().AddCommand(b.SimpleCommand(":"))),
+ b.Redirection(1, ">", "out"),
+ b.Redirection(2, ">", "out"))))
}
func (s *ShSuite) Test_ShellParser__io_here(c *check.C) {
- // In pkgsrc Makefiles, the IO here-documents cannot be used since all the text
- // is joined into a single line. Therefore there are no tests here.
+ // In pkgsrc Makefiles, the IO here-documents cannot be used since
+ // all the text is joined into a single line. Therefore these test
+ // cases only show that pkglint can indeed not parse <<EOF
+ // redirections.
+ b := s.init(c)
+
+ s.test("<<EOF\ntext\nEOF",
+ b.List().
+ AddCommand(b.SimpleCommand("<<EOF")).
+ AddNewline().
+ AddCommand(b.SimpleCommand("text")). // This is wrong.
+ AddNewline().
+ AddCommand(b.SimpleCommand("EOF"))) // This is wrong.
+
+ s.test("1<<EOF\ntext\nEOF",
+ b.List().
+ AddCommand(b.SimpleCommand("1<<EOF")).
+ AddNewline().
+ AddCommand(b.SimpleCommand("text")). // This is wrong.
+ AddNewline().
+ AddCommand(b.SimpleCommand("EOF"))) // This is wrong.
}
func (s *ShSuite) init(c *check.C) *MkShBuilder {
@@ -766,6 +855,9 @@ func (b *MkShBuilder) Pipeline(negated b
return NewMkShPipeline(negated, cmds)
}
+// SimpleCommand classifies the given arguments into variable assignments
+// (only at the beginning of the command), the command name, arguments and
+// redirections. It is not intended to cover any edge cases.
func (b *MkShBuilder) SimpleCommand(words ...string) *MkShCommand {
cmd := MkShSimpleCommand{}
assignments := true
@@ -787,6 +879,9 @@ func (b *MkShBuilder) SimpleCommand(word
return &MkShCommand{Simple: &cmd}
}
+// If creates an if-then-elif-then-else sequence.
+// The first arguments are pairs of conditions and actions.
+// The remaining argument, if any, is the else action.
func (b *MkShBuilder) If(condActionElse ...*MkShList) *MkShCommand {
ifClause := MkShIf{}
for i, part := range condActionElse {
@@ -846,6 +941,11 @@ func (b *MkShBuilder) Subshell(list *MkS
return &MkShCommand{Compound: &MkShCompoundCommand{Subshell: list}}
}
+func (b *MkShBuilder) Redirected(cmd *MkShCommand, redirects ...*MkShRedirection) *MkShCommand {
+ cmd.Redirects = redirects
+ return cmd
+}
+
func (b *MkShBuilder) Token(mktext string) *ShToken {
tokenizer := NewShTokenizer(dummyLine, mktext, false)
token := tokenizer.ShToken()
Index: pkgsrc/pkgtools/pkglint/files/package.go
diff -u pkgsrc/pkgtools/pkglint/files/package.go:1.63 pkgsrc/pkgtools/pkglint/files/package.go:1.64
--- pkgsrc/pkgtools/pkglint/files/package.go:1.63 Tue Oct 1 21:37:59 2019
+++ pkgsrc/pkgtools/pkglint/files/package.go Fri Oct 11 23:30:02 2019
@@ -980,6 +980,7 @@ func (pkg *Package) CheckVarorder(mkline
var variables = []Variable{
{"GITHUB_PROJECT", optional}, // either here or below MASTER_SITES
{"GITHUB_TAG", optional},
+ {"GITHUB_RELEASE", optional},
{"DISTNAME", optional},
{"PKGNAME", optional},
{"R_PKGNAME", optional},
@@ -989,6 +990,7 @@ func (pkg *Package) CheckVarorder(mkline
{"MASTER_SITES", many},
{"GITHUB_PROJECT", optional}, // either here or at the very top
{"GITHUB_TAG", optional},
+ {"GITHUB_RELEASE", optional},
{"DIST_SUBDIR", optional},
{"EXTRACT_SUFX", optional},
{"DISTFILES", many},
Index: pkgsrc/pkgtools/pkglint/files/vartypecheck.go
diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.63 pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.64
--- pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.63 Tue Oct 1 21:37:59 2019
+++ pkgsrc/pkgtools/pkglint/files/vartypecheck.go Fri Oct 11 23:30:02 2019
@@ -560,18 +560,24 @@ func (cv *VartypeCheck) FetchURL() {
cv.WithValue(url).URL()
- for siteURL, siteName := range G.Pkgsrc.MasterSiteURLToVar {
- if hasPrefix(url, siteURL) {
- subdir := url[len(siteURL):]
- if hasPrefix(url, "https://github.com/") {
- subdir = strings.SplitAfter(subdir, "/")[0]
- cv.Warnf("Please use ${%s%s:=%s} instead of %q and run %q for further instructions.",
- siteName, hyphenSubst, subdir, hyphen+url[:len(siteURL)+len(subdir)], bmakeHelp("github"))
- } else {
- cv.Warnf("Please use ${%s%s:=%s} instead of %q.", siteName, hyphenSubst, subdir, hyphen+url)
- }
- return
+ trimURL := url[len(url)-len(replaceAll(url, `^\w+://`, "")):]
+ protoLen := len(url) - len(trimURL)
+
+ for trimSiteURL, siteName := range G.Pkgsrc.MasterSiteURLToVar {
+ if !hasPrefix(trimURL, trimSiteURL) {
+ continue
}
+
+ subdir := trimURL[len(trimSiteURL):]
+ if hasPrefix(trimURL, "github.com/") {
+ subdir = strings.SplitAfter(subdir, "/")[0]
+ commonPrefix := hyphen + url[:protoLen+len(trimSiteURL)+len(subdir)]
+ cv.Warnf("Please use ${%s%s:=%s} instead of %q and run %q for further instructions.",
+ siteName, hyphenSubst, subdir, commonPrefix, bmakeHelp("github"))
+ } else {
+ cv.Warnf("Please use ${%s%s:=%s} instead of %q.", siteName, hyphenSubst, subdir, hyphen+url)
+ }
+ return
}
tokens := cv.MkLine.Tokenize(url, false)
Index: pkgsrc/pkgtools/pkglint/files/pkgsrc.go
diff -u pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.36 pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.37
--- pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.36 Tue Oct 1 21:37:59 2019
+++ pkgsrc/pkgtools/pkglint/files/pkgsrc.go Fri Oct 11 23:30:02 2019
@@ -28,7 +28,7 @@ type Pkgsrc struct {
Tools *Tools
- MasterSiteURLToVar map[string]string // "https://github.com/" => "MASTER_SITE_GITHUB"
+ MasterSiteURLToVar map[string]string // "github.com/" => "MASTER_SITE_GITHUB"
MasterSiteVarToURL map[string]string // "MASTER_SITE_GITHUB" => "https://github.com/"
PkgOptions map[string]string // "x11" => "Provides X11 support"
@@ -921,7 +921,7 @@ func (src *Pkgsrc) registerMasterSite(va
if nameToURL[varname] == "" {
nameToURL[varname] = url
}
- urlToName[url] = varname
+ urlToName[replaceAll(url, `^\w+://`, "")] = varname
}
func (src *Pkgsrc) loadPkgOptions() {
Index: pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go
diff -u pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go:1.30 pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go:1.31
--- pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go:1.30 Tue Oct 1 21:37:59 2019
+++ pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go Fri Oct 11 23:30:02 2019
@@ -24,16 +24,16 @@ func (s *Suite) Test_Pkgsrc_loadMasterSi
G.Pkgsrc.loadMasterSites()
- t.CheckEquals(G.Pkgsrc.MasterSiteURLToVar["https://example.org/distfiles/"], "MASTER_SITE_A")
- t.CheckEquals(G.Pkgsrc.MasterSiteURLToVar["https://b.example.org/distfiles/"], "MASTER_SITE_B")
- t.CheckEquals(G.Pkgsrc.MasterSiteURLToVar["https://b2.example.org/distfiles/"], "MASTER_SITE_B")
- t.CheckEquals(G.Pkgsrc.MasterSiteURLToVar["https://a.example.org/distfiles/"], "MASTER_SITE_A")
+ t.CheckEquals(G.Pkgsrc.MasterSiteURLToVar["example.org/distfiles/"], "MASTER_SITE_A")
+ t.CheckEquals(G.Pkgsrc.MasterSiteURLToVar["b.example.org/distfiles/"], "MASTER_SITE_B")
+ t.CheckEquals(G.Pkgsrc.MasterSiteURLToVar["b2.example.org/distfiles/"], "MASTER_SITE_B")
+ t.CheckEquals(G.Pkgsrc.MasterSiteURLToVar["a.example.org/distfiles/"], "MASTER_SITE_A")
t.CheckEquals(G.Pkgsrc.MasterSiteVarToURL["MASTER_SITE_A"], "https://example.org/distfiles/")
t.CheckEquals(G.Pkgsrc.MasterSiteVarToURL["MASTER_SITE_B"], "https://b.example.org/distfiles/")
// Ignored entries:
t.CheckEquals(G.Pkgsrc.MasterSiteURLToVar["${other}"], "")
- t.CheckEquals(G.Pkgsrc.MasterSiteURLToVar["https://backup.example.org/"], "")
+ t.CheckEquals(G.Pkgsrc.MasterSiteURLToVar["backup.example.org/"], "")
t.CheckEquals(G.Pkgsrc.MasterSiteVarToURL["MASTER_SITE_BACKUP"], "")
}
Index: pkgsrc/pkgtools/pkglint/files/shell.y
diff -u pkgsrc/pkgtools/pkglint/files/shell.y:1.5 pkgsrc/pkgtools/pkglint/files/shell.y:1.6
--- pkgsrc/pkgtools/pkglint/files/shell.y:1.5 Fri Aug 2 18:55:07 2019
+++ pkgsrc/pkgtools/pkglint/files/shell.y Fri Oct 11 23:30:02 2019
@@ -61,7 +61,7 @@ start : program {
}
program : compound_list {
- $$ = $1
+ /* empty */
}
program : /* empty */ {
$$ = &MkShList{}
Index: pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go
diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.55 pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.56
--- pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.55 Tue Oct 1 21:37:59 2019
+++ pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go Fri Oct 11 23:30:02 2019
@@ -605,6 +605,30 @@ func (s *Suite) Test_VartypeCheck_FetchU
"WARN: filename.mk:71: The fetch URL \"https://example.org/pub\" should end with a slash.",
"WARN: filename.mk:72: \"https://example.org/$@\" is not a valid URL.",
"WARN: filename.mk:75: The fetch URL \"https://example.org/download?\" should end with a slash.")
+
+ // The transport protocol doesn't matter for matching the MASTER_SITEs.
+ // See url2pkg.py, function adjust_site_from_sites_mk.
+ vt.Values(
+ "http://ftp.gnu.org/pub/gnu/bash/",
+ "ftp://ftp.gnu.org/pub/gnu/bash/",
+ "https://ftp.gnu.org/pub/gnu/bash/",
+ "-http://ftp.gnu.org/pub/gnu/bash/bash-5.0.tar.gz",
+ "-ftp://ftp.gnu.org/pub/gnu/bash/bash-5.0.tar.gz",
+ "-https://ftp.gnu.org/pub/gnu/bash/bash-5.0.tar.gz")
+
+ vt.Output(
+ "WARN: filename.mk:81: Please use ${MASTER_SITE_GNU:=bash/} "+
+ "instead of \"http://ftp.gnu.org/pub/gnu/bash/\".",
+ "WARN: filename.mk:82: Please use ${MASTER_SITE_GNU:=bash/} "+
+ "instead of \"ftp://ftp.gnu.org/pub/gnu/bash/\".",
+ "WARN: filename.mk:83: Please use ${MASTER_SITE_GNU:=bash/} "+
+ "instead of \"https://ftp.gnu.org/pub/gnu/bash/\".",
+ "WARN: filename.mk:84: Please use ${MASTER_SITE_GNU:S,^,-,:=bash/bash-5.0.tar.gz} "+
+ "instead of \"-http://ftp.gnu.org/pub/gnu/bash/bash-5.0.tar.gz\".",
+ "WARN: filename.mk:85: Please use ${MASTER_SITE_GNU:S,^,-,:=bash/bash-5.0.tar.gz} "+
+ "instead of \"-ftp://ftp.gnu.org/pub/gnu/bash/bash-5.0.tar.gz\".",
+ "WARN: filename.mk:86: Please use ${MASTER_SITE_GNU:S,^,-,:=bash/bash-5.0.tar.gz} "+
+ "instead of \"-https://ftp.gnu.org/pub/gnu/bash/bash-5.0.tar.gz\".")
}
func (s *Suite) Test_VartypeCheck_FetchURL__without_package(c *check.C) {
Home |
Main Index |
Thread Index |
Old Index