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:           Sun May 24 19:12:29 UTC 2020

Modified Files:
        pkgsrc/pkgtools/pkglint: Makefile
        pkgsrc/pkgtools/pkglint/files: distinfo.go distinfo_test.go
            mklinechecker.go mklinechecker_test.go path_test.go pkgsrc.go
            pkgsrc_test.go substcontext.go substcontext_test.go util_test.go
            vardefs.go

Log Message:
pkgtools/pkglint: update to 20.1.10

Changes since 20.1.8:

Recognize SUBST_NOOP_OK and SUBST_SHOW_DIFF.

Allow plain -Wl,-R and -Wl,-rpath in BUILDLINK_TRANSFORM, when they are
used to remove compiler options.

Recognize ggrep and other platform tools as valid tool names.  Seen in
lang/rust.


To generate a diff of this commit:
cvs rdiff -u -r1.648 -r1.649 pkgsrc/pkgtools/pkglint/Makefile
cvs rdiff -u -r1.43 -r1.44 pkgsrc/pkgtools/pkglint/files/distinfo.go
cvs rdiff -u -r1.40 -r1.41 pkgsrc/pkgtools/pkglint/files/distinfo_test.go
cvs rdiff -u -r1.66 -r1.67 pkgsrc/pkgtools/pkglint/files/mklinechecker.go
cvs rdiff -u -r1.60 -r1.61 \
    pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go
cvs rdiff -u -r1.11 -r1.12 pkgsrc/pkgtools/pkglint/files/path_test.go
cvs rdiff -u -r1.54 -r1.55 pkgsrc/pkgtools/pkglint/files/pkgsrc.go
cvs rdiff -u -r1.48 -r1.49 pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go
cvs rdiff -u -r1.37 -r1.38 pkgsrc/pkgtools/pkglint/files/substcontext.go
cvs rdiff -u -r1.35 -r1.36 pkgsrc/pkgtools/pkglint/files/substcontext_test.go
cvs rdiff -u -r1.52 -r1.53 pkgsrc/pkgtools/pkglint/files/util_test.go
cvs rdiff -u -r1.95 -r1.96 pkgsrc/pkgtools/pkglint/files/vardefs.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.648 pkgsrc/pkgtools/pkglint/Makefile:1.649
--- pkgsrc/pkgtools/pkglint/Makefile:1.648      Sun May 24 09:35:12 2020
+++ pkgsrc/pkgtools/pkglint/Makefile    Sun May 24 19:12:29 2020
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.648 2020/05/24 09:35:12 rillig Exp $
+# $NetBSD: Makefile,v 1.649 2020/05/24 19:12:29 rillig Exp $
 
-PKGNAME=       pkglint-20.1.8
+PKGNAME=       pkglint-20.1.10
 CATEGORIES=    pkgtools
 DISTNAME=      tools
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=golang/}

Index: pkgsrc/pkgtools/pkglint/files/distinfo.go
diff -u pkgsrc/pkgtools/pkglint/files/distinfo.go:1.43 pkgsrc/pkgtools/pkglint/files/distinfo.go:1.44
--- pkgsrc/pkgtools/pkglint/files/distinfo.go:1.43      Thu Mar 26 07:02:44 2020
+++ pkgsrc/pkgtools/pkglint/files/distinfo.go   Sun May 24 19:12:29 2020
@@ -6,7 +6,7 @@ import (
        "crypto/sha512"
        "encoding/hex"
        "golang.org/x/crypto/ripemd160"
-       "hash"
+       hashpkg "hash"
        "io"
        "strings"
 )
@@ -243,7 +243,7 @@ func (ck *distinfoLinesChecker) checkAlg
                return
        }
 
