]> Sergey Matveev's repositories - bass.git/commitdiff
Be less dependent on meta4ra-hash
authorSergey Matveev <stargrave@stargrave.org>
Sat, 14 Mar 2026 14:10:36 +0000 (17:10 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 14 Mar 2026 14:10:36 +0000 (17:10 +0300)
build/bin/cksum
build/distfiles/bin/dl-urls
build/distfiles/bin/hashes-gen
build/distfiles/bin/metadir-from-file
build/distfiles/dl/default.rc
build/lib/mk-pkg
build/lib/pkg-inst
build/pkg/cp-arch
doc/Build/Distfiles/Tutorial
doc/Build/Tutorial
lib/rc

index 7b13b1a1a09633d5239aa816547ca4a9ab22407060694bd9edb4a2050c302ccc..7a8501a922e14a44f548cec7d746be8c1f0a2ed3d610239c776d3fd888c5c6c1 100755 (executable)
@@ -24,6 +24,7 @@ sname="$0" . "$BASS_ROOT"/lib/rc
 tmp=$(mktemp)
 trap "rm -f $tmp" HUP PIPE INT QUIT TERM EXIT
 
+hashers=$(echo "$BASS_HASHERS" | head -1)
 while [ $# -ne 0 ] ; do
     arg="$1"
     shift
@@ -37,8 +38,8 @@ while [ $# -ne 0 ] ; do
     *)
         printf %d:%s, $(printf %s "$arg" | wc -c) "$arg"
     esac
-done | meta4ra-hash -hashers "$META4RA_HASHERS" >$tmp
-read hsh rem <$tmp
+done | "$DISTFILES"/bin/hashes-gen "$hashers" >$tmp
+read _name hsh <$tmp
 [ -n "$hsh" ]
 perl -MMIME::Base64 \
     -e 'print MIME::Base64::encode_base64url(pack "H*", "'$hsh'") . "\n";'
index 7f59f936562cccec7618ed08dad6c0556c7a4dfd65c4b93024b89ad59265f82a..8d21aa3a7f3545573e8a9d7401f56cad78cad48331a21803be35d4015dcecdf9 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh -e
 # List available download URLs for specified meta/target
 
-[ -n "$BASS_ROOT" ] || BASS_ROOT="$(dirname "$(realpath -- "$0")")"/../..
+[ -n "$BASS_ROOT" ] || BASS_ROOT="$(dirname "$(realpath -- "$0")")"/../../..
 sname=$0 . "$BASS_ROOT"/lib/rc
 
 redo-ifchange $1/urls
index 41ced2b1a9c3901c7f6b067f77078a1480d3a7a3be39dc2e0a04bb069bdfebaf..1c991c2a07d45e98d4879e5a3cb9b4b0aaf37912ad58636479f345a0329fce86 100755 (executable)
@@ -3,6 +3,10 @@
 
 hashers="$1"
 [ -n "$hashers" ] || hashers="$(meta4ra-hashers-detect 2>/dev/null)"
+if command -v meta4ra-hash >/dev/null 2>/dev/null ; then
+    meta4ra-hash -all -hashers "$hashers"
+    exit
+fi
 tmp=$(mktemp -d)
 trap "rm -fr $tmp" HUP PIPE INT QUIT TERM EXIT
 cd $tmp
index d93e58bdccdf15ca5732eb8f4cfad2eaa5d599f74efb858410291fd5a4bd3989..9b12d8c8e2b39d61ff2798b23fb3ad24ce52a756790e56c450c7bae799e2659b 100755 (executable)
@@ -1,11 +1,11 @@
 #!/bin/sh -e
 # Generate metadir from specified file
 
-[ -n "$BASS_ROOT" ] || BASS_ROOT="$(dirname "$(realpath -- "$0")")"/../../../..
+[ -n "$BASS_ROOT" ] || BASS_ROOT="$(dirname "$(realpath -- "$0")")"/../../..
 sname=$0 . "$BASS_ROOT"/lib/rc
 
 [ -n "$1" ]
 dst=$(basename $1)
 mkdir -p $dst
 "$BASS_ROOT"/bin/filessize $1 >$dst/size
-meta4ra-hash -all -hashers "$META4RA_HASHERS" <$1 >$dst/hashes
+"$DISTFILES"/bin/hashes-gen "$BASS_HASHERS" <$1 >$dst/hashes
index a1cca62200c87605a0e5500f079bae1c83d81e052025f0eb3909c214b37cb2b7..d0c4d84980f8f1ed84b9aaf13556994b30a1cdc430485510bf268571ca864c99 100644 (file)
@@ -10,7 +10,7 @@ if [ -r cache/$dst ] ; then
     if [ -s "$metadir"/hashes ] ; then
         meta4ra-check \
             -progress \
-            -hashers "$META4RA_HASHERS" \
+            -hashers "$BASS_HASHERS" \
             -plain "$metadir"/hashes \
             <cache/$dst 2>&1 >/dev/null || {
                 echo hash check failed >&2
@@ -58,7 +58,7 @@ meta4ra)
         echo trying ${url}... >&2
         if [ -s "$metadir"/hashes ] ; then
             meta4ra-dl -progress -size $size "$url" |
-            meta4ra-check -plain -hashers "$META4RA_HASHERS" "$metadir"/hashes \
+            meta4ra-check -plain -hashers "$BASS_HASHERS" "$metadir"/hashes \
             >$fn || {
                 echo hash check failed >&2
                 rm $fn
index deee96dcb163622598a016c20e760fc911e47d1541b8bf2bf8b184260f5fcc16..1b6fdac17e4453a04991b66aac1115ddaa36830ca9f116b76420c8e45a938e65 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 |
-    meta4ra-hash -hashers "$META4RA_HASHERS" -all >$tmp/name.hashes
+    "$DISTFILES"/bin/hashes-gen "$BASS_HASHERS" >$tmp/name.hashes
 cat >$tmp/buildinfo <<EOF
 $BASS_REV
 EOF
-meta4ra-hash -hashers "$META4RA_HASHERS" -all <$tmp/buildinfo >$tmp/buildinfo.hashes
+"$DISTFILES"/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 ; } |
-{ meta4ra-hash -hashers "$META4RA_HASHERS" -all || touch $tmp/tar-pipe-failed
+{ "$DISTFILES"/bin/hashes-gen "$BASS_HASHERS" || touch $tmp/tar-pipe-failed
 } >$tmp/$namenhash.hashes
 [ ! -e $tmp/tar-pipe-failed ]
 
index faa2d92f75f20ca507bddd021b6113f5bd8bd447fdc16d231f578d0ad9d9a49e..19db3cf3ebda5a52e8e574cb1cab290fad1f08fec40735b1b8785f874fb9e20e 100755 (executable)
@@ -46,7 +46,7 @@ else
         $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 "$META4RA_HASHERS" $opts $NAMENHASH ||
+            meta4ra-check -hashers "$BASS_HASHERS" $opts $NAMENHASH ||
             touch untar-failed
         } | $TAR xf - || touch untar-failed
     else
index 79ddb07bd7672eadce9dd5663caf00b2779ae359b01e0c10b811791edb71d1a5..d786f094cba6a5ec919ab5f6a5b46fb33c707708a29366d051f27dbabae7a9b4 100755 (executable)
@@ -11,6 +11,7 @@ dst="$(realpath -- "$1")"
 [ -d "$dst" ]
 arch="$(basename -- "$2")"
 [ -n "$arch" ] || arch=$ARCH
+hashers=$(echo "$BASS_HASHERS" | head -1)
 
 tmp=$(mktemp -d ${TMPDIR:-/tmp}/cp-arch.XXXXXX)
 trap "rm -fr $tmp" HUP PIPE INT QUIT TERM EXIT
@@ -23,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
-            meta4ra-hash -hashers "$META4RA_HASHERS" <$pkg >$tmp/hshour &
-            meta4ra-hash -hashers "$META4RA_HASHERS" <"$dst"/$arch/$base >$tmp/hshtheir &
+            "$DISTFILES"/bin/hashes-gen "$hashers" <$pkg >$tmp/hshour &
+            "$DISTFILES"/bin/hashes-gen "$hashers" <"$dst"/$arch/$base >$tmp/hshtheir &
             wait
             read hshour <$tmp/hshour
             read hshtheir <$tmp/hshtheir
index 9dfab2e58f6fe2fca63055efd912bbc2ccc6c6896685f81bcb4440171b7180ef..166a0768558d211847c600c10e14100323f925e2e17eac0b921afa465650deab 100644 (file)
@@ -32,7 +32,7 @@ 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:
 
-    $ meta4ra-hash -all <$tarball >$DISTFILES/meta/$tarball/hashes
+    $ $DISTFILES/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:
index 43e4876067d012e12ed3f40cb555867059b1b39d740d368919749855c822ee93..bd5c698522af39554b18d46263462798cc75151ba59a04e0167fb4820f2c3aeb 100644 (file)
@@ -151,11 +151,11 @@ Let's describe what is happening in the skel:
       Current BASS'es source code revision.
 
       A [Index/Variables] SETLOCK\r
-      A [Index/Variables] META4RA_HASHERS\r
+      A [Index/Variables] BASS_HASHERS\r
       A [Index/Variables] FSYNC\r
       A [Index/Variables] TAR\r
       A [Index/Variables] TMPDIR\r
-    * $SETLOCK, $META4RA_HASHERS, $FSYNC, $TAR, $TMPDIR
+    * $SETLOCK, $BASS_HASHERS, $FSYNC, $TAR, $TMPDIR
 
     And of course they could be overridden in most cases with your $BASS_RC.
 
diff --git a/lib/rc b/lib/rc
index 4bd89a984c9cc2af6c75600b244dd785be418b8b97bb5dfd49b84f533dcb5ba0..e475307667c4d4d8a95e418b711b7515647c2638dff1a4c1b51ac9e0cbb21bad 100644 (file)
--- a/lib/rc
+++ b/lib/rc
@@ -25,7 +25,7 @@ if [ -z "$SETLOCK" ] ; then
     }
 fi
 
-export META4RA_HASHERS="${META4RA_HASHERS:-$(meta4ra-hashers-detect 2>/dev/null)}"
+export BASS_HASHERS="${BASS_HASHERS:-$(meta4ra-hashers-detect 2>/dev/null)}"
 
 export FSYNC=${FSYNC:-$(command -v fsync 2>/dev/null || command -v sync)}
 export TAR=${TAR:-bsdtar}