pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint pkgtools/pkglint: update to 20.3.1



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f42ba75b6c20
branches:  trunk
changeset: 440347:f42ba75b6c20
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Oct 06 18:40:50 2020 +0000

description:
pkgtools/pkglint: update to 20.3.1

Changes since 20.3.0:

URLs from cpan.metacpan.org should not be used as HOMEPAGE for Perl
packages since they don't provide an overview over the package, instead
the just list the distribution files.

Lines in doc/CHANGES may contain the pattern "Removed <pkgpath> version
<version>".  Before, only "Removed <pkgpath>" (without additional
information) or "Removed <pkgpath> successor <pkgpath>" were allowed.
Mentioning the last seen version number sounds useful.  It is not
cross-checked right now; that check may be added later.

diffstat:

 pkgtools/pkglint/Makefile               |   4 +-
 pkgtools/pkglint/files/homepage.go      |   3 +-
 pkgtools/pkglint/files/homepage_test.go |   6 +++-
 pkgtools/pkglint/files/pkgsrc.go        |   8 +++--
 pkgtools/pkglint/files/pkgsrc_test.go   |  14 +++++++---
 pkgtools/pkglint/files/shell_test.go    |  44 +++++++++++++++++++++++++++++++++
 6 files changed, 67 insertions(+), 12 deletions(-)

diffs (161 lines):

diff -r d9610983cd8a -r f42ba75b6c20 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Tue Oct 06 17:52:16 2020 +0000
+++ b/pkgtools/pkglint/Makefile Tue Oct 06 18:40:50 2020 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.670 2020/09/25 13:56:09 rillig Exp $
+# $NetBSD: Makefile,v 1.671 2020/10/06 18:40:50 rillig Exp $
 
-PKGNAME=       pkglint-20.3.0
+PKGNAME=       pkglint-20.3.1
 CATEGORIES=    pkgtools
 DISTNAME=      tools
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=golang/}
diff -r d9610983cd8a -r f42ba75b6c20 pkgtools/pkglint/files/homepage.go
--- a/pkgtools/pkglint/files/homepage.go        Tue Oct 06 17:52:16 2020 +0000
+++ b/pkgtools/pkglint/files/homepage.go        Tue Oct 06 18:40:50 2020 +0000
@@ -236,7 +236,8 @@
 
        if !ck.hasAnySuffix(host,
                ".dl.sourceforge.net",
-               "downloads.sourceforge.net") {
+               "downloads.sourceforge.net",
+               "cpan.metacpan.org") {
                return
        }
 