-       computeHash := func(hasher hash.Hash) string {
+       computeHash := func(hasher hashpkg.Hash) string {
                f, err := distfile.Open()
                assertNil(err, "Opening distfile")
 

Index: pkgsrc/pkgtools/pkglint/files/distinfo_test.go
diff -u pkgsrc/pkgtools/pkglint/files/distinfo_test.go:1.40 pkgsrc/pkgtools/pkglint/files/distinfo_test.go:1.41
--- pkgsrc/pkgtools/pkglint/files/distinfo_test.go:1.40 Fri May  8 19:50:04 2020
+++ pkgsrc/pkgtools/pkglint/files/distinfo_test.go      Sun May 24 19:12:29 2020
@@ -849,3 +849,47 @@ func (s *Suite) Test_distinfoLinesChecke
        t.CheckOutputLines(
                "ERROR: ~/category/package/distinfo:5: Patch patch-nonexistent does not exist.")
 }
+
+// The check for versioned distfiles only makes sense if the file
+// has the usual hashes for distfiles.
+func (s *Suite) Test_distinfoFileInfo_hasDistfileAlgorithms__code_coverage(c *check.C) {
+       t := s.Init(c)
+
+       t.SetUpPackage("category/package")
+       t.CreateFileLines("category/package/distinfo",
+               CvsID,
+               "",
+               "other (dist-a.tar.gz) = 1234",
+               "RMD160 (dist-a.tar.gz) = 1234",
+               "SHA512 (dist-a.tar.gz) = 1234",
+               "Size (dist-a.tar.gz) = 1234",
+
+               "SHA1 (dist-b.tar.gz) = 1234",
+               "other (dist-b.tar.gz) = 1234",
+               "SHA512 (dist-b.tar.gz) = 1234",
+               "Size (dist-b.tar.gz) = 1234",
+
+               "SHA1 (dist-c.tar.gz) = 1234",
+               "RMD160 (dist-c.tar.gz) = 1234",
+               "other (dist-c.tar.gz) = 1234",
+               "Size (dist-c.tar.gz) = 1234",
+
+               "SHA1 (dist-d.tar.gz) = 1234",
+               "RMD160 (dist-d.tar.gz) = 1234",
+               "SHA512 (dist-d.tar.gz) = 1234",
+               "other (dist-d.tar.gz) = 1234")
+       t.Chdir("category/package")
+       t.FinishSetUp()
+
+       G.Check(".")
+
+       t.CheckOutputLines(
+               "ERROR: distinfo:3: Expected SHA1, RMD160, SHA512, Size checksums for "+
+                       "\"dist-a.tar.gz\", got other, RMD160, SHA512, Size.",
+               "ERROR: distinfo:7: Expected SHA1, RMD160, SHA512, Size checksums for "+
+                       "\"dist-b.tar.gz\", got SHA1, other, SHA512, Size.",
+               "ERROR: distinfo:11: Expected SHA1, RMD160, SHA512, Size checksums for "+
+                       "\"dist-c.tar.gz\", got SHA1, RMD160, other, Size.",
+               "ERROR: distinfo:15: Expected SHA1, RMD160, SHA512, Size checksums for "+
+                       "\"dist-d.tar.gz\", got SHA1, RMD160, SHA512, other.")
+}

Index: pkgsrc/pkgtools/pkglint/files/mklinechecker.go
diff -u pkgsrc/pkgtools/pkglint/files/mklinechecker.go:1.66 pkgsrc/pkgtools/pkglint/files/mklinechecker.go:1.67
--- pkgsrc/pkgtools/pkglint/files/mklinechecker.go:1.66 Thu Apr 30 21:15:03 2020
+++ pkgsrc/pkgtools/pkglint/files/mklinechecker.go      Sun May 24 19:12:29 2020
@@ -110,8 +110,16 @@ func (ck MkLineChecker) checkTextWrksrcD
 //
 // Note: A simple -R is not detected, as the rate of false positives is too high.
 func (ck MkLineChecker) checkTextRpath(text string) {
+       mkline := ck.MkLine
+
+       if mkline.IsVarassign() && mkline.Varname() == "BUILDLINK_TRANSFORM" &&
+               hasPrefix(mkline.Value(), "rm:") {
+
+               return
+       }
+
        if m, flag := match1(text, `(-Wl,--rpath,|-Wl,-rpath-link,|-Wl,-rpath,|-Wl,-R\b)`); m {
-               ck.MkLine.Warnf("Please use ${COMPILER_RPATH_FLAG} instead of %q.", flag)
+               mkline.Warnf("Please use ${COMPILER_RPATH_FLAG} instead of %q.", flag)
        }
 }
 

Index: pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go:1.60 pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go:1.61
--- pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go:1.60    Thu Apr 30 21:15:03 2020
+++ pkgsrc/pkgtools/pkglint/files/mklinechecker_test.go Sun May 24 19:12:29 2020
@@ -172,6 +172,20 @@ func (s *Suite) Test_MkLineChecker_check
                "WARN: ~/module.mk:3: WRKSRC is used but not defined.")
 }
 
