]> Sergey Matveev's repositories - bass.git/commitdiff
Be less dependent on meta4ra-dl
authorSergey Matveev <stargrave@stargrave.org>
Sat, 14 Mar 2026 16:54:19 +0000 (19:54 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 14 Mar 2026 16:54:19 +0000 (19:54 +0300)
build/distfiles/dl/default.rc
build/distfiles/dl/gogost-v6.1.0-modcache.do
build/distfiles/dl/gosha3-v1.1.0-modcache.do
doc/Build/Distfiles/Fetchers
doc/Build/Distfiles/Mirrors
doc/Build/Distfiles/Tutorial
doc/Build/Requirements
lib/rc

index 38e9e2c83954efecb3f0cccbc8d8094b69f5981b1d576839d56666b0cd9feca0..4b4b5517a527b8d02a0655983481e2bf2fc5a0df559d17f59927d83c7220c489 100644 (file)
@@ -32,6 +32,7 @@ if [ -r cache/$dst ] ; then
 fi
 
 (
+    # do not depend on generated URLs
     for v in $(env | sed "s/=.*$//" | grep "^REDO") ; do unset $v ; done
     redo-ifchange "$metadir"/urls
 )
@@ -49,13 +50,13 @@ tmp=$(mktemp -d ${TMPDIR:-/tmp}/$fn.XXXXXX)
 trap "rm -fr $tmp" HUP PIPE INT QUIT TERM EXIT
 cd $tmp
 case "$DISTFILE_FETCHER" in
-meta4ra)
-    [ -s "$metadir"/size ] && read size <"$metadir"/size || size=0
+justdl)
     FETCHER_URLS_SORT <"$metadir"/urls |
     while read url ; do
         echo trying ${url}... >&2
+        url="${url##*|}"
         if [ -s "$metadir"/hashes ] ; then
-            meta4ra-dl -progress -size $size "$url" |
+            $JUSTDL "$url" |
             "$BASS_ROOT"/build/bin/hashes-check "$metadir"/hashes "$BASS_HASHERS" \
             >$fn || {
                 echo hash check failed >&2
@@ -64,10 +65,9 @@ meta4ra)
             }
         else
             echo warning: no $metadir/hashes >&2
-            if [ "$size" -eq 0 ] ; then
-                meta4ra-dl -progress "$url" >$fn || continue
-            else
-                meta4ra-dl -progress -size $size "$url" >$fn || continue
+            $JUSTDL "$url" >$fn || continue
+            if [ -s "$metadir"/size ] ; then
+                read size <"$metadir"/size
                 sizeGot=$("$BASS_ROOT"/bin/filessize $fn)
                 [ "$sizeGot" -eq "$size" ] || {
                     echo size differs: $sizeGot '!=' $size >&2
@@ -80,7 +80,7 @@ meta4ra)
     [ -s $fn ]
     cat $fn
     ;;
-wget)
+wget-meta4)
     get-meta4 >meta4
     wget --input-metalink=meta4 >&2
     cat "$fn.meta4.#1"
index c208ae1b755451664a735b705a98f9cb0adafa397b672c95478f0935f5b02259..0b412d7968b0d66a0e8e1174aab010624abef64fda89d5eefd3cdc3c45ec6cf5 100644 (file)
@@ -6,7 +6,7 @@ cd cache/download/go.cypherpunks.su/gogost/v6/@v
 for ext in info mod zip ziphash ziphash.sig ; do
     fn=v6.1.0.$ext
     [ ! -s $fn ] || continue
-    $JUSTDL tmp http://proxy.go.cypherpunks.su/go.cypherpunks.su/gogost/v6/@v/$fn
+    $JUSTDL http://proxy.go.cypherpunks.su/go.cypherpunks.su/gogost/v6/@v/$fn >tmp
     $FSYNC tmp
     mv tmp $fn
 done
index 7fa1b570e1e668a8db6f3ecac44d6dfcca3762f70275c6aee3c15c0f53f9bcc9..81c977f61e78ad511a74da2a926c0862e29b47bdb1aaa0124b193f6195aa00cd 100644 (file)
@@ -6,13 +6,13 @@ vdir="$GOMODCACHE"/cache/download/go.stargrave.org/gosha3/@v
 mkdir -p $vdir
 cd $vdir
 url=http://proxy.go.stargrave.org/go.stargrave.org/gosha3/@v
