diff options
author | rillig <rillig@pkgsrc.org> | 2016-07-09 13:16:43 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2016-07-09 13:16:43 +0000 |
commit | 9c3501ab179ccf3205a1e299a7417b2961c1d397 (patch) | |
tree | 14b31d8b0507524b3399cd9ec2847d614f01fcda /pkgtools/pkglint | |
parent | f94cbf2afec119c8761c60c2338d5a54edb74346 (diff) | |
download | pkgsrc-9c3501ab179ccf3205a1e299a7417b2961c1d397.tar.gz |
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 (limited to 'pkgtools/pkglint')
-rw-r--r-- | pkgtools/pkglint/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pkglint/files/buildlink3.go | 6 | ||||
-rw-r--r-- | pkgtools/pkglint/files/buildlink3_test.go | 4 | ||||
-rw-r--r-- | pkgtools/pkglint/files/mkline_test.go | 2 | ||||
-rw-r--r-- | pkgtools/pkglint/files/plist.go | 4 | ||||
-rw-r--r-- | pkgtools/pkglint/files/plist_test.go | 41 |
6 files changed, 51 insertions, 10 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile index bda48b7aa42..cba8b85f841 100644 --- a/pkgtools/pkglint/Makefile +++ b/pkgtools/pkglint/Makefile @@ -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 --git a/pkgtools/pkglint/files/buildlink3.go b/pkgtools/pkglint/files/buildlink3.go index 5a4254620f2..94246443db3 100644 --- a/pkgtools/pkglint/files/buildlink3.go +++ b/pkgtools/pkglint/files/buildlink3.go @@ -47,14 +47,14 @@ func ChecklinesBuildlink3Mk(mklines *MkLines) { {"${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 --git a/pkgtools/pkglint/files/buildlink3_test.go b/pkgtools/pkglint/files/buildlink3_test.go index edb4d0936e6..472862869b1 100644 --- a/pkgtools/pkglint/files/buildlink3_test.go +++ b/pkgtools/pkglint/files/buildlink3_test.go @@ -252,7 +252,7 @@ func (s *Suite) Test_ChecklinesBuildlink3Mk_PKGBASE_with_variable(c *check.C) { 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 @@ func (s *Suite) Test_ChecklinesBuildlink3Mk_PKGBASE_with_unknown_variable(c *che 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 --git a/pkgtools/pkglint/files/mkline_test.go b/pkgtools/pkglint/files/mkline_test.go index 31a75a2e264..5b456e147d9 100644 --- a/pkgtools/pkglint/files/mkline_test.go +++ b/pkgtools/pkglint/files/mkline_test.go @@ -234,7 +234,7 @@ func (s *Suite) Test_NewMkLine__autofix_space_after_varname(c *check.C) { "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 --git a/pkgtools/pkglint/files/plist.go b/pkgtools/pkglint/files/plist.go index 7122f4eb0b2..f667181016b 100644 --- a/pkgtools/pkglint/files/plist.go +++ b/pkgtools/pkglint/files/plist.go @@ -61,8 +61,8 @@ func (ck *PlistChecker) Check(plainLines []*Line) { ck.checkline(pline) pline.CheckTrailingWhitespace() } - ChecklinesTrailingEmptyLines(plainLines) + if G.opts.WarnPlistSort { sorter := NewPlistLineSorter(plines) sorter.Sort() @@ -469,8 +469,8 @@ func NewPlistLineSorter(plines []*PlistLine) *plistLineSorter { } else { s.plines = append(s.plines, pline) s.lines = append(s.lines, pline.line) + prev = pline } - prev = pline } return s } diff --git a/pkgtools/pkglint/files/plist_test.go b/pkgtools/pkglint/files/plist_test.go index 3e295c643a2..71ad279e7cb 100644 --- a/pkgtools/pkglint/files/plist_test.go +++ b/pkgtools/pkglint/files/plist_test.go @@ -167,3 +167,44 @@ func (s *Suite) Test_PlistChecker_checkpathMan_gz(c *check.C) { 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)) +} |