[pacman-dev] WIP: makepkg: add BLAKE3 (b3sums) support

Message ID d1efbd51-be53-58ce-f6b0-563a240fb878@kge.pw
State Deferred, archived
Headers show
Series [pacman-dev] WIP: makepkg: add BLAKE3 (b3sums) support | expand

Commit Message

Konstantin Gizdov Aug. 30, 2021, 2:10 p.m. UTC
Hi all,

This is work in progress, but I did some basic tests and seems to work.
Since we have b2sums support in makepkg, I was wondering if we could
also add b3sums (https://github.com/BLAKE3-team/BLAKE3). It's been
finalised recently and has a working package in [community] repo. It's
not in coreutils and probably can't easily handle dependencies for
pacman at the moment but the b3sums algo is solid and maybe worth adding
if people want to use it in the future.

Comments

Allan McRae Sept. 3, 2021, 1:52 a.m. UTC | #1
On 31/8/21 12:10 am, Konstantin Gizdov via pacman-dev wrote:
> Hi all,
> 
> This is work in progress, but I did some basic tests and seems to work.
> Since we have b2sums support in makepkg, I was wondering if we could
> also add b3sums (https://github.com/BLAKE3-team/BLAKE3). It's been
> finalised recently and has a working package in [community] repo. It's
> not in coreutils and probably can't easily handle dependencies for
> pacman at the moment but the b3sums algo is solid and maybe worth adding
> if people want to use it in the future.
> 

Thanks - I'd prefer this to wait until b3sum is added to coreutils.  At
this stage BLAKE3 usage is basically non-existent in terms of being
provided as a software checksum, and I do not want to add a further
dependency to makepkg.

Allan

Patch

diff --git a/doc/PKGBUILD.5.asciidoc b/doc/PKGBUILD.5.asciidoc
index dee15f5e..1c72f419 100644
--- a/doc/PKGBUILD.5.asciidoc
+++ b/doc/PKGBUILD.5.asciidoc
@@ -156,7 +156,7 @@  contain whitespace characters.
 	checksums generated by "makepkg -g" should be verified using checksum
 	values provided by the software developer.
 
-*md5sums, sha1sums, sha224sums, sha256sums, sha384sums, sha512sums, b2sums (arrays)*::
+*md5sums, sha1sums, sha224sums, sha256sums, sha384sums, sha512sums, b2sums, b3sums (arrays)*::
 	Alternative integrity checks that makepkg supports; these all behave
 	similar to the cksums option described above. To enable use and generation
 	of these checksums, be sure to set up the `INTEGRITY_CHECK` option in
diff --git a/doc/makepkg.conf.5.asciidoc b/doc/makepkg.conf.5.asciidoc
index 76c27f6a..d9c4ed87 100644
--- a/doc/makepkg.conf.5.asciidoc
+++ b/doc/makepkg.conf.5.asciidoc
@@ -196,7 +196,7 @@  Options
 **INTEGRITY_CHECK=(**check1 ...**)**::
 	File integrity checks to use. Multiple checks may be specified; this
 	affects both generation and checking. The current valid options are:
-	`ck`, `md5`, `sha1`, `sha224`, `sha256`, `sha384`, `sha512`, and `b2`.
+	`ck`, `md5`, `sha1`, `sha224`, `sha256`, `sha384`, `sha512`, `b2`, and `b3`.
 
 **STRIP_BINARIES=**"--strip-all"::
 	Options to be used when stripping binaries. See linkman:strip[1]
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
index fff5b8eb..3c6af39b 100644
--- a/etc/makepkg.conf.in
+++ b/etc/makepkg.conf.in
@@ -91,7 +91,7 @@  BUILDENV=(!distcc color !ccache check !sign)
 #
 OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !debug !lto)
 
-#-- File integrity checks to use. Valid: ck, md5, sha1, sha224, sha256, sha384, sha512, b2
+#-- File integrity checks to use. Valid: ck, md5, sha1, sha224, sha256, sha384, sha512, b2, b3
 INTEGRITY_CHECK=(ck)
 #-- Options to be used when stripping binaries. See `man strip' for details.
 STRIP_BINARIES="@STRIP_BINARIES@"
diff --git a/scripts/libmakepkg/util/schema.sh.in b/scripts/libmakepkg/util/schema.sh.in
index 55e68bab..30667e45 100644
--- a/scripts/libmakepkg/util/schema.sh.in
+++ b/scripts/libmakepkg/util/schema.sh.in
@@ -26,7 +26,7 @@  LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
 source "$LIBRARY/util/util.sh"
 
 
-known_hash_algos=({ck,md5,sha{1,224,256,384,512},b2})
+known_hash_algos=({ck,md5,sha{1,224,256,384,512},b{2,3}})
 
 pkgbuild_schema_arrays=(arch backup checkdepends conflicts depends groups
                         license makedepends noextract optdepends options
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index e58edfa1..bdd96278 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1205,7 +1205,7 @@  unset -f pkgver prepare build check package "${!package_@}"
 unset "${!makedepends_@}" "${!depends_@}" "${!source_@}" "${!checkdepends_@}"
 unset "${!optdepends_@}" "${!conflicts_@}" "${!provides_@}" "${!replaces_@}"
 unset "${!cksums_@}" "${!md5sums_@}" "${!sha1sums_@}" "${!sha224sums_@}"
-unset "${!sha256sums_@}" "${!sha384sums_@}" "${!sha512sums_@}" "${!b2sums_@}"
+unset "${!sha256sums_@}" "${!sha384sums_@}" "${!sha512sums_@}" "${!b2sums_@}" "${!b3sums_@}"
 
 BUILDFILE=${BUILDFILE:-$BUILDSCRIPT}
 if [[ ! -f $BUILDFILE ]]; then