-$JUSTDL tmp $url/v1.1.0.zip
+$JUSTDL $url/v1.1.0.zip >tmp
 $FSYNC tmp
 [ "$("$BASS_ROOT"/build/lib/zip-hash/zip-hash tmp)" = "h1:9FDmAEU07dVhWV5GYoaetbspzU5u+2amPXClwvHVZ6Q=" ]
 mv tmp v1.1.0.zip
 for ext in info mod ziphash ; do
     fn=v1.1.0.$ext
-    $JUSTDL tmp $url/$fn
+    $JUSTDL $url/$fn >tmp
     $FSYNC tmp
     mv tmp $fn
 done
index 12f8acc14941028bd5b3fa662a0d5288a201b357b15d2ecfe26fc2e4bf573ef0..0af3421c35196f74fd96521fad025788c8608cd91038778df6516e5db53a7a57 100644 (file)
@@ -11,20 +11,22 @@ $DISTFILES/bin/meta4-to-metadir uses meta4ra utilities
 to convert .meta4 file to "metadir".
 $DISTFILES/bin/metadir-to-meta4 generates .meta4 back.
 
-* $DISTFILE_FETCHER=meta4ra
-  => http://www.meta4ra.stargrave.org/\r
-  Use meta4ra-dl for downloading. URLs are sorted with FETCHER_URLS_SORT
-  function, which is by default:
+A [Index/Variables] JUSTDL
+* $DISTFILE_FETCHER=justdl
+  * Get list or possible download URLs. It is sorted with
+    FETCHER_URLS_SORT function, which is by default:
       FETCHER_URLS_SORT() {
           $DISTFILES/lib/urls-sort "" rand
       }
-  This is by default, because meta4ra utilities are installed by default.
-
-* $DISTFILE_FETCHER=wget
+  * For each URL, until we succeed, run $JUSTDL program to fetch it.
+    If JUSTDL is not set, then BASS will check for following programs
+    existence: fetch, wget, curl, meta4ra-dl.
+  * Check downloaded result with $BASS_ROOT/build/bin/hashes-check
+    utility against $metadir/hashes, if it exists. Otherwise check
+    only the size.
+* $DISTFILE_FETCHER=wget-meta4
   => https://www.gnu.org/software/wget/ GNU Wget\r
-  Use wget compiled with --with-metalink option. The only drawback is
-  that most OS distributions contain Wget without that (--input-metalink)
-  option.
+  Use wget compiled with --with-metalink option.
 
 * $DISTFILE_FETCHER=aria2c
   => http://aria2.github.io/ Aria2\r
index ed502353f1fa129d82cc410a60472dcfd3ff8c880a45003e3d40ebd25d96865a..0993684616111ae5c8bd37ebb9cd9e00816af93876ea8617dc217485f98ffad9 100644 (file)
@@ -9,6 +9,8 @@ Here we use the following precedence preference:
 * all links should use HTTP as higher priority than HTTPS
 * distcache.FreeBSD.org and cdn.NetBSD.org/pub/pkgsrc/distfiles
   are used as least priority fallback
+* be aware that codeload.github.com downloads have no guarantees
+  of format/compression stability (their hashes may change)
 
 There are special country codes for identifying and specifying CDNs:
     xa -> Akamai
index 163f41d56d08f08dd2642b996fd54029843eb577ae31e5600c1e89a700388b47..b65dad8b9c2592ac16b64222a7dea7098f2feb99654b1f46b4fc14b160fa1402 100644 (file)
@@ -33,6 +33,12 @@ will use hashes-gen script:
 
     $ $BASS_ROOT/build/bin/hashes-gen <$tarball >$DISTFILES/meta/$tarball/hashes
 
+Or we can use helper script doing completely the same:
+
+    $ cd $DISTFILES/meta
+    $ ../bin/metadir-from-file /path/to/$tarball
+    $ ../bin/metadir-from-file /path/to/$tarball.sig
+
 Then we must store a list of URLs where it can be fetched. That may be
 just trivial:
 
@@ -48,9 +54,10 @@ Fortunately there is one for GNU ecosystem. You should automatically
 generate your urls file instead then.
 
     $ cat >$DISTFILES/meta/$tarball/urls.do <<EOF
