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.
This commit is contained in:
rillig 2020-10-06 18:40:50 +00:00
parent b903d29929
commit a2d164ca60
6 changed files with 67 additions and 12 deletions

View file

@ -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/}

View file

@ -236,7 +236,8 @@ func (ck *HomepageChecker) checkBadUrls() {
if !ck.hasAnySuffix(host,
".dl.sourceforge.net",
"downloads.sourceforge.net") {
"downloads.sourceforge.net",
"cpan.metacpan.org") {
return
}

View file

@ -279,11 +279,13 @@ func (s *Suite) Test_HomepageChecker_checkBadUrls(c *check.C) {
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) {

View file

@ -370,7 +370,7 @@ func (*Pkgsrc) parseDocChange(line *Line, warn bool) *Change {
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 @@ func (ch *Change) Target() PkgsrcPath {
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
}

View file

@ -477,6 +477,10 @@ func (s *Suite) Test_Pkgsrc_parseDocChange(c *check.C) {
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 @@ func (s *Suite) Test_Change_Target(c *check.C) {
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) {

View file

@ -1030,6 +1030,50 @@ func (s *Suite) Test_ShellLineChecker_CheckShellCommandLine__strip(c *check.C) {
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)