]> Sergey Matveev's repositories - bass.git/commitdiff
Be less dependent on meta4ra-check
authorSergey Matveev <stargrave@stargrave.org>
Sat, 14 Mar 2026 15:34:05 +0000 (18:34 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 14 Mar 2026 15:34:05 +0000 (18:34 +0300)
13 files changed:
build/bin/cksum
build/bin/hashes-check [new file with mode: 0755]
build/bin/hashes-gen [moved from build/distfiles/bin/hashes-gen with 100% similarity]
build/distfiles/bin/metadir-from-file
build/distfiles/dl/default.rc
build/distfiles/dl/gcc-4-compile-with-gcc-5.patch.do
build/distfiles/dl/gcc-4-compile-with-gcc-5.patch.hashes [new file with mode: 0644]
build/distfiles/dl/gcc-4-compile-with-gcc-5.patch.meta4 [deleted file]
build/lib/mk-pkg
build/lib/pkg-inst
build/pkg/cp-arch
doc/Build/Distfiles/Tutorial
lib/rc

index 7a8501a922e14a44f548cec7d746be8c1f0a2ed3d610239c776d3fd888c5c6c1..55bcbd96d13e6a6dbf7f5e0f4e60e42c13178a5c0681b3b492fb062dd5fcf28c 100755 (executable)
@@ -38,7 +38,7 @@ while [ $# -ne 0 ] ; do
     *)
         printf %d:%s, $(printf %s "$arg" | wc -c) "$arg"
     esac
-done | "$DISTFILES"/bin/hashes-gen "$hashers" >$tmp
+done | "$BASS_ROOT"/build/bin/hashes-gen "$hashers" >$tmp
 read _name hsh <$tmp
 [ -n "$hsh" ]
 perl -MMIME::Base64 \
diff --git a/build/bin/hashes-check b/build/bin/hashes-check
new file mode 100755 (executable)
index 0000000..66d00d4
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh -e
+# Check data against provided hashes
+
+hashes="$1"
+[ -s "$hashes" ]
+hashers="$2"
+[ -n "$hashers" ] || hashers="$(meta4ra-hashers-detect 2>/dev/null)"
+tmp=$(mktemp -d)
+trap "rm -fr $tmp" HUP PIPE INT QUIT TERM EXIT
+while read name cmd ; do
+    sed -n "s/^$name \(.*\)$/\1/p" <$hashes >$tmp/their
+    if [ -s $tmp/their ] ; then
+        cat >$tmp/hasher <<EOF
+#!/bin/sh -e
+$cmd
+EOF
+        chmod +x $tmp/hasher
+        break
+    fi
+done <<EOF
+$hashers
+EOF
+[ -s $tmp/hasher ] || {
+    echo no common hashes found >&2
+    exit 1
+}
+mkfifo $tmp/pipe
+$tmp/hasher <$tmp/pipe >$tmp/our &
+tee $tmp/pipe
+wait
+read our rem <$tmp/our
+read their <$tmp/their
+[ "$our" = "$their" ] || {
+    echo "hash mismatch: $our != $their" >&2
+    exit 1
+}
index 9b12d8c8e2b39d61ff2798b23fb3ad24ce52a756790e56c450c7bae799e2659b..f1909725777e8f3d3fae0afa65c2f67fdf492f0bab3be596ea4c9caed83a5249 100755 (executable)
@@ -8,4 +8,4 @@ sname=$0 . "$BASS_ROOT"/lib/rc
 dst=$(basename $1)
 mkdir -p $dst
 "$BASS_ROOT"/bin/filessize $1 >$dst/size
-"$DISTFILES"/bin/hashes-gen "$BASS_HASHERS" <$1 >$dst/hashes
+"$BASS_ROOT"/build/bin/hashes-gen "$BASS_HASHERS" <$1 >$dst/hashes
index d0c4d84980f8f1ed84b9aaf13556994b30a1cdc430485510bf268571ca864c99..38e9e2c83954efecb3f0cccbc8d8094b69f5981b1d576839d56666b0cd9feca0 100644 (file)
@@ -8,14 +8,12 @@ dst=$1
 if [ -r cache/$dst ] ; then
     echo using cache/$dst... >&2
     if [ -s "$metadir"/hashes ] ; then
-        meta4ra-check \
-            -progress \
-            -hashers "$BASS_HASHERS" \
-            -plain "$metadir"/hashes \
-            <cache/$dst 2>&1 >/dev/null || {
+        $PV cache/$dst |
+        "$BASS_ROOT"/build/bin/hashes-check "$metadir"/hashes "$BASS_HASHERS" \
+            2>&1 >/dev/null || {
                 echo hash check failed >&2
                 exit 1
-            }
+        }
     else
         echo warning: no $metadir/hashes >&2
         if [ -s "$metadir"/size ] ; then
@@ -58,7 +56,7 @@ meta4ra)
         echo trying ${url}... >&2
         if [ -s "$metadir"/hashes ] ; then
             meta4ra-dl -progress -size $size "$url" |
