pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint Updated pkglint to 5.4.5.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ad13382d6163
branches:  trunk
changeset: 349522:ad13382d6163
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Jul 09 13:16:43 2016 +0000

description:
Updated pkglint to 5.4.5.

Changes since 5.4.4:

* Removed autofix for variables in BUILDLINK_TREE, since that change
  affects multiple variables in the file and therefore cannot be done
  automatically
* Fixed PLIST sorting to not lose lines

diffstat:

 pkgtools/pkglint/Makefile                 |   4 +-
 pkgtools/pkglint/files/buildlink3.go      |   6 ++--
 pkgtools/pkglint/files/buildlink3_test.go |   4 +-
 pkgtools/pkglint/files/mkline_test.go     |   2 +-
 pkgtools/pkglint/files/plist.go           |   4 +-
 pkgtools/pkglint/files/plist_test.go      |  41 +++++++++++++++++++++++++++++++
 6 files changed, 51 insertions(+), 10 deletions(-)

diffs (136 lines):

diff -r 257861bcaf60 -r ad13382d6163 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Sat Jul 09 13:10:15 2016 +0000
+++ b/pkgtools/pkglint/Makefile Sat Jul 09 13:16:43 2016 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.489 2016/07/09 09:43:48 rillig Exp $
+# $NetBSD: Makefile,v 1.490 2016/07/09 13:16:43 rillig Exp $
 
-PKGNAME=       pkglint-5.4.4
+PKGNAME=       pkglint-5.4.5
 DISTFILES=     # none
 CATEGORIES=    pkgtools
 
diff -r 257861bcaf60 -r ad13382d6163 pkgtools/pkglint/files/buildlink3.go
--- a/pkgtools/pkglint/files/buildlink3.go      Sat Jul 09 13:10:15 2016 +0000
+++ b/pkgtools/pkglint/files/buildlink3.go      Sat Jul 09 13:16:43 2016 +0000
@@ -47,14 +47,14 @@
                        {"${RUBY_PKGPREFIX}", "ruby"},
                        {"${PHP_PKG_PREFIX}", "php"},
                } {
-                       if contains(pkgbase, pair.varuse) && !pkgbaseLine.AutofixReplace(pair.varuse, pair.simple) {
-                               pkgbaseLine.Warn2("Please use %q instead of %q.", pair.simple, pair.varuse)
+                       if contains(pkgbase, pair.varuse) {
+                               pkgbaseLine.Warn2("Please use %q instead of %q (also in other variables in this file).", pair.simple, pair.varuse)
                                warned = true
                        }
                }
                if !warned {
                        if m, varuse := match1(pkgbase, `(\$\{\w+\})`); m {
-                               pkgbaseLine.Warn1("Please replace %q with a simple string.", varuse)
+                               pkgbaseLine.Warn1("Please replace %q with a simple string (also in other variables in this file).", varuse)
                                warned = true
                        }
                }
diff -r 257861bcaf60 -r ad13382d6163 pkgtools/pkglint/files/buildlink3_test.go
--- a/pkgtools/pkglint/files/buildlink3_test.go Sat Jul 09 13:10:15 2016 +0000
+++ b/pkgtools/pkglint/files/buildlink3_test.go Sat Jul 09 13:16:43 2016 +0000
@@ -252,7 +252,7 @@
 
        ChecklinesBuildlink3Mk(mklines)
 
-       c.Check(s.Output(), equals, "WARN: buildlink3.mk:3: Please use \"py\" instead of \"${PYPKGPREFIX}\".\n")
+       c.Check(s.Output(), equals, "WARN: buildlink3.mk:3: Please use \"py\" instead of \"${PYPKGPREFIX}\" (also in other variables in this file).\n")
 }
 
 func (s *Suite) Test_ChecklinesBuildlink3Mk_PKGBASE_with_unknown_variable(c *check.C) {
@@ -275,6 +275,6 @@
        ChecklinesBuildlink3Mk(mklines)
 
        c.Check(s.Output(), equals, ""+
-               "WARN: buildlink3.mk:3: Please replace \"${LICENSE}\" with a simple string.\n"+
+               "WARN: buildlink3.mk:3: Please replace \"${LICENSE}\" with a simple string (also in other variables in this file).\n"+
                "WARN: buildlink3.mk:13: This line should contain the following text: BUILDLINK_TREE+=\t-${LICENSE}-wxWidgets\n")
 }
