Received: by mail.netbsd.org (Postfix, from userid 605) id F369D84DE2; Tue, 30 Jul 2019 18:16:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 790BF84D97 for ; Tue, 30 Jul 2019 18:16:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id Z6VlxSCHHGVa for ; Tue, 30 Jul 2019 18:16:13 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id 7F1B584C81 for ; Tue, 30 Jul 2019 18:16:13 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 77C83FBF4; Tue, 30 Jul 2019 18:16:13 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_156451057312170" MIME-Version: 1.0 Date: Tue, 30 Jul 2019 18:16:13 +0000 From: "Roland Illig" Subject: CVS commit: pkgsrc/pkgtools/pkglint To: pkgsrc-changes@NetBSD.org Reply-To: rillig@netbsd.org X-Mailer: log_accum Message-Id: <20190730181613.77C83FBF4@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: pkgsrc-changes.NetBSD.org Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_156451057312170 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: rillig Date: Tue Jul 30 18:16:13 UTC 2019 Modified Files: pkgsrc/pkgtools/pkglint: Makefile pkgsrc/pkgtools/pkglint/files: check_test.go mkline_test.go mklines_test.go pkgsrc.go pkgsrc_test.go vartypecheck.go vartypecheck_test.go Log Message: pkgtools/pkglint: update to 5.7.17 Changes since 5.7.16: * The warnings for doc/CHANGES are only enabled when the -Cglobal option is given. This is to avoid warnings that are unrelated to the package that is being checked. To generate a diff of this commit: cvs rdiff -u -r1.588 -r1.589 pkgsrc/pkgtools/pkglint/Makefile cvs rdiff -u -r1.45 -r1.46 pkgsrc/pkgtools/pkglint/files/check_test.go cvs rdiff -u -r1.61 -r1.62 pkgsrc/pkgtools/pkglint/files/mkline_test.go cvs rdiff -u -r1.47 -r1.48 pkgsrc/pkgtools/pkglint/files/mklines_test.go cvs rdiff -u -r1.31 -r1.32 pkgsrc/pkgtools/pkglint/files/pkgsrc.go cvs rdiff -u -r1.27 -r1.28 pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go cvs rdiff -u -r1.59 -r1.60 pkgsrc/pkgtools/pkglint/files/vartypecheck.go cvs rdiff -u -r1.52 -r1.53 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. --_----------=_156451057312170 Content-Disposition: inline Content-Length: 10640 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/pkgtools/pkglint/Makefile diff -u pkgsrc/pkgtools/pkglint/Makefile:1.588 pkgsrc/pkgtools/pkglint/Makefile:1.589 --- pkgsrc/pkgtools/pkglint/Makefile:1.588 Sun Jul 14 21:25:47 2019 +++ pkgsrc/pkgtools/pkglint/Makefile Tue Jul 30 18:16:13 2019 @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.588 2019/07/14 21:25:47 rillig Exp $ +# $NetBSD: Makefile,v 1.589 2019/07/30 18:16:13 rillig Exp $ -PKGNAME= pkglint-5.7.16 +PKGNAME= pkglint-5.7.17 CATEGORIES= pkgtools DISTNAME= tools MASTER_SITES= ${MASTER_SITE_GITHUB:=golang/} Index: pkgsrc/pkgtools/pkglint/files/check_test.go diff -u pkgsrc/pkgtools/pkglint/files/check_test.go:1.45 pkgsrc/pkgtools/pkglint/files/check_test.go:1.46 --- pkgsrc/pkgtools/pkglint/files/check_test.go:1.45 Sun Jul 14 21:25:47 2019 +++ pkgsrc/pkgtools/pkglint/files/check_test.go Tue Jul 30 18:16:13 2019 @@ -68,7 +68,8 @@ func (s *Suite) SetUpTest(c *check.C) { G.Pkgsrc = NewPkgsrc(t.File(".")) t.c = c - t.SetUpCommandLine("-Wall") // To catch duplicate warnings + t.SetUpCommandLine("-Wall") // To catch duplicate warnings + t.seenSetUpCommandLine = false // This default call doesn't count. // To improve code coverage and ensure that trace.Result works // in all cases. The latter cannot be ensured at compile time. @@ -131,9 +132,10 @@ type Tester struct { prevdir string // The current working directory before the test started relCwd string // See Tester.Chdir - seenSetupPkgsrc int - seenFinish bool - seenMain bool + seenSetUpCommandLine bool + seenSetupPkgsrc int + seenFinish bool + seenMain bool } // SetUpCommandLine simulates a command line for the remainder of the test. @@ -159,6 +161,8 @@ func (t *Tester) SetUpCommandLine(args . // It also reveals diagnostics that are logged multiple times per // line and thus can easily get annoying to the pkgsrc developers. G.Logger.Opts.LogVerbose = true + + t.seenSetUpCommandLine = true } // SetUpVartypes registers a few hundred variables like MASTER_SITES, @@ -673,6 +677,10 @@ func (t *Tester) Main(args ...string) in t.Errorf("Calling t.FinishSetup() before t.Main() is redundant " + "since t.Main() loads the pkgsrc infrastructure.") } + if t.seenSetUpCommandLine { + t.Errorf("Calling t.SetupCommandLine() before t.Main() is redundant " + + "since t.Main() accepts the command line options directly.") + } t.seenMain = true Index: pkgsrc/pkgtools/pkglint/files/mkline_test.go diff -u pkgsrc/pkgtools/pkglint/files/mkline_test.go:1.61 pkgsrc/pkgtools/pkglint/files/mkline_test.go:1.62 --- pkgsrc/pkgtools/pkglint/files/mkline_test.go:1.61 Sun Jul 14 21:25:47 2019 +++ pkgsrc/pkgtools/pkglint/files/mkline_test.go Tue Jul 30 18:16:13 2019 @@ -1514,17 +1514,17 @@ func (s *Suite) Test_MkLine_ResolveVarsI t := s.Init(c) t.SetUpVartypes() - mklines := t.SetUpFileMkLines("multimedia/totem/bla.mk", + mklines := t.SetUpFileMkLines("multimedia/totem/filename.mk", MkCvsID, "BUILDLINK_PKGSRCDIR.totem?=\t../../multimedia/totem") mklines.Check() t.CheckOutputLines( - "WARN: ~/multimedia/totem/bla.mk:2: "+ + "WARN: ~/multimedia/totem/filename.mk:2: "+ "The variable BUILDLINK_PKGSRCDIR.totem should not be given a default value in this file; "+ "it would be ok in buildlink3.mk.", - "ERROR: ~/multimedia/totem/bla.mk:2: Relative path \"../../multimedia/totem/Makefile\" does not exist.") + "ERROR: ~/multimedia/totem/filename.mk:2: Relative path \"../../multimedia/totem/Makefile\" does not exist.") } // Just for code coverage Index: pkgsrc/pkgtools/pkglint/files/mklines_test.go diff -u pkgsrc/pkgtools/pkglint/files/mklines_test.go:1.47 pkgsrc/pkgtools/pkglint/files/mklines_test.go:1.48 --- pkgsrc/pkgtools/pkglint/files/mklines_test.go:1.47 Sun Jul 14 21:25:47 2019 +++ pkgsrc/pkgtools/pkglint/files/mklines_test.go Tue Jul 30 18:16:13 2019 @@ -1155,7 +1155,6 @@ func (s *Suite) Test_MkLines_Check__auto func (s *Suite) Test_MkLines_Check__autofix_MASTER_SITE_in_HOMEPAGE_in_package(c *check.C) { t := s.Init(c) - t.SetUpCommandLine("-Wall", "--autofix") t.SetUpPackage("category/package", "MASTER_SITES=\thttps://cdn1.example.org/ https://cdn2.example.org/", "HOMEPAGE=\t${MASTER_SITES}") Index: pkgsrc/pkgtools/pkglint/files/pkgsrc.go diff -u pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.31 pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.32 --- pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.31 Sun Jul 14 21:25:47 2019 +++ pkgsrc/pkgtools/pkglint/files/pkgsrc.go Tue Jul 30 18:16:13 2019 @@ -501,7 +501,7 @@ func (*Pkgsrc) parseDocChange(line *Line func (src *Pkgsrc) loadDocChangesFromFile(filename string) []*Change { - warn := !G.Wip + warn := G.Opts.CheckGlobal && !G.Wip // Each date in the file should be from the same year as the filename says. // This check has been added in 2018. Index: pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go diff -u pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go:1.27 pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go:1.28 --- pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go:1.27 Sun Jul 14 21:25:47 2019 +++ pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go Tue Jul 30 18:16:13 2019 @@ -340,6 +340,7 @@ func (s *Suite) Test_Pkgsrc_loadDocChang func (s *Suite) Test_Pkgsrc_loadDocChangesFromFile(c *check.C) { t := s.Init(c) + t.SetUpCommandLine("-Cglobal", "-Wall") t.CreateFileLines("doc/CHANGES-2018", "\tAdded category/package version 1.0 [author1 2015-01-01]", // Wrong year "\tUpdated category/package to 1.5 [author2 2018-01-02]", @@ -410,12 +411,51 @@ func (s *Suite) Test_Pkgsrc_loadDocChang "\t\tWrong indentation", "\tInvalid pkgpath to 1.16 [rillig 2019-06-16]") - t.Main(t.File("wip/package")) + t.Main("-Cglobal", "-Wall", "wip/package") t.CheckOutputLines( "Looks fine.") } +// When a single package is checked, only the lines from doc/CHANGES +// that are related to that package are shown. The others are too +// unrelated. +func (s *Suite) Test_Pkgsrc_loadDocChangesFromFile__default(c *check.C) { + t := s.Init(c) + + t.SetUpPackage("category/package") + t.CreateFileLines("doc/CHANGES-2018", + CvsID, + "", + "Changes to the packages collection and infrastructure in 2018:", + "", + "\tUpdated sysutils/checkperms to 1.10 [rillig 2018-01-05]", + "\tUpdated sysutils/checkperms to 1.11 [rillig 2018-01-01]", + "\t\tWrong indentation", + "\tInvalid pkgpath to 1.16 [rillig 2019-06-16]", + "\tUpdated category/package to 2.0 [rillig 2019-07-24]") + t.CreateFileLines("Makefile", + MkCvsID) + + t.Main("category/package") + + t.CheckOutputLines( + "WARN: ~/category/package/Makefile:3: The package is being downgraded from 2.0 (see ../../doc/CHANGES-2018:9) to 1.0.", + "1 warning found.", + "(Run \"pkglint -e\" to show explanations.)") + + // Only when the global checks are enabled, the errors from doc/CHANGES are shown. + t.Main("-Cglobal", "-Wall", ".") + + t.CheckOutputLines( + "WARN: ~/doc/CHANGES-2018:6: Date \"2018-01-01\" for sysutils/checkperms is earlier than \"2018-01-05\" in line 5.", + "WARN: ~/doc/CHANGES-2018:7: Package changes should be indented using a single tab, not \"\\t\\t\".", + "WARN: ~/doc/CHANGES-2018:8: Unknown doc/CHANGES line: \tInvalid pkgpath to 1.16 [rillig 2019-06-16]", + "WARN: ~/doc/CHANGES-2018:9: Year \"2019\" for category/package does not match the filename ~/doc/CHANGES-2018.", + "4 warnings found.", + "(Run \"pkglint -e\" to show explanations.)") +} + func (s *Suite) Test_Pkgsrc_loadDocChangesFromFile__wrong_indentation(c *check.C) { t := s.Init(c) @@ -428,7 +468,7 @@ func (s *Suite) Test_Pkgsrc_loadDocChang " Updated sysutils/checkperms to 1.10 [rillig 2018-01-05]", " \tUpdated sysutils/checkperms to 1.11 [rillig 2018-01-01]") - t.Main(t.File("category/package")) + t.Main("-Cglobal", "-Wall", "category/package") t.CheckOutputLines( "WARN: ~/doc/CHANGES-2018:5: Package changes should be indented using a single tab, not \" \".", @@ -548,6 +588,7 @@ func (s *Suite) Test_Pkgsrc_parseDocChan func (s *Suite) Test_Pkgsrc_loadDocChangesFromFile__old(c *check.C) { t := s.Init(c) + t.SetUpCommandLine("-Cglobal", "-Wall") t.SetUpPkgsrc() t.CreateFileLines("doc/CHANGES-2010", CvsID, Index: pkgsrc/pkgtools/pkglint/files/vartypecheck.go diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.59 pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.60 --- pkgsrc/pkgtools/pkglint/files/vartypecheck.go:1.59 Sun Jul 14 21:25:47 2019 +++ pkgsrc/pkgtools/pkglint/files/vartypecheck.go Tue Jul 30 18:16:13 2019 @@ -502,8 +502,8 @@ func (cv *VartypeCheck) FetchURL() { subdir := cv.Value[len(siteURL):] if hasPrefix(cv.Value, "https://github.com/") { subdir = strings.SplitAfter(subdir, "/")[0] - cv.Warnf("Please use ${%s:=%s} instead of %q and run %q for further tips.", - siteName, subdir, cv.Value, makeHelp("github")) + cv.Warnf("Please use ${%s:=%s} instead of %q and run %q for further instructions.", + siteName, subdir, cv.Value[:len(siteURL)+len(subdir)], makeHelp("github")) } else { cv.Warnf("Please use ${%s:=%s} instead of %q.", siteName, subdir, cv.Value) } Index: pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go diff -u pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.52 pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.53 --- pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go:1.52 Sun Jul 14 21:25:47 2019 +++ pkgsrc/pkgtools/pkglint/files/vartypecheck_test.go Tue Jul 30 18:16:13 2019 @@ -490,8 +490,8 @@ func (s *Suite) Test_VartypeCheck_FetchU vt.Output( "WARN: filename.mk:1: Please use ${MASTER_SITE_GITHUB:=example/} "+ - "instead of \"https://github.com/example/project/\" "+ - "and run \""+confMake+" help topic=github\" for further tips.", + "instead of \"https://github.com/example/\" "+ + "and run \""+confMake+" help topic=github\" for further instructions.", "WARN: filename.mk:2: Please use ${MASTER_SITE_GNU:=bison} "+ "instead of \"http://ftp.gnu.org/pub/gnu/bison\".", "ERROR: filename.mk:3: The subdirectory in MASTER_SITE_GNU must end with a slash.", @@ -525,6 +525,13 @@ func (s *Suite) Test_VartypeCheck_FetchU vt.Values( "${MASTER_SITE_GNU:S,$,subdir/,}") vt.OutputEmpty() + + vt.Values( + "https://github.com/transmission/transmission-releases/raw/master/") + vt.Output( + "WARN: filename.mk:51: Please use ${MASTER_SITE_GITHUB:=transmission/} " + + "instead of \"https://github.com/transmission/\" " + + "and run \"" + confMake + " help topic=github\" for further instructions.") } func (s *Suite) Test_VartypeCheck_FetchURL__without_package(c *check.C) { --_----------=_156451057312170--