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: Sat Jul 9 06:40:55 UTC 2022
Modified Files:
pkgsrc/pkgtools/pkglint: Makefile
pkgsrc/pkgtools/pkglint/files: distinfo.go mkassignchecker.go
mkcondchecker.go mkparser.go mkparser_test.go
Log Message:
pkgtools/pkglint: update to 22.2.2
Changes since 22.2.1:
Require the current checksum algorithms for pkgsrc-wip packages as well.
SHA1 and RMD160 are no longer allowed for distfiles.
Do not warn about 'Package should not' when checking .mk files in the
pkgsrc infrastructure.
To generate a diff of this commit:
cvs rdiff -u -r1.720 -r1.721 pkgsrc/pkgtools/pkglint/Makefile
cvs rdiff -u -r1.49 -r1.50 pkgsrc/pkgtools/pkglint/files/distinfo.go
cvs rdiff -u -r1.13 -r1.14 pkgsrc/pkgtools/pkglint/files/mkassignchecker.go
cvs rdiff -u -r1.12 -r1.13 pkgsrc/pkgtools/pkglint/files/mkcondchecker.go
cvs rdiff -u -r1.43 -r1.44 pkgsrc/pkgtools/pkglint/files/mkparser.go
cvs rdiff -u -r1.42 -r1.43 pkgsrc/pkgtools/pkglint/files/mkparser_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.720 pkgsrc/pkgtools/pkglint/Makefile:1.721
--- pkgsrc/pkgtools/pkglint/Makefile:1.720 Wed Jul 6 06:14:24 2022
+++ pkgsrc/pkgtools/pkglint/Makefile Sat Jul 9 06:40:54 2022
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.720 2022/07/06 06:14:24 rillig Exp $
+# $NetBSD: Makefile,v 1.721 2022/07/09 06:40:54 rillig Exp $
-PKGNAME= pkglint-22.2.1
+PKGNAME= pkglint-22.2.2
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.49 pkgsrc/pkgtools/pkglint/files/distinfo.go:1.50
--- pkgsrc/pkgtools/pkglint/files/distinfo.go:1.49 Sat Nov 20 18:06:13 2021
+++ pkgsrc/pkgtools/pkglint/files/distinfo.go Sat Jul 9 06:40:55 2022
@@ -6,7 +6,6 @@ import (
"crypto/sha512"
"encoding/hex"
"golang.org/x/crypto/blake2s"
- "golang.org/x/crypto/ripemd160"
hashpkg "hash"
"io"
"strings"
@@ -149,18 +148,6 @@ func (ck *distinfoLinesChecker) checkAlg
return
case algorithms == "BLAKE2s, SHA512, Size" && isPatch != yes:
return
- case G.Wip && algorithms == "RMD160, SHA512, Size" && isPatch != yes:
- // TODO: remove after 2021Q4. Until then, allow pkgsrc-wip to
- // be used with the stable 2021Q3.
- return
- case G.Wip && algorithms == "SHA1, RMD160, SHA512, Size" && isPatch != yes:
- // TODO: remove after 2021Q4. Until then, allow pkgsrc-wip to
- // be used with the stable 2021Q3.
- return
- case G.Wip && algorithms == "SHA1, BLAKE2s, SHA512, Size" && isPatch != yes:
- // TODO: remove after 2021Q4. Until then, allow pkgsrc-wip to
- // be used with the stable 2021Q3.
- return
}
switch {
@@ -277,8 +264,6 @@ func (ck *distinfoLinesChecker) checkAlg
switch alg {
case "SHA1":
return computeHash(sha1.New())
- case "RMD160": // TODO: remove after 2021Q4
- return computeHash(ripemd160.New())
case "BLAKE2s":
blake, err := blake2s.New256(nil)
assertNil(err, "blake2s")
@@ -462,15 +447,6 @@ func (info *distinfoFileInfo) algorithms
func (info *distinfoFileInfo) hasDistfileAlgorithms() bool {
h := info.hashes
- // TODO: remove after 2021Q4. Until then, allow pkgsrc-wip to
- // be used with the stable 2021Q3.
- if G.Wip && len(h) == 4 &&
- h[0].algorithm == "SHA1" &&
- h[1].algorithm == "RMD160" &&
- h[2].algorithm == "SHA512" &&
- h[3].algorithm == "Size" {
- return true
- }
return len(h) == 3 &&
h[0].algorithm == "BLAKE2s" &&
h[1].algorithm == "SHA512" &&
Index: pkgsrc/pkgtools/pkglint/files/mkassignchecker.go
diff -u pkgsrc/pkgtools/pkglint/files/mkassignchecker.go:1.13 pkgsrc/pkgtools/pkglint/files/mkassignchecker.go:1.14
--- pkgsrc/pkgtools/pkglint/files/mkassignchecker.go:1.13 Mon Mar 21 22:30:06 2022
+++ pkgsrc/pkgtools/pkglint/files/mkassignchecker.go Sat Jul 9 06:40:55 2022
@@ -199,6 +199,10 @@ func (ck *MkAssignChecker) checkLeftUser
}
switch {
+ case G.Infrastructure:
+ // No warnings, as the usage patterns between the packages
+ // and the pkgsrc infrastructure differ a lot.
+
case mkline.HasComment():
// Assume that the comment contains a rationale for disabling
// this particular check.
Index: pkgsrc/pkgtools/pkglint/files/mkcondchecker.go
diff -u pkgsrc/pkgtools/pkglint/files/mkcondchecker.go:1.12 pkgsrc/pkgtools/pkglint/files/mkcondchecker.go:1.13
--- pkgsrc/pkgtools/pkglint/files/mkcondchecker.go:1.12 Wed Jul 6 06:14:24 2022
+++ pkgsrc/pkgtools/pkglint/files/mkcondchecker.go Sat Jul 9 06:40:55 2022
@@ -246,10 +246,12 @@ func (ck *MkCondChecker) simplify(varuse
// Replace empty(VAR:M*.c) with !${VAR:M*.c}.
if fromEmpty && positive && !exact && vartype != nil && isDefined() &&
// Restrict replacements to very simple patterns with only few
- // special characters.
+ // special characters, for now.
// Before generalizing this to arbitrary strings, there has to be
// a proper code generator for these conditions that handles all
// possible escaping.
+ // The same reasoning applies to the variable name, even though the
+ // variable name typically only uses a restricted character set.
matches(varuse.Mod(), `^[*.:\w]+$`) {
fixedPart := varname + modsExceptLast + ":M" + pattern
Index: pkgsrc/pkgtools/pkglint/files/mkparser.go
diff -u pkgsrc/pkgtools/pkglint/files/mkparser.go:1.43 pkgsrc/pkgtools/pkglint/files/mkparser.go:1.44
--- pkgsrc/pkgtools/pkglint/files/mkparser.go:1.43 Sun Jun 14 11:35:54 2020
+++ pkgsrc/pkgtools/pkglint/files/mkparser.go Sat Jul 9 06:40:55 2022
@@ -437,8 +437,10 @@ func ToVarUse(str string) *MkVarUse {
//
// The representation is somewhere between syntactic and semantic.
// Unnecessary parentheses are omitted in this representation,
+// (TODO: double-check; the 'paren(paren(paren()))' tests contradict)
// but !empty(VARNAME) is represented differently from ${VARNAME} != "".
// For higher level analysis, a unified representation might be better.
+// See MkParser.MkCond.
type MkCond struct {
Or []*MkCond
And []*MkCond
Index: pkgsrc/pkgtools/pkglint/files/mkparser_test.go
diff -u pkgsrc/pkgtools/pkglint/files/mkparser_test.go:1.42 pkgsrc/pkgtools/pkglint/files/mkparser_test.go:1.43
--- pkgsrc/pkgtools/pkglint/files/mkparser_test.go:1.42 Sat Jan 1 12:44:25 2022
+++ pkgsrc/pkgtools/pkglint/files/mkparser_test.go Sat Jul 9 06:40:55 2022
@@ -1,6 +1,7 @@
package pkglint
import (
+ "encoding/json"
"gopkg.in/check.v1"
"strings"
)
@@ -40,13 +41,22 @@ func (s *Suite) Test_MkParser_MkCond(c *
defined := func(varname string) *MkCond { return &MkCond{Defined: varname} }
paren := func(cond *MkCond) *MkCond { return &MkCond{Paren: cond} }
+ toJSON := func(obj interface{}) string {
+ var sb strings.Builder
+ encoder := json.NewEncoder(&sb)
+ encoder.SetIndent("", " ")
+ err := encoder.Encode(obj)
+ t.AssertNil(err)
+ return sb.String()
+ }
+
testRest := func(input string, expectedTree *MkCond, expectedRest string) {
// As of July 2019 p.MkCond does not emit warnings;
// this is left to MkCondChecker.Check.
line := t.NewLine("filename.mk", 1, ".if "+input)
p := NewMkParser(line, input)
actualTree := p.MkCond()
- t.CheckDeepEquals(actualTree, expectedTree)
+ t.CheckDeepEquals(toJSON(actualTree), toJSON(expectedTree))
t.CheckEquals(p.Rest(), expectedRest)
}
test := func(input string, expectedTree *MkCond) {
@@ -187,6 +197,18 @@ func (s *Suite) Test_MkParser_MkCond(c *
test("target(do-build)",
call("target", "do-build"))
+ test("(!defined(VAR))",
+ paren(not(defined("VAR"))))
+
+ test("(((((!defined(VAR))))))",
+ paren(paren(paren(paren(paren(not(defined("VAR"))))))))
+
+ test("(${VAR} == \"value\")",
+ paren(cmp(cvar("VAR"), "==", cstr("value"))))
+
+ test("(((((${VAR} == \"value\")))))",
+ paren(paren(paren(paren(paren(cmp(cvar("VAR"), "==", cstr("value"))))))))
+
// TODO: ok "${q}text${q} == ${VAR}"
// TODO: fail "text${q} == ${VAR}"
// TODO: ok "${VAR} == ${q}text${q}"
Home |
Main Index |
Thread Index |
Old Index