+// In general, -Wl,-R should not appear in package Makefiles.
+// BUILDLINK_TRANSFORM is an exception to this since this command line option
+// is removed here from the compiler invocations.
+func (s *Suite) Test_MkLineChecker_checkTextRpath(c *check.C) {
+       t := s.Init(c)
+
+       t.NewMkLines("filename.mk",
+               MkCvsID,
+               "BUILDLINK_TRANSFORM+=\trm:-Wl,-R/usr/lib",
+               "BUILDLINK_TRANSFORM+=\trm:-Wl,-rpath,/usr/lib")
+
+       t.CheckOutputEmpty()
+}
+
 func (s *Suite) Test_MkLineChecker_checkVartype__simple_type(c *check.C) {
        t := s.Init(c)
 

Index: pkgsrc/pkgtools/pkglint/files/path_test.go
diff -u pkgsrc/pkgtools/pkglint/files/path_test.go:1.11 pkgsrc/pkgtools/pkglint/files/path_test.go:1.12
--- pkgsrc/pkgtools/pkglint/files/path_test.go:1.11     Sun Mar 22 17:43:15 2020
+++ pkgsrc/pkgtools/pkglint/files/path_test.go  Sun May 24 19:12:29 2020
@@ -489,6 +489,8 @@ func (s *Suite) Test_Path_IsAbs(c *check
        test("/a", true)
        test("C:/", true)
        test("c:/", true)
+       test("c::", false)
+       test("c:relative", false)
 }
 
 func (s *Suite) Test_Path_Rel(c *check.C) {

Index: pkgsrc/pkgtools/pkglint/files/pkgsrc.go
diff -u pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.54 pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.55
--- pkgsrc/pkgtools/pkglint/files/pkgsrc.go:1.54        Fri May  8 19:50:04 2020
+++ pkgsrc/pkgtools/pkglint/files/pkgsrc.go     Sun May 24 19:12:29 2020
@@ -544,6 +544,12 @@ func (src *Pkgsrc) loadToolsPlatform() {
                scope.IsRelevant = func(*MkLine) bool { return false }
                scope.Check(mklines)
                scopes[opsys] = scope
+
+               mklines.ForEach(func(mkline *MkLine) {
+                       if mkline.IsVarassign() && hasPrefix(mkline.Varname(), "TOOLS_PLATFORM.") {
+                               src.Tools.Define(mkline.Varparam(), "", mkline)
+                       }
+               })
        }
 
        // 0 = undefined, 1 = conditional, 2 = definitely assigned

Index: pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go
diff -u pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go:1.48 pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go:1.49
--- pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go:1.48   Fri May  8 19:50:04 2020
+++ pkgsrc/pkgtools/pkglint/files/pkgsrc_test.go        Sun May 24 19:12:29 2020
@@ -705,6 +705,8 @@ func (s *Suite) Test_Pkgsrc_loadTools(c 
                "USE_TOOLS+=\tm4:pkgsrc")
        t.CreateFileLines("mk/bsd.pkg.mk",
                "USE_TOOLS+=\tmv")
+       t.CreateFileLines("mk/tools/tools.NetBSD.mk",
+               "TOOLS_PLATFORM.ggrep=\t/usr/bin/grep")
 
        G.Pkgsrc.loadTools()
 
@@ -721,6 +723,7 @@ func (s *Suite) Test_Pkgsrc_loadTools(c 
                "TRACE: 1   tool echo -n:ECHO_N:var:AfterPrefsMk",
                "TRACE: 1   tool false:FALSE:var:AtRunTime",
                "TRACE: 1   tool gawk:AWK::Nowhere",
+               "TRACE: 1   tool ggrep:::Nowhere",
                "TRACE: 1   tool m4:::AfterPrefsMk",
                "TRACE: 1   tool msgfmt:::AtRunTime",
                "TRACE: 1   tool mv:MV::AtRunTime",

Index: pkgsrc/pkgtools/pkglint/files/substcontext.go
diff -u pkgsrc/pkgtools/pkglint/files/substcontext.go:1.37 pkgsrc/pkgtools/pkglint/files/substcontext.go:1.38
--- pkgsrc/pkgtools/pkglint/files/substcontext.go:1.37  Sun Jan 26 17:12:36 2020
+++ pkgsrc/pkgtools/pkglint/files/substcontext.go       Sun May 24 19:12:29 2020
@@ -218,6 +218,8 @@ func (ctx *SubstContext) deactivate(diag
 }
 
 func (*SubstContext) isForeign(varcanon string) bool {
+       // keep in sync with substBlock.varassign
+
        switch varcanon {
        case
                "SUBST_STAGE.*",
@@ -225,7 +227,10 @@ func (*SubstContext) isForeign(varcanon 
                "SUBST_FILES.*",
                "SUBST_SED.*",
                "SUBST_VARS.*",
-               "SUBST_FILTER_CMD.*":
+               "SUBST_FILTER_CMD.*",
+               "SUBST_SKIP_TEXT_CHECK.*", // TODO: remove this from subst.mk (unneeded)
+               "SUBST_SHOW_DIFF.*",       // TODO: remove this from subst.mk (unneeded)
+               "SUBST_NOOP_OK.*":
                return false
        }
        return true
@@ -399,6 +404,8 @@ func newSubstBlock(id string) *substBloc
 }
 
 func (b *substBlock) varassign(mkline *MkLine, pkg *Package) {
+       // keep in sync with SubstBlock.isForeign
+
        switch mkline.Varcanon() {
        case "SUBST_STAGE.*":
                b.varassignStage(mkline, pkg)
@@ -410,7 +417,7 @@ func (b *substBlock) varassign(mkline *M
                b.varassignSed(mkline)
        case "SUBST_VARS.*":
                b.varassignVars(mkline)
-       default:
+       case "SUBST_FILTER_CMD.*":
                b.varassignFilterCmd(mkline)
        }
 }

Index: pkgsrc/pkgtools/pkglint/files/substcontext_test.go
diff -u pkgsrc/pkgtools/pkglint/files/substcontext_test.go:1.35 pkgsrc/pkgtools/pkglint/files/substcontext_test.go:1.36
--- pkgsrc/pkgtools/pkglint/files/substcontext_test.go:1.35     Sat Jan  4 19:53:14 2020
+++ pkgsrc/pkgtools/pkglint/files/substcontext_test.go  Sun May 24 19:12:29 2020
@@ -254,6 +254,33 @@ func (s *Suite) Test_SubstContext_varass
                        "Please add only one class at a time to SUBST_CLASSES.")
 }
 
+func (s *Suite) Test_SubstContext_varassign__noop_ok(c *check.C) {
+       t := s.Init(c)
+
+       t.RunSubst(
+               "SUBST_CLASSES+=         id",
+               "SUBST_STAGE.id=         post-configure",
+               "SUBST_FILES.id=         setup.py",
+               "SUBST_VARS.id=          VAR",
+               "SUBST_NOOP_OK.id=       yes")
+
+       t.CheckOutputEmpty()
+}
+
+func (s *Suite) Test_SubstContext_varassign__other_variables(c *check.C) {
+       t := s.Init(c)
+
+       t.RunSubst(
+               "SUBST_CLASSES+=         id",
+               "SUBST_STAGE.id=         post-configure",
+               "SUBST_FILES.id=         setup.py",
+               "SUBST_VARS.id=          VAR",
+               "SUBST_SKIP_TEXT_CHECK.id= yes",
+               "SUBST_SHOW_DIFF.id=     yes")
+
+       t.CheckOutputEmpty()
+}
+
 func (s *Suite) Test_SubstContext_varassignClasses__OPSYSVARS(c *check.C) {
        t := s.Init(c)
 

Index: pkgsrc/pkgtools/pkglint/files/util_test.go
diff -u pkgsrc/pkgtools/pkglint/files/util_test.go:1.52 pkgsrc/pkgtools/pkglint/files/util_test.go:1.53
--- pkgsrc/pkgtools/pkglint/files/util_test.go:1.52     Sun Mar 22 17:43:15 2020
+++ pkgsrc/pkgtools/pkglint/files/util_test.go  Sun May 24 19:12:29 2020
@@ -715,11 +715,15 @@ func (s *Suite) Test_Scope_LastValue__ap
                ".include \"Makefile.common\"",
                "PLIST_VARS+=\ttwo",
                "PLIST.two=\tyes")
-       t.CreateFileLines("category/package/Makefile.common",
+       t.Chdir("category/package")
+       t.CreateFileLines("PLIST",
+               PlistCvsID,
+               "${PLIST.one}${PLIST.two}bin/program")
+       t.CreateFileLines("Makefile.common",
                MkCvsID,
                "PLIST_VARS=\tone",
                "PLIST.one=\tyes")
-       pkg := NewPackage(t.File("category/package"))
+       pkg := NewPackage(".")
        t.FinishSetUp()
 
        pkg.Check()

Index: pkgsrc/pkgtools/pkglint/files/vardefs.go
diff -u pkgsrc/pkgtools/pkglint/files/vardefs.go:1.95 pkgsrc/pkgtools/pkglint/files/vardefs.go:1.96
--- pkgsrc/pkgtools/pkglint/files/vardefs.go:1.95       Fri May  8 19:50:04 2020
+++ pkgsrc/pkgtools/pkglint/files/vardefs.go    Sun May 24 19:12:29 2020
@@ -1334,7 +1334,7 @@ func (reg *VarTypeRegistry) Init(src *Pk
        reg.syslist("MISSING_FEATURES", BtIdentifierDirect)
        reg.pkglist("MYSQL_VERSIONS_ACCEPTED", mysqlVersions)
        reg.usr("MYSQL_VERSION_DEFAULT", BtVersion)
-       reg.sys("NATIVE_CC", BtShellCommand) // See mk/platform/tools.NetBSD.mk (and some others).
+       reg.sys("NATIVE_CC", BtShellCommand) // See mk/tools/tools.NetBSD.mk (and some others).
        reg.sys("NM", BtShellCommand)
        reg.sys("NONBINMODE", BtFileMode)
        reg.pkglistrat("NOT_FOR_COMPILER", compilers)
@@ -1660,14 +1660,19 @@ func (reg *VarTypeRegistry) Init(src *Pk
                PackageSettable,
                "Makefile: append")
 
+       reg.usr("SUBST_NOOP_OK", BtYesNo)
+       reg.usr("SUBST_SHOW_DIFF", BtYesNo)
        reg.pkglistbl3("SUBST_CLASSES", BtIdentifierDirect)
        reg.pkglistbl3("SUBST_CLASSES.*", BtIdentifierDirect) // OPSYS-specific
-       reg.pkglistbl3("SUBST_FILES.*", BtWrksrcPathPattern)
-       reg.pkgbl3("SUBST_FILTER_CMD.*", BtShellCommand)
+       reg.pkgbl3("SUBST_STAGE.*", BtStage)
        reg.pkgbl3("SUBST_MESSAGE.*", BtMessage)
+       reg.pkglistbl3("SUBST_FILES.*", BtWrksrcPathPattern)
        reg.pkgappendbl3("SUBST_SED.*", BtSedCommands)
-       reg.pkgbl3("SUBST_STAGE.*", BtStage)
        reg.pkglistbl3("SUBST_VARS.*", BtVariableName)
+       reg.pkgbl3("SUBST_FILTER_CMD.*", BtShellCommand)
+       reg.pkgbl3("SUBST_SKIP_TEXT_CHECK.*", BtYesNo)
+       reg.pkgbl3("SUBST_SHOW_DIFF.*", BtYesNo)
+       reg.pkgbl3("SUBST_NOOP_OK.*", BtYesNo)
 
        reg.pkglist("SUPERSEDES", BtDependencyPattern)
        reg.pkglist("TEST_DEPENDS", BtDependencyWithPath)



Home | Main Index | Thread Index | Old Index