pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint pkglint: update to 21.3.2
details: https://anonhg.NetBSD.org/pkgsrc/rev/2f0c60d1668f
branches: trunk
changeset: 768643:2f0c60d1668f
user: rillig <rillig%pkgsrc.org@localhost>
date: Thu Oct 28 20:15:25 2021 +0000
description:
pkglint: update to 21.3.2
Changes since 21.3.1:
Replace RMD160 with BLAKE2s for distfiles in main pkgsrc, keep the
previous RMD160 for pkgsrc-wip, at least until 2021Q4.
diffstat:
pkgtools/pkglint/Makefile | 4 +-
pkgtools/pkglint/files/check_test.go | 3 +-
pkgtools/pkglint/files/distinfo.go | 31 ++++-
pkgtools/pkglint/files/distinfo_test.go | 158 ++++++++++++-------------------
pkgtools/pkglint/files/homepage.go | 16 +--
pkgtools/pkglint/files/package_test.go | 40 ++++----
pkgtools/pkglint/files/pkglint_test.go | 5 +-
7 files changed, 113 insertions(+), 144 deletions(-)
diffs (truncated from 690 to 300 lines):
diff -r b8e05fd337dc -r 2f0c60d1668f pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Thu Oct 28 20:13:33 2021 +0000
+++ b/pkgtools/pkglint/Makefile Thu Oct 28 20:15:25 2021 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.700 2021/10/09 08:33:09 rillig Exp $
+# $NetBSD: Makefile,v 1.701 2021/10/28 20:15:25 rillig Exp $
-PKGNAME= pkglint-21.3.1
+PKGNAME= pkglint-21.3.2
CATEGORIES= pkgtools
DISTNAME= tools
MASTER_SITES= ${MASTER_SITE_GITHUB:=golang/}
diff -r b8e05fd337dc -r 2f0c60d1668f pkgtools/pkglint/files/check_test.go
--- a/pkgtools/pkglint/files/check_test.go Thu Oct 28 20:13:33 2021 +0000
+++ b/pkgtools/pkglint/files/check_test.go Thu Oct 28 20:15:25 2021 +0000
@@ -479,8 +479,7 @@
t.CreateFileLines(pkgpath.JoinNoClean("distinfo"),
CvsID,
"",
- "SHA1 (distfile-1.0.tar.gz) = 12341234",
- "RMD160 (distfile-1.0.tar.gz) = 12341234",
+ "BLAKE2s (distfile-1.0.tar.gz) = 12341234",
"SHA512 (distfile-1.0.tar.gz) = 12341234",
"Size (distfile-1.0.tar.gz) = 12341234")
diff -r b8e05fd337dc -r 2f0c60d1668f pkgtools/pkglint/files/distinfo.go
--- a/pkgtools/pkglint/files/distinfo.go Thu Oct 28 20:13:33 2021 +0000
+++ b/pkgtools/pkglint/files/distinfo.go Thu Oct 28 20:15:25 2021 +0000
@@ -5,6 +5,7 @@
"crypto/sha1"
"crypto/sha512"
"encoding/hex"
+ "golang.org/x/crypto/blake2s"
"golang.org/x/crypto/ripemd160"
hashpkg "hash"
"io"
@@ -146,10 +147,16 @@
switch {
case algorithms == "SHA1" && isPatch != no:
return
- case algorithms == "RMD160, SHA512, Size" && isPatch != yes:
+ case algorithms == "BLAKE2s, SHA512, Size" && isPatch != yes:
return
- case algorithms == "SHA1, RMD160, SHA512, Size" && isPatch != yes:
- return // TODO: remove as of 2021Q3
+ 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, BLAKE2s, SHA512, Size" && isPatch != yes:
+ // TODO: remove after 2021Q4. Until then, allow pkgsrc-wip to
+ // be used with the stable 2021Q3.
+ return
}
switch {
@@ -160,7 +167,7 @@
line.Errorf("Wrong checksum algorithms %s for %s.", algorithms, filename)
line.Explain(
"Distfiles that are downloaded from external sources must have the",
- "checksum algorithms RMD160, SHA512, Size.",
+ "checksum algorithms BLAKE2s, SHA512, Size.",
"",
"Patch files from pkgsrc must have only the SHA1 hash.")
@@ -191,10 +198,10 @@
// added to the distinfo file via an autofix.
func (ck *distinfoLinesChecker) checkAlgorithmsDistfile(info distinfoFileInfo) {
line := info.line()
- line.Errorf("Expected RMD160, SHA512, Size checksums for %q, got %s.",
+ line.Errorf("Expected BLAKE2s, SHA512, Size checksums for %q, got %s.",
info.filename(), info.algorithms())
- algorithms := [...]string{"RMD160", "SHA512", "Size"}
+ algorithms := [...]string{"BLAKE2s", "SHA512", "Size"}
missing := map[string]bool{}
for _, alg := range algorithms {
@@ -266,8 +273,12 @@
switch alg {
case "SHA1":
return computeHash(sha1.New())
- case "RMD160":
+ case "RMD160": // TODO: remove after 2021Q4
return computeHash(ripemd160.New())
+ case "BLAKE2s":
+ blake, err := blake2s.New256(nil)
+ assertNil(err, "blake2s")
+ return computeHash(blake)
case "SHA512":
return computeHash(sha512.New())
default:
@@ -447,7 +458,9 @@
func (info *distinfoFileInfo) hasDistfileAlgorithms() bool {
h := info.hashes
- if len(h) == 4 && // TODO: remove as of 2021Q3
+ // 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" &&
@@ -455,7 +468,7 @@
return true
}
return len(h) == 3 &&
- h[0].algorithm == "RMD160" &&
+ h[0].algorithm == "BLAKE2s" &&
h[1].algorithm == "SHA512" &&
h[2].algorithm == "Size"
}
diff -r b8e05fd337dc -r 2f0c60d1668f pkgtools/pkglint/files/distinfo_test.go
--- a/pkgtools/pkglint/files/distinfo_test.go Thu Oct 28 20:13:33 2021 +0000
+++ b/pkgtools/pkglint/files/distinfo_test.go Thu Oct 28 20:15:25 2021 +0000
@@ -31,7 +31,7 @@
"ERROR: distinfo:1: Invalid line: should be the CVS ID",
"ERROR: distinfo:2: Invalid line: should be empty",
"ERROR: distinfo:8: Invalid line: Another invalid line",
- "ERROR: distinfo:3: Expected RMD160, SHA512, Size checksums for \"distfile-1.0.tar.gz\", got MD5, SHA1.",
+ "ERROR: distinfo:3: Expected BLAKE2s, SHA512, Size checksums for \"distfile-1.0.tar.gz\", got MD5, SHA1.",
"ERROR: distinfo:5: Expected SHA1 hash for patch-aa, got SHA1, Size.",
"WARN: distinfo:9: Patch file \"patch-nonexistent\" does not exist in directory \"patches\".")
}
@@ -238,20 +238,16 @@
t.CreateFileLines("category/package/distinfo",
CvsID,
"",
- "SHA1 (ok-1.0.tar.gz) = 1234",
- "RMD160 (ok-1.0.tar.gz) = 1234",
+ "BLAKE2s (ok-1.0.tar.gz) = 1234",
"SHA512 (ok-1.0.tar.gz) = 1234",
"Size (ok-1.0.tar.gz) = 1234",
- "SHA1 (not-ok.tar.gz) = 1234",
- "RMD160 (not-ok.tar.gz) = 1234",
+ "BLAKE2s (not-ok.tar.gz) = 1234",
"SHA512 (not-ok.tar.gz) = 1234",
"Size (not-ok.tar.gz) = 1234",
- "SHA1 (non-versioned/not-ok.tar.gz) = 1234",
- "RMD160 (non-versioned/not-ok.tar.gz) = 1234",
+ "BLAKE2s (non-versioned/not-ok.tar.gz) = 1234",
"SHA512 (non-versioned/not-ok.tar.gz) = 1234",
"Size (non-versioned/not-ok.tar.gz) = 1234",
- "SHA1 (versioned-1/ok.tar.gz) = 1234",
- "RMD160 (versioned-1/ok.tar.gz) = 1234",
+ "BLAKE2s (versioned-1/ok.tar.gz) = 1234",
"SHA512 (versioned-1/ok.tar.gz) = 1234",
"Size (versioned-1/ok.tar.gz) = 1234")
t.Chdir("category/package")
@@ -260,9 +256,9 @@
G.Check(".")
t.CheckOutputLines(
- "WARN: distinfo:7: Distfiles without version number "+
+ "WARN: distinfo:6: Distfiles without version number "+
"should be placed in a versioned DIST_SUBDIR.",
- "WARN: distinfo:11: Distfiles without version number "+
+ "WARN: distinfo:9: Distfiles without version number "+
"should be placed in a versioned DIST_SUBDIR.")
}
@@ -283,7 +279,7 @@
// a patch, it is a normal distfile because it has other hash algorithms
// than exactly SHA1.
t.CheckOutputLines(
- "ERROR: distinfo:3: Expected RMD160, SHA512, Size checksums " +
+ "ERROR: distinfo:3: Expected BLAKE2s, SHA512, Size checksums " +
"for \"patch-5.3.tar.gz\", got MD5, SHA1.")
}
@@ -300,7 +296,7 @@
CheckLinesDistinfo(nil, lines)
t.CheckOutputLines(
- "ERROR: distinfo:3: Expected RMD160, SHA512, Size checksums " +
+ "ERROR: distinfo:3: Expected BLAKE2s, SHA512, Size checksums " +
"for \"distfile.tar.gz\", got MD5, SHA1.")
}
@@ -326,7 +322,7 @@
"ERROR: distinfo:3: Wrong checksum algorithms MD5 for patch-4.2.tar.gz.",
"",
"\tDistfiles that are downloaded from external sources must have the",
- "\tchecksum algorithms RMD160, SHA512, Size.",
+ "\tchecksum algorithms BLAKE2s, SHA512, Size.",
"",
"\tPatch files from pkgsrc must have only the SHA1 hash.",
"")
@@ -360,8 +356,7 @@
lines := t.SetUpFileLines("distinfo",
CvsID,
"",
- "SHA1 (patch-aa) = ...",
- "RMD160 (patch-aa) = ...",
+ "BLAKE2s (patch-aa) = ...",
"SHA512 (patch-aa) = ...",
"Size (patch-aa) = ... bytes")
@@ -369,7 +364,7 @@
// The file name certainly looks like a pkgsrc patch, but there
// is no corresponding file in the file system, and there is no
- // current package to correctly determine the PATCHDIR. Therefore
+ // current package to correctly determine the PATCHDIR. Therefore,
// pkglint doesn't know whether this is a distfile or a missing
// patch file and doesn't warn at all.
t.CheckOutputEmpty()
@@ -382,8 +377,7 @@
t.CreateFileLines("category/package/distinfo",
CvsID,
"",
- "SHA1 (patch-aa) = ...",
- "RMD160 (patch-aa) = ...",
+ "BLAKE2s (patch-aa) = ...",
"SHA512 (patch-aa) = ...",
"Size (patch-aa) = ... bytes")
t.CreateFileDummyPatch("category/package/patches/patch-aa")
@@ -398,11 +392,8 @@
// that the distinfo lines clearly refer to that patch file and not
// to a distfile.
t.CheckOutputLines(
- "ERROR: ~/category/package/distinfo:3: "+
- "Expected SHA1 hash for patch-aa, got SHA1, RMD160, SHA512, Size.",
- "ERROR: ~/category/package/distinfo:3: "+
- "SHA1 hash of patches/patch-aa differs (distinfo has ..., "+
- "patch file has 9a93207561abfef7e7550598c5a08f2c3226995b).")
+ "ERROR: ~/category/package/distinfo:3: " +
+ "Expected SHA1 hash for patch-aa, got BLAKE2s, SHA512, Size.")
}
func (s *Suite) Test_distinfoLinesChecker_checkAlgorithms__missing_patch_with_wrong_algorithms(c *check.C) {
@@ -412,7 +403,7 @@
t.SetUpFileLines("category/package/distinfo",
CvsID,
"",
- "RMD160 (patch-aa) = ...")
+ "BLAKE2s (patch-aa) = ...")
t.FinishSetUp()
G.Check(t.File("category/package"))
@@ -422,7 +413,7 @@
// therefore it requires the usual distfile checksum algorithms here.
t.CheckOutputLines(
"ERROR: ~/category/package/distinfo:3: " +
- "Expected RMD160, SHA512, Size checksums for \"patch-aa\", got RMD160.")
+ "Expected BLAKE2s, SHA512, Size checksums for \"patch-aa\", got BLAKE2s.")
}
// When there is at least one correct hash for a distfile and the distfile
@@ -436,21 +427,21 @@
t.CreateFileLines("category/package/distinfo",
CvsID,
"",
- "RMD160 (package-1.0.txt) = 1a88147a0344137404c63f3b695366eab869a98a",
+ "BLAKE2s (package-1.0.txt) = ee494623e60caeda840ed7de4fb70db4a36bc92b445b09f12b9ed46094e9bd59",
"Size (package-1.0.txt) = 13 bytes",
"CRC32 (package-1.0.txt) = asdf")
t.CreateFileLines("distfiles/package-1.0.txt",
"hello, world")
t.FinishSetUp()
- // This run is only used to verify that the RMD160 hash is correct, and if
+ // This run is only used to verify that the BLAKE2s hash is correct, and if
// it should ever differ, the correct hash will appear in an error message.
G.Check(t.File("category/package"))
t.CheckOutputLines(
"ERROR: ~/category/package/distinfo:3: "+
- "Expected RMD160, SHA512, Size checksums for \"package-1.0.txt\", "+
- "got RMD160, Size, CRC32.",
+ "Expected BLAKE2s, SHA512, Size checksums for \"package-1.0.txt\", "+
+ "got BLAKE2s, Size, CRC32.",
"ERROR: ~/category/package/distinfo:3: Missing SHA512 hash for package-1.0.txt.")
t.SetUpCommandLine("-Wall", "--autofix", "--show-autofix", "--source")
@@ -466,7 +457,7 @@
"Inserting a line \"SHA512 (package-1.0.txt) "+
"= f65f341b35981fda842b09b2c8af9bcdb7602a4c2e6fa1f7d41f0974d3e3122f"+
"268fc79d5a4af66358f5133885cd1c165c916f80ab25e5d8d95db46f803c782c\" below this line.",
- ">\tRMD160 (package-1.0.txt) = 1a88147a0344137404c63f3b695366eab869a98a",
+ ">\tBLAKE2s (package-1.0.txt) = ee494623e60caeda840ed7de4fb70db4a36bc92b445b09f12b9ed46094e9bd59",
"+\tSHA512 (package-1.0.txt) = f65f341b35981fda842b09b2c8af9bcdb7602a4c2e6fa1f7d41f0974d3e3122f"+
"268fc79d5a4af66358f5133885cd1c165c916f80ab25e5d8d95db46f803c782c")
@@ -476,8 +467,8 @@
t.CheckOutputLines(
"ERROR: ~/category/package/distinfo:3: " +
- "Expected RMD160, SHA512, Size checksums for \"package-1.0.txt\", " +
- "got RMD160, SHA512, Size, CRC32.")
+ "Expected BLAKE2s, SHA512, Size checksums for \"package-1.0.txt\", " +
+ "got BLAKE2s, SHA512, Size, CRC32.")
}
// When some of the hashes for a distfile are missing, pkglint can calculate
@@ -494,7 +485,7 @@
t.CreateFileLines("category/package/distinfo",
CvsID,
"",
- "RMD160 (package-1.0.txt) = 1a88147a0344137404c63f3b695366eab869a98a",
Home |
Main Index |
Thread Index |
Old Index