pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/pkglint



Module Name:    pkgsrc
Committed By:   rillig
Date:           Thu Jan 23 21:56:51 UTC 2020

Modified Files:
        pkgsrc/pkgtools/pkglint: Makefile
        pkgsrc/pkgtools/pkglint/files: autofix_test.go vartypecheck.go
            vartypecheck_test.go

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.626 -r1.627 pkgsrc/pkgtools/pkglint/Makefile
cvs rdiff -u -r1.38 -r1.39 pkgsrc/pkgtools/pkglint/files/autofix_test.go
cvs rdiff -u -r1.79 -r1.80 pkgsrc/pkgtools/pkglint/files/vartypecheck.go
cvs rdiff -u -r1.73 -r1.74 pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/pkglint/Makefile
diff -u pkgsrc/pkgtools/pkglint/Makefile:1.626 pkgsrc/pkgtools/pkglint/Makefile:1.627
--- pkgsrc/pkgtools/pkglint/Makefile:1.626      Sat Jan 18 21:56:09 2020
+++ pkgsrc/pkgtools/pkglint/Makefile    Thu Jan 23 21:56:50 2020
@@ -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/}

Index: pkgsrc/pkgtools/pkglint/files/autofix_test.go
diff -u pkgsrc/pkgtools/pkglint/files/autofix_test.go:1.38 pkgsrc/pkgtools/pkglint/files/autofix_test.go:1.39
--- pkgsrc/pkgtools/pkglint/files/autofix_test.go:1.38  Sat Jan  4 19:53:14 2020
+++ pkgsrc/pkgtools/pkglint/files/autofix_test.go       Thu Jan 23 21:56:50 2020
@@ -746,6 +746,40 @@ func (s *Suite) Test_Autofix_ReplaceAt(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)
 

Index: pkgsrc/pkgtools/pkglint/files/vartypecheck.go
diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.79 pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.80
--- pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.79  Sat Jan 18 21:56:09 2020
+++ pkgsrc/pkgtools/pkglint/files/vartypecheck.go       Thu Jan 23 21:56:50 2020
@@ -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,",

Index: pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go
diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.73 pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.74
--- pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.73     Sat Jan 18 21:56:09 2020
+++ pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go  Thu Jan 23 21:56:50 2020
@@ -992,6 +992,23 @@ func (s *Suite) Test_VartypeCheck_Homepa
                "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) {



Home | Main Index | Thread Index | Old Index