-            meta4ra-check -plain -hashers "$BASS_HASHERS" "$metadir"/hashes \
+            "$BASS_ROOT"/build/bin/hashes-check "$metadir"/hashes "$BASS_HASHERS" \
             >$fn || {
                 echo hash check failed >&2
                 rm $fn
index a0d6711df038b49541214bd4427b431fb4bc726415b2c7be1c1f550b3eea780a..f41f5a80cdca0a59ab75429b03cfba440b0e9b30c35bcd972686dddc7b3f57bf 100644 (file)
@@ -4,4 +4,4 @@
     v1.5.0 >/dev/null
 p=gnu/packages/patches/gcc-4-compile-with-gcc-5.patch
 ( cd ../repo/guix.git ; git archive @ $p | tar xfO - $p ) >$3
-meta4ra-check -pipe $1.meta4 $1 <$3 >/dev/null
+../../bin/hashes-check $1.hashes "$BASS_HASHERS" <$3 >/dev/null
diff --git a/build/distfiles/dl/gcc-4-compile-with-gcc-5.patch.hashes b/build/distfiles/dl/gcc-4-compile-with-gcc-5.patch.hashes
new file mode 100644 (file)
index 0000000..b384712
--- /dev/null
@@ -0,0 +1,11 @@
+blake3-256 0cba0a01e2201c78ff5f803a3a4d64ff3ec19c35f49f1ea8556e050a453ac770
+blake2b-512 aeb809e7801aa2625bfd814c950a0a302cfb1ee9147d9b32e5d858e7ba34d9b193becd00472a148e3be5fe4c388370de9ac0d4022d38ac42537ce42dda50ebe3
+blake2b-256 2bf78b04c60c32a4e4263074ddb5511d530648ce88f5e27ca5f7493d512c3da0
+skein-512 3b3715c9579625272d3b505fde2655a9307473ef3785415c9c0866baad924aa2407e31f53979b0d8d7fa2a17d0fb81f016fe8cdb6b0f7d54b0a98b654aad521a
+shake128 31c9e64268463d4ddd73a5e743493a2b0dcfda87728b20f68eedcb98512786a3
+shake256 fffa62fc68476dcae4dc1b3c9065c7ad970c01756485da216aa61951a65cdaa62a6bdec4ef37b9d349657e504d5d19112a18d84cf6eced36dbc3c195a768317c
+sha-512 04c38b68ccce8642259011bb8dc73d51f980e2b60c80941e5125bd5d5e68f1693f7d599c10abb5106d789c66130e314115963474465e451be3a20d618016e661
+sha-256 5b084cfc9741d960bd57d799758a98a5f1f436e38308aac2299b439de0a90103
+streebog-512 615fb79a7a3082e4192d9d319c3fd038ed281f3aedd9abec4848f1b35e6de56d8c5c022ed0b24209460dc4538aa6aeeb2001d290be0b4689114151bef3e1bbac
+streebog-256 f7b6b9ce119c2b0c793731051c9d015393981568d6a724567bc4d596c14464d0
+xxh3-128 57b1e630fdfc601b9b146d3bbf7f130a
diff --git a/build/distfiles/dl/gcc-4-compile-with-gcc-5.patch.meta4 b/build/distfiles/dl/gcc-4-compile-with-gcc-5.patch.meta4
deleted file mode 100644 (file)
index 605b6d6..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<metalink xmlns="urn:ietf:params:xml:ns:metalink">
-  <file name="gcc-4-compile-with-gcc-5.patch">
-    <hash type="blake3-256">0cba0a01e2201c78ff5f803a3a4d64ff3ec19c35f49f1ea8556e050a453ac770</hash>
-    <hash type="blake2b-512">aeb809e7801aa2625bfd814c950a0a302cfb1ee9147d9b32e5d858e7ba34d9b193becd00472a148e3be5fe4c388370de9ac0d4022d38ac42537ce42dda50ebe3</hash>
-    <hash type="blake2b-256">2bf78b04c60c32a4e4263074ddb5511d530648ce88f5e27ca5f7493d512c3da0</hash>
-    <hash type="skein-512">3b3715c9579625272d3b505fde2655a9307473ef3785415c9c0866baad924aa2407e31f53979b0d8d7fa2a17d0fb81f016fe8cdb6b0f7d54b0a98b654aad521a</hash>
-    <hash type="shake128">31c9e64268463d4ddd73a5e743493a2b0dcfda87728b20f68eedcb98512786a3</hash>
-    <hash type="shake256">fffa62fc68476dcae4dc1b3c9065c7ad970c01756485da216aa61951a65cdaa62a6bdec4ef37b9d349657e504d5d19112a18d84cf6eced36dbc3c195a768317c</hash>
-    <hash type="sha-512">04c38b68ccce8642259011bb8dc73d51f980e2b60c80941e5125bd5d5e68f1693f7d599c10abb5106d789c66130e314115963474465e451be3a20d618016e661</hash>
-    <hash type="sha-256">5b084cfc9741d960bd57d799758a98a5f1f436e38308aac2299b439de0a90103</hash>
-    <hash type="streebog-512">615fb79a7a3082e4192d9d319c3fd038ed281f3aedd9abec4848f1b35e6de56d8c5c022ed0b24209460dc4538aa6aeeb2001d290be0b4689114151bef3e1bbac</hash>
-    <hash type="streebog-256">f7b6b9ce119c2b0c793731051c9d015393981568d6a724567bc4d596c14464d0</hash>
-    <hash type="xxh3-128">57b1e630fdfc601b9b146d3bbf7f130a</hash>
-    <size>2264</size>
-  </file>
-</metalink>
index 1b6fdac17e4453a04991b66aac1115ddaa36830ca9f116b76420c8e45a938e65..83156fd75501b7a79db49062fc896d5788bf67d5704f15b6ca3e5833a081d2f9 100755 (executable)
@@ -38,11 +38,11 @@ tmp=$(mktemp -d $TMPDIR/$namenhash-mk-pkg.XXXXXX)
 trap "rm -fr $tmp" HUP PIPE INT QUIT TERM EXIT
 
 echo $namenhash | tee $tmp/name |
-    "$DISTFILES"/bin/hashes-gen "$BASS_HASHERS" >$tmp/name.hashes
+    "$BASS_ROOT"/build/bin/hashes-gen "$BASS_HASHERS" >$tmp/name.hashes
 cat >$tmp/buildinfo <<EOF
 $BASS_REV
 EOF
-"$DISTFILES"/bin/hashes-gen "$BASS_HASHERS" <$tmp/buildinfo >$tmp/buildinfo.hashes
+"$BASS_ROOT"/build/bin/hashes-gen "$BASS_HASHERS" <$tmp/buildinfo >$tmp/buildinfo.hashes
 
 chmod -R a-w $namenhash
 {
@@ -51,7 +51,7 @@ chmod -R a-w $namenhash
 } |
 { $COMPRESSOR || touch $tmp/tar-pipe-failed ; } |
 { tee $tmp/$namenhash || touch $tmp/tar-pipe-failed ; } |
-{ "$DISTFILES"/bin/hashes-gen "$BASS_HASHERS" || touch $tmp/tar-pipe-failed
+{ "$BASS_ROOT"/build/bin/hashes-gen "$BASS_HASHERS" || touch $tmp/tar-pipe-failed
 } >$tmp/$namenhash.hashes
 [ ! -e $tmp/tar-pipe-failed ]
 
index 19db3cf3ebda5a52e8e574cb1cab290fad1f08fec40735b1b8785f874fb9e20e..285580978169c079ee136c8ee0e6efdc65a6a203644271f6a1faa4e7f7640c60 100755 (executable)
@@ -42,19 +42,13 @@ else
     tmp=$(mktemp -d "$SKELBINS"/$ARCH/tmp/$NAMENHASH.XXXXXX)
     trap "$BASS_ROOT/bin/rm-r $tmp" HUP PIPE INT QUIT TERM EXIT
     cd $tmp
-    if command -v meta4ra-check >/dev/null ; then
-        $TAR xf $skelpkg bin.hashes || $TAR xf $skelpkg bin.meta4
-        [ -s bin.hashes ] && opts="-plain bin.hashes" || opts="-pipe bin.meta4"
-        $TAR xfO $skelpkg bin | {
-            meta4ra-check -hashers "$BASS_HASHERS" $opts $NAMENHASH ||
-            touch untar-failed
-        } | $TAR xf - || touch untar-failed
-    else
-        echo warning: skipping checksum verification >&2
-        $TAR xfO $skelpkg bin | $TAR xf - || touch untar-failed
-    fi
+    $TAR xf $skelpkg bin.hashes
+    $TAR xfO $skelpkg bin | {
+        "$BASS_ROOT"/build/bin/hashes-check bin.hashes "$BASS_HASHERS" ||
+        touch untar-failed
+    } | $TAR xf - || touch untar-failed
     [ ! -e untar-failed ]
-    rm -f $fn.meta4
+    rm -f $fn.hashes
     find $tmp/$namenhash -type f -or -type d -exec $FSYNC {} +
     chmod +w $tmp/$NAMENHASH
     mv $tmp/$NAMENHASH "$SKELBINS"/$ARCH/$NAMENHASH ||
index d786f094cba6a5ec919ab5f6a5b46fb33c707708a29366d051f27dbabae7a9b4..c4bf7c7f22c106580e1337d1c41680b7f3650cbb358f1d7147c05ee2992657bc 100755 (executable)
@@ -24,8 +24,8 @@ find . -type f -and -not -name "*.do" -and -not -path "*/.redo/*" | while read p
         oursize=$("$BASS_ROOT"/bin/filessize $pkg)
         theirsize=$("$BASS_ROOT"/bin/filessize "$dst"/$arch/$base)
         if [ "$oursize" -eq "$theirsize" ] ; then
-            "$DISTFILES"/bin/hashes-gen "$hashers" <$pkg >$tmp/hshour &
-            "$DISTFILES"/bin/hashes-gen "$hashers" <"$dst"/$arch/$base >$tmp/hshtheir &
+            "$BASS_ROOT"/build/bin/hashes-gen "$hashers" <$pkg >$tmp/hshour &
+            "$BASS_ROOT"/build/bin/hashes-gen "$hashers" <"$dst"/$arch/$base >$tmp/hshtheir &
             wait
             read hshour <$tmp/hshour
             read hshtheir <$tmp/hshtheir
index 166a0768558d211847c600c10e14100323f925e2e17eac0b921afa465650deab..163f41d56d08f08dd2642b996fd54029843eb577ae31e5600c1e89a700388b47 100644 (file)
@@ -24,15 +24,14 @@ Store tarball's size in it:
     $ stat -f %z $tarball >$DISTFILES/meta/$tarball/size
     $ stat -f %z $tarball.sig >$DISTFILES/meta/$tarball.sig/size
 
-A [Index/Programs] meta4ra-create\r
 Compute its checksum. There is no preferred algorithm. One could be
 satisfied with non-cryptographic, but very fast XXH3. Somebody want
 to use fast cryptographic BLAKE3 or BLAKE2. Somebody likes Skein.
 Somebody requires GOST Streebog ones. Maybe there are people preferring
 slow SHA2 family of algorithms. Let's precompute a bunch of them. We
-will use meta4ra-hash utility:
+will use hashes-gen script:
 
-    $ $DISTFILES/bin/hashes-gen <$tarball >$DISTFILES/meta/$tarball/hashes
+    $ $BASS_ROOT/build/bin/hashes-gen <$tarball >$DISTFILES/meta/$tarball/hashes
 
 Then we must store a list of URLs where it can be fetched. That may be
 just trivial:
diff --git a/lib/rc b/lib/rc
index e475307667c4d4d8a95e418b711b7515647c2638dff1a4c1b51ac9e0cbb21bad..20c114d9e99f901c249145507ccc5c9b3e35edf4eaba91daeb7f4097ecdeeee0 100644 (file)
--- a/lib/rc
+++ b/lib/rc
@@ -44,6 +44,8 @@ export SKELBINS=${SKELBINS:-/tmp/skelbins}
 [ -d $SKELBINS/$ARCH ] || mkdir -p $SKELBINS/$ARCH
 export SKELPKGS=${SKELPKGS:-"$BASS_ROOT"/build/pkg}
 
+[ -n "$PV" ] || command -v pv >/dev/null 2>/dev/null && PV=pv || PV=cat
+
 # Program to use for downloading distfiles: "meta4ra", "wget", "aria2c".
 export DISTFILE_FETCHER="${DISTFILE_FETCHER:-meta4ra}"
 if ! type FETCHER_URLS_SORT 2>/dev/null >/dev/null ; then