diff -r d9610983cd8a -r f42ba75b6c20 pkgtools/pkglint/files/homepage_test.go
--- a/pkgtools/pkglint/files/homepage_test.go   Tue Oct 06 17:52:16 2020 +0000
+++ b/pkgtools/pkglint/files/homepage_test.go   Tue Oct 06 18:40:50 2020 +0000
@@ -279,11 +279,13 @@
        vt.Varname("HOMEPAGE")
        vt.Values(
                "http://garr.dl.sourceforge.net/project/name/dir/subdir/";,
-               "https://downloads.sourceforge.net/project/name/dir/subdir/";)
+               "https://downloads.sourceforge.net/project/name/dir/subdir/";,
+               "https://cpan.metacpan.org/authors/id/I/IM/IMALPASS/";)
 
        vt.Output(
                "WARN: filename.mk:1: A direct download URL is not a user-friendly homepage.",
-               "WARN: filename.mk:2: A direct download URL is not a user-friendly homepage.")
+               "WARN: filename.mk:2: A direct download URL is not a user-friendly homepage.",
+               "WARN: filename.mk:3: A direct download URL is not a user-friendly homepage.")
 }
 
 func (s *Suite) Test_HomepageChecker_checkReachable(c *check.C) {
diff -r d9610983cd8a -r f42ba75b6c20 pkgtools/pkglint/files/pkgsrc.go
--- a/pkgtools/pkglint/files/pkgsrc.go  Tue Oct 06 17:52:16 2020 +0000
+++ b/pkgtools/pkglint/files/pkgsrc.go  Tue Oct 06 18:40:50 2020 +0000
@@ -370,7 +370,7 @@
                action == Added && f[2] == "version",
                action == Updated && f[2] == "to",
                action == Downgraded && f[2] == "to",
-               action == Removed && (f[2] == "successor" || n == 4),
+               action == Removed && (f[2] == "successor" || f[2] == "version" || n == 4),
                (action == Renamed || action == Moved) && f[2] == "to":
                return &Change{
                        Location: line.Location,
@@ -1318,8 +1318,10 @@
        return NewPkgsrcPath(NewPath(ch.target))
 }
 
-// Successor returns the successor for a Removed package.
-func (ch *Change) Successor() string {
+// SuccessorOrVersion returns the successor for a Removed package,
+// or the version number of its last appearance.
+// As of 2020-10-06, no cross-validation is done on this field though.
+func (ch *Change) SuccessorOrVersion() string {
        assert(ch.Action == Removed)
        return ch.target
 }
diff -r d9610983cd8a -r f42ba75b6c20 pkgtools/pkglint/files/pkgsrc_test.go
--- a/pkgtools/pkglint/files/pkgsrc_test.go     Tue Oct 06 17:52:16 2020 +0000
+++ b/pkgtools/pkglint/files/pkgsrc_test.go     Tue Oct 06 18:40:50 2020 +0000
@@ -477,6 +477,10 @@
        test("\tRemoved pkgpath successor pkgpath [author 2019-01-01]",
                nil...)
 
+       // Since 2020-10-06
+       test("\tRemoved pkgpath version 1.3.4 [author 2019-01-01]",
+               nil...)
+
        // "and" is wrong
        test("\tRemoved pkgpath and pkgpath [author 2019-01-01]",
                "WARN: doc/CHANGES-2019:123: Invalid doc/CHANGES line: "+
@@ -1529,17 +1533,19 @@
        t.ExpectAssert(func() { downgraded.Target() })
 }
 
-func (s *Suite) Test_Change_Successor(c *check.C) {
+func (s *Suite) Test_Change_SuccessorOrVersion(c *check.C) {
        t := s.Init(c)
 
        loc := Location{"doc/CHANGES-2019", 5}
        removed := Change{loc, Removed, "category/path", "", "author", "2019-01-01"}
        removedSucc := Change{loc, Removed, "category/path", "category/successor", "author", "2019-01-01"}
+       removedVersion := Change{loc, Removed, "category/path", "1.3.4", "author", "2019-01-01"}
        downgraded := Change{loc, Downgraded, "category/path", "1.0", "author", "2019-01-01"}
 
-       t.CheckEquals(removed.Successor(), "")
-       t.CheckEquals(removedSucc.Successor(), "category/successor")
-       t.ExpectAssert(func() { downgraded.Successor() })
+       t.CheckEquals(removed.SuccessorOrVersion(), "")
+       t.CheckEquals(removedSucc.SuccessorOrVersion(), "category/successor")
+       t.CheckEquals(removedVersion.SuccessorOrVersion(), "1.3.4")
+       t.ExpectAssert(func() { downgraded.SuccessorOrVersion() })
 }
 
 func (s *Suite) Test_Change_IsAbove(c *check.C) {
diff -r d9610983cd8a -r f42ba75b6c20 pkgtools/pkglint/files/shell_test.go
--- a/pkgtools/pkglint/files/shell_test.go      Tue Oct 06 17:52:16 2020 +0000
+++ b/pkgtools/pkglint/files/shell_test.go      Tue Oct 06 18:40:50 2020 +0000
@@ -1030,6 +1030,50 @@
        t.CheckOutputEmpty()
 }
 
+// After working a lot with usr.bin/make, I thought that lines containing
+// the cd command would differ in behavior between compatibility mode and
+// parallel mode.  But since pkgsrc does not support parallel mode and also
+// actively warns when someone tries to run it in parallel mode, there is
+// no point checking for chdir that might spill over to the next line.
+// That will not happen in compat mode.
+func (s *Suite) Test_ShellLineChecker_CheckShellCommandLine__chdir(c *check.C) {
+       t := s.Init(c)
+
+       t.SetUpTool("echo", "", AfterPrefsMk)
+       t.SetUpTool("sed", "", AfterPrefsMk)
+       mklines := t.NewMkLines("filename.mk",
+               MkCvsID,
+               "",
+               "pre-configure:",
+               // This command is run in the current directory.
+               "\techo command 1",
+               // This chdir affects the remaining commands.
+               // It might be possible to warn here about chdir.
+               "\tcd ..",
+               // In subshells, chdir is ok.
+               "\t(cd ..)",
+               // In pipes, chdir is ok.
+               "\t{ cd .. && echo sender; } | { cd .. && sed s,sender,receiver; }",
+               // The && operator does not run in a subshell.
+               // It might be possible to warn here about chdir.
+               "\tcd .. && echo",
+               // The || operator does not run in a subshell.
+               // It might be possible to warn here about chdir.
+               "\tcd .. || echo",
+               // The current directory of this command depends on the preceding
+               // commands.
+               "\techo command 2",
+               // In the final command of a target, chdir is ok since there are
+               // no further commands that could be affected.
+               "\tcd ..")
+
+       mklines.Check()
+
+       t.CheckOutputLines(
+               "WARN: filename.mk:7: The exitcode of the command at the left of " +
+                       "the | operator is ignored.")
+}
+
 func (s *Suite) Test_ShellLineChecker_CheckShellCommandLine__nofix(c *check.C) {
        t := s.Init(c)
 



Home | Main Index | Thread Index | Old Index