diff options
author | rillig <rillig@pkgsrc.org> | 2020-01-23 21:56:50 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2020-01-23 21:56:50 +0000 |
commit | ddcec3635260a9b4458b16ebcaa84adffd731517 (patch) | |
tree | a6ba42be2f942df869e19393fbab02b8b048953a /pkgtools | |
parent | c91c599b7755d073d36e71089a90f020b5d078fb (diff) | |
download | pkgsrc-ddcec3635260a9b4458b16ebcaa84adffd731517.tar.gz |
pkgtools/pkglint: update to 19.4.5
Changes since 19.4.4:
Fixed automatic replacement from http SourceForge URLs to their https
counterparts. According to their official documentation, the https URLs
are not on the same hosts as before, but on *.sourceforge.io.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pkglint/files/autofix_test.go | 34 | ||||
-rw-r--r-- | pkgtools/pkglint/files/vartypecheck.go | 7 | ||||
-rw-r--r-- | pkgtools/pkglint/files/vartypecheck_test.go | 17 |
4 files changed, 59 insertions, 3 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile index 2d377ca9a15..3924b8f6015 100644 --- a/pkgtools/pkglint/Makefile +++ b/pkgtools/pkglint/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.626 2020/01/18 21:56:09 rillig Exp $ +# $NetBSD: Makefile,v 1.627 2020/01/23 21:56:50 rillig Exp $ -PKGNAME= pkglint-19.4.4 +PKGNAME= pkglint-19.4.5 CATEGORIES= pkgtools DISTNAME= tools MASTER_SITES= ${MASTER_SITE_GITHUB:=golang/} diff --git a/pkgtools/pkglint/files/autofix_test.go b/pkgtools/pkglint/files/autofix_test.go index bf86e136d2e..94ddd0f4cd6 100644 --- a/pkgtools/pkglint/files/autofix_test.go +++ b/pkgtools/pkglint/files/autofix_test.go @@ -746,6 +746,40 @@ func (s *Suite) Test_Autofix_ReplaceAt(c *check.C) { 0, 20, "?", "+=") } +func (s *Suite) Test_Autofix_ReplaceAt__only(c *check.C) { + t := s.Init(c) + + t.SetUpCommandLine("--only", "specific", "--autofix") + mklines := t.SetUpFileMkLines("filename.mk", + "# comment") + + mklines.ForEach(func(mkline *MkLine) { + // FIXME + // The modifications from this replacement are not supposed + // to be saved to the file. + // They should only be applied to the in-memory copy. + fix := mkline.Autofix() + fix.Warnf("Warning.") + fix.ReplaceAt(0, 0, "# ", "COMMENT=\t") + fix.Apply() + + // This autofix marks the file's lines as changed. + // Without it, SaveAutofixChanges would not have any effect. + fix = mkline.Autofix() + fix.Warnf("A specific warning.") + fix.Replace("comment", "remark") + fix.Apply() + }) + mklines.SaveAutofixChanges() + + t.CheckOutputLines( + "AUTOFIX: ~/filename.mk:1: Replacing \"comment\" with \"remark\".") + t.CheckFileLines("filename.mk", + // FIXME: The "COMMENT=" must not appear here since it + // was supposed to be ignored by the --only option. + "COMMENT=\tremark") +} + func (s *Suite) Test_Autofix_InsertBefore(c *check.C) { t := s.Init(c) diff --git a/pkgtools/pkglint/files/vartypecheck.go b/pkgtools/pkglint/files/vartypecheck.go index e2293c1e336..660aed52a3b 100644 --- a/pkgtools/pkglint/files/vartypecheck.go +++ b/pkgtools/pkglint/files/vartypecheck.go @@ -729,7 +729,12 @@ func (cv *VartypeCheck) homepageHttp() { fix := cv.Autofix() fix.Warnf("HOMEPAGE should use https instead of http.") if supportsHttps { - fix.Replace("http", "https") + if hasAnySuffix(host, "sourceforge.net") { + // See https://sourceforge.net/p/forge/documentation/Custom%20VHOSTs/ + fix.Replace("http://"+host, "https://"+replaceAll(host, `\.net`, ".io")) + } else { + fix.Replace("http", "https") + } } fix.Explain( "To provide secure communication by default,", diff --git a/pkgtools/pkglint/files/vartypecheck_test.go b/pkgtools/pkglint/files/vartypecheck_test.go index 58e01a2eef5..a81da40b17a 100644 --- a/pkgtools/pkglint/files/vartypecheck_test.go +++ b/pkgtools/pkglint/files/vartypecheck_test.go @@ -992,6 +992,23 @@ func (s *Suite) Test_VartypeCheck_Homepage__http(c *check.C) { "WARN: filename.mk:3: HOMEPAGE should use https instead of http.", "WARN: filename.mk:4: HOMEPAGE should use https instead of http.", "WARN: filename.mk:7: HOMEPAGE should use https instead of http.") + + t.SetUpCommandLine("--autofix") + vt.Values( + "http://www.gnustep.org/", + "http://www.pkgsrc.org/", + "http://project.sourceforge.net/", + "http://sf.net/p/project/", + "http://example.org/ # doesn't support https", + "http://example.org/ # only supports http", + "http://asf.net/") + + // www.gnustep.org does not support https at all. + // www.pkgsrc.org is not in the (short) list of known https domains, + // therefore pkglint does not dare to change it automatically. + vt.Output( + "AUTOFIX: filename.mk:13: Replacing \"http://project.sourceforge.net\" with \"https://project.sourceforge.io\".", + "AUTOFIX: filename.mk:14: Replacing \"http\" with \"https\".") } func (s *Suite) Test_VartypeCheck_IdentifierDirect(c *check.C) { |