-    redo-ifchange ../../utils/urls-for-gnu
-    ../../utils/urls-for-gnu parallel/$(basename $(pwd))
+    redo-ifchange ../../lib/urls-for-gnu
+    ../../lib/urls-for-gnu parallel/$(basename $(pwd))
     EOF
+    $ git add $DISTFILES/meta/$tarball*
 
 That is all! You may "redo $DISTFILES/meta/$tarball.meta4" to get the
 generated Metalink4 file based on metainformation you supplied.
index 4bd28c51d3e687b23f87cdf0e8c4790158e30bc38dd561701ba311e0e4835e4c..88adcbf6213d466c276acf0cec3072aca283eb92f63c13c0ec21313ebbb00cf2 100644 (file)
@@ -10,12 +10,6 @@ at least:
   package, containing libarchive-based bsdtar utility, that perfectly
   deals with any compressed archive transparently.
 
-  A [Index/Programs] meta4ra\r
-=> http://www.meta4ra.stargrave.org/ meta4ra\r
-  Utilities for making and checking .meta4 files. They are just a
-  wrapper over XML and external hasher commands interoperation. They
-  also can be used for downloading.
-
   A [Index/Programs] Perl\r
 => https://www.perl.org/ Perl\r
   Shell scripts are hard to write in a portable way. For example there
@@ -57,10 +51,17 @@ at least:
   build Go-related software. Actually Go-written utilities can be
   replaced and no Go dependency will be required at all.
 
+  A [Index/Programs] meta4ra\r
+=> http://www.meta4ra.stargrave.org/ meta4ra\r
+  Optional utilities for making and checking .meta4 files.
+  They are just a wrapper over XML and external hasher
+  commands interoperation. They also can be used for downloading.
+
   A [Index/Programs] fetch\r
   A [Index/Programs] Wget\r
   A [Index/Programs] cURL\r
 * FreeBSD's fetch, or
   => https://www.gnu.org/software/wget/ GNU Wget\r
   => https://curl.se/ cURL\r
-  Although meta4ra can be used instead all of them.
+  => http://www.meta4ra.stargrave.org/ meta4ra-dl\r
+  To fetch distfiles.
diff --git a/lib/rc b/lib/rc
index 20c114d9e99f901c249145507ccc5c9b3e35edf4eaba91daeb7f4097ecdeeee0..b95a7ed4c9c8a353187987a0b87ebb299c6d8ffa573c734fe3295b0e9554964c 100644 (file)
--- a/lib/rc
+++ b/lib/rc
@@ -33,11 +33,22 @@ COMPRESSOR=${COMPRESSOR:-zstdmt}
 export TMPDIR=${TMPDIR:-/tmp}
 MAKE_JOBS=${MAKE_JOBS:-$(nproc)}
 
-if command -v fetch >/dev/null 2>/dev/null ; then
-    JUSTDL="fetch -o"
-else
-    command -v wget >/dev/null 2>/dev/null && JUSTDL="wget -O" || JUSTDL="curl -o"
-fi
+[ -n "$JUSTDL" ] || {
+    command -v fetch >/dev/null 2>/dev/null && JUSTDL="fetch -v -o -"
+}
+[ -n "$JUSTDL" ] || {
+    command -v wget >/dev/null 2>/dev/null && JUSTDL="wget -O -"
+}
+[ -n "$JUSTDL" ] || {
+    command -v curl >/dev/null 2>/dev/null && JUSTDL="curl -f -v"
+}
+[ -n "$JUSTDL" ] || {
+    command -v meta4ra-dl >/dev/null 2>/dev/null && JUSTDL="meta4ra-dl"
+}
+[ -n "$JUSTDL" ] || {
+    echo unable to find suitable \$JUSTDL utility >&2
+    exit 1
+}
 
 export DISTFILES=${DISTFILES:-"$BASS_ROOT"/build/distfiles}
 export SKELBINS=${SKELBINS:-/tmp/skelbins}
@@ -46,8 +57,8 @@ 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}"
+# Program to use for downloading distfiles: "justdl", "wget-meta4", "aria2c".
+export DISTFILE_FETCHER="${DISTFILE_FETCHER:-justdl}"
 if ! type FETCHER_URLS_SORT 2>/dev/null >/dev/null ; then
     FETCHER_URLS_SORT() {
         $DISTFILES/lib/urls-sort "" rand