summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2018-12-21 19:46:48 +0000
committerrillig <rillig@pkgsrc.org>2018-12-21 19:46:48 +0000
commitd6745b1e2c5fa06b029995c3ef9c6909fc8d4bd8 (patch)
treeea00d78e2b242f05f263072f0306e0199a1c5f99 /pkgtools
parent7365191674132f5dfd8cc002cf82f3c0e2014fbb (diff)
downloadpkgsrc-d6745b1e2c5fa06b029995c3ef9c6909fc8d4bd8.tar.gz
pkgtools/pkglint: fix alternatives check
The alternatives implementation may have command line arguments.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/files/alternatives.go2
-rw-r--r--pkgtools/pkglint/files/alternatives_test.go5
-rw-r--r--pkgtools/pkglint/files/lines_test.go8
3 files changed, 8 insertions, 7 deletions
diff --git a/pkgtools/pkglint/files/alternatives.go b/pkgtools/pkglint/files/alternatives.go
index d7485f4d13e..c87f6b0a89a 100644
--- a/pkgtools/pkglint/files/alternatives.go
+++ b/pkgtools/pkglint/files/alternatives.go
@@ -45,7 +45,7 @@ func CheckFileAlternatives(filename string) {
}
for _, line := range lines.Lines {
- m, wrapper, space, alternative := match3(line.Text, `^([^\t ]+)([ \t]+)([^\t ]+)$`)
+ m, wrapper, space, alternative := match3(line.Text, `^([^\t ]+)([ \t]+)([^\t ]+)`)
if !m {
line.Errorf("Invalid line %q.", line.Text)
G.Explain(
diff --git a/pkgtools/pkglint/files/alternatives_test.go b/pkgtools/pkglint/files/alternatives_test.go
index a91baf0cf45..760dc2f9071 100644
--- a/pkgtools/pkglint/files/alternatives_test.go
+++ b/pkgtools/pkglint/files/alternatives_test.go
@@ -30,7 +30,7 @@ func (s *Suite) Test_CheckFileAlternatives__PLIST(c *check.C) {
"ERROR: ALTERNATIVES:3: Alternative wrapper \"bin/echo\" must not appear in the PLIST.",
"ERROR: ALTERNATIVES:3: Alternative implementation \"bin/gnu-echo\" must appear in the PLIST.",
"ERROR: ALTERNATIVES:3: Alternative implementation \"bin/gnu-echo\" must be an absolute path.",
- "ERROR: ALTERNATIVES:4: Invalid line \"bin/editor bin/vim -e\".",
+ "ERROR: ALTERNATIVES:4: Alternative implementation \"bin/vim\" must be an absolute path.",
"ERROR: ALTERNATIVES:5: Invalid line \"invalid\".",
"ERROR: ALTERNATIVES:6: Alternative implementation \"${PREFIX}/bin/firefox\" must appear in the PLIST.",
"ERROR: ALTERNATIVES:6: Alternative implementation \"${PREFIX}/bin/firefox\" must be an absolute path.",
@@ -42,7 +42,8 @@ func (s *Suite) Test_CheckFileAlternatives__PLIST(c *check.C) {
G.Check(".")
t.CheckOutputLines(
- "AUTOFIX: ALTERNATIVES:3: Replacing \"bin/gnu-echo\" with \"@PREFIX@/bin/gnu-echo\".")
+ "AUTOFIX: ALTERNATIVES:3: Replacing \"bin/gnu-echo\" with \"@PREFIX@/bin/gnu-echo\".",
+ "AUTOFIX: ALTERNATIVES:4: Replacing \"bin/vim\" with \"@PREFIX@/bin/vim\".")
}
func (s *Suite) Test_CheckFileAlternatives__empty(c *check.C) {
diff --git a/pkgtools/pkglint/files/lines_test.go b/pkgtools/pkglint/files/lines_test.go
index 63b52ff6b47..55dce78dd41 100644
--- a/pkgtools/pkglint/files/lines_test.go
+++ b/pkgtools/pkglint/files/lines_test.go
@@ -57,8 +57,8 @@ func (s *Suite) Test_Lines_CheckRcsID__wip(c *check.C) {
G.Check(t.File("wip/package"))
t.CheckOutputLines(
- "AUTOFIX: ~/wip/package/file1.mk:1: Replacing \"# $NetBSD: lines_test.go,v 1.4 2018/12/21 08:05:24 rillig Exp $\" with \"# $NetBSD: lines_test.go,v 1.4 2018/12/21 08:05:24 rillig Exp $\".",
- "AUTOFIX: ~/wip/package/file3.mk:1: Inserting a line \"# $NetBSD: lines_test.go,v 1.4 2018/12/21 08:05:24 rillig Exp $\" before this line.",
- "AUTOFIX: ~/wip/package/file4.mk:1: Inserting a line \"# $NetBSD: lines_test.go,v 1.4 2018/12/21 08:05:24 rillig Exp $\" before this line.",
- "AUTOFIX: ~/wip/package/file5.mk:1: Inserting a line \"# $NetBSD: lines_test.go,v 1.4 2018/12/21 08:05:24 rillig Exp $\" before this line.")
+ "AUTOFIX: ~/wip/package/file1.mk:1: Replacing \"# $"+"NetBSD: dummy $\" with \"# $"+"NetBSD$\".",
+ "AUTOFIX: ~/wip/package/file3.mk:1: Inserting a line \"# $"+"NetBSD$\" before this line.",
+ "AUTOFIX: ~/wip/package/file4.mk:1: Inserting a line \"# $"+"NetBSD$\" before this line.",
+ "AUTOFIX: ~/wip/package/file5.mk:1: Inserting a line \"# $"+"NetBSD$\" before this line.")
}