diff -r 257861bcaf60 -r ad13382d6163 pkgtools/pkglint/files/mkline_test.go
--- a/pkgtools/pkglint/files/mkline_test.go     Sat Jul 09 13:10:15 2016 +0000
+++ b/pkgtools/pkglint/files/mkline_test.go     Sat Jul 09 13:16:43 2016 +0000
@@ -234,7 +234,7 @@
                "AUTOFIX: ~/Makefile: Has been auto-fixed. Please re-run pkglint.\n"+
                "AUTOFIX: ~/Makefile: Has been auto-fixed. Please re-run pkglint.\n")
        c.Check(s.LoadTmpFile(c, "Makefile"), equals, ""+
-               "# $NetBSD: mkline_test.go,v 1.14 2016/07/09 09:43:48 rillig Exp $\n"+
+               mkrcsid+"\n"+
                "VARNAME+=\t${VARNAME}\n"+
                "VARNAME+ =\t${VARNAME+}\n"+
                "VARNAME++=\t${VARNAME+}\n"+
diff -r 257861bcaf60 -r ad13382d6163 pkgtools/pkglint/files/plist.go
--- a/pkgtools/pkglint/files/plist.go   Sat Jul 09 13:10:15 2016 +0000
+++ b/pkgtools/pkglint/files/plist.go   Sat Jul 09 13:16:43 2016 +0000
@@ -61,8 +61,8 @@
                ck.checkline(pline)
                pline.CheckTrailingWhitespace()
        }
+       ChecklinesTrailingEmptyLines(plainLines)
 
-       ChecklinesTrailingEmptyLines(plainLines)
        if G.opts.WarnPlistSort {
                sorter := NewPlistLineSorter(plines)
                sorter.Sort()
@@ -469,8 +469,8 @@
                } else {
                        s.plines = append(s.plines, pline)
                        s.lines = append(s.lines, pline.line)
+                       prev = pline
                }
-               prev = pline
        }
        return s
 }
diff -r 257861bcaf60 -r ad13382d6163 pkgtools/pkglint/files/plist_test.go
--- a/pkgtools/pkglint/files/plist_test.go      Sat Jul 09 13:10:15 2016 +0000
+++ b/pkgtools/pkglint/files/plist_test.go      Sat Jul 09 13:16:43 2016 +0000
@@ -167,3 +167,44 @@
 
        c.Check(s.Output(), equals, "NOTE: PLIST:2: The .gz extension is unnecessary for manual pages.\n")
 }
+
+func (s *Suite) Test_PlistChecker__autofix(c *check.C) {
+       s.UseCommandLine(c, "-Wall")
+
+       fname := s.CreateTmpFileLines(c, "PLIST",
+               "@comment $"+"NetBSD$",
+               "lib/libvirt/connection-driver/libvirt_driver_storage.la",
+               "${PLIST.hal}lib/libvirt/connection-driver/libvirt_driver_nodedev.la",
+               "${PLIST.xen}lib/libvirt/connection-driver/libvirt_driver_libxl.la",
+               "lib/libvirt/lock-driver/lockd.la",
+               "share/augeas/lenses/virtlockd.aug",
+               "share/doc/${PKGNAME}/html/32favicon.png",
+               "share/doc/${PKGNAME}/html/404.html",
+               "share/doc/${PKGNAME}/html/acl.html",
+               "share/doc/${PKGNAME}/html/aclpolkit.html",
+               "share/doc/${PKGNAME}/html/windows.html",
+               "share/examples/libvirt/libvirt.conf",
+               "share/locale/zh_CN/LC_MESSAGES/libvirt.mo",
+               "share/locale/zh_TW/LC_MESSAGES/libvirt.mo",
+               "share/locale/zu/LC_MESSAGES/libvirt.mo",
+               "@pkgdir share/examples/libvirt/nwfilter",
+               "@pkgdir        etc/libvirt/qemu/networks/autostart",
+               "@pkgdir        etc/logrotate.d",
+               "@pkgdir        etc/sasl2")
+       lines := LoadExistingLines(fname, false)
+       ChecklinesPlist(lines)
+
+       c.Check(s.Output(), equals, ""+
+               "WARN: ~/PLIST:3: \"lib/libvirt/connection-driver/libvirt_driver_nodedev.la\" should be sorted before \"lib/libvirt/connection-driver/libvirt_driver_storage.la\".\n"+
+               "WARN: ~/PLIST:4: \"lib/libvirt/connection-driver/libvirt_driver_libxl.la\" should be sorted before \"lib/libvirt/connection-driver/libvirt_driver_nodedev.la\".\n")
+
+       s.UseCommandLine(c, "-Wall", "--autofix")
+       ChecklinesPlist(lines)
+
+       fixedLines := LoadExistingLines(fname, false)
+
+       c.Check(s.Output(), equals, ""+
+               "AUTOFIX: ~/PLIST:1: Sorting the whole file.\n"+
+               "AUTOFIX: ~/PLIST: Has been auto-fixed. Please re-run pkglint.\n")
+       c.Check(len(lines), equals, len(fixedLines))
+}



Home | Main Index | Thread Index | Old Index