pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files pkgtools/pkglint: fix alternati...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e15e025ba277
branches:  trunk
changeset: 316906:e15e025ba277
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Fri Dec 21 19:46:48 2018 +0000

description:
pkgtools/pkglint: fix alternatives check

The alternatives implementation may have command line arguments.

diffstat:

 pkgtools/pkglint/files/alternatives.go      |  2 +-
 pkgtools/pkglint/files/alternatives_test.go |  5 +++--
 pkgtools/pkglint/files/lines_test.go        |  8 ++++----
 3 files changed, 8 insertions(+), 7 deletions(-)

diffs (50 lines):

diff -r 9e378b66564f -r e15e025ba277 pkgtools/pkglint/files/alternatives.go
--- a/pkgtools/pkglint/files/alternatives.go    Fri Dec 21 19:04:33 2018 +0000
+++ b/pkgtools/pkglint/files/alternatives.go    Fri Dec 21 19:46:48 2018 +0000
@@ -45,7 +45,7 @@
        }
 
        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 -r 9e378b66564f -r e15e025ba277 pkgtools/pkglint/files/alternatives_test.go
--- a/pkgtools/pkglint/files/alternatives_test.go       Fri Dec 21 19:04:33 2018 +0000
+++ b/pkgtools/pkglint/files/alternatives_test.go       Fri Dec 21 19:46:48 2018 +0000
@@ -30,7 +30,7 @@
                "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 @@
        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 -r 9e378b66564f -r e15e025ba277 pkgtools/pkglint/files/lines_test.go
--- a/pkgtools/pkglint/files/lines_test.go      Fri Dec 21 19:04:33 2018 +0000
+++ b/pkgtools/pkglint/files/lines_test.go      Fri Dec 21 19:46:48 2018 +0000
@@ -57,8 +57,8 @@
        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.")
 }



Home | Main Index | Thread Index | Old Index