]> Sergey Matveev's repositories - meta4ra.git/commitdiff
Prepare for release v0.7.0
authorSergey Matveev <stargrave@stargrave.org>
Fri, 8 Mar 2024 16:58:49 +0000 (19:58 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 8 Mar 2024 19:29:11 +0000 (22:29 +0300)
PUBKEY-SSH.pub [new file with mode: 0644]
PUBKEY-SSH.pub.asc [new file with mode: 0644]
README
bin/meta4ra-hashes-detect
build
cmd/meta4ra/check.go
cmd/meta4ra/create.go
cmd/meta4ra/hash.go
cmd/meta4ra/main.go
internal/common.go
makedist [new file with mode: 0755]

diff --git a/PUBKEY-SSH.pub b/PUBKEY-SSH.pub
new file mode 100644 (file)
index 0000000..49f6072
--- /dev/null
@@ -0,0 +1 @@
+meta4ra@stargrave.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIUMcjpT5uw4pSYTic9SqFBrVWxwVl/50Yls0Hpm8Ql1
diff --git a/PUBKEY-SSH.pub.asc b/PUBKEY-SSH.pub.asc
new file mode 100644 (file)
index 0000000..fab5f07
--- /dev/null
@@ -0,0 +1,7 @@
+-----BEGIN PGP SIGNATURE-----
+
+iHUEABYKAB0WIQTbL/jtRAp+lJhvt3bSI36ECQhstwUCZetm/gAKCRDSI36ECQhs
+t31FAQD6t1/WffR40dHXm3hvb4UFAoZthv+lswJJOQdGgJ6ZfwD/Q5lXenxcEkHB
+E1/NtXT0tRuwi4b7MC0mDA9/TkCeRA0=
+=8ZfQ
+-----END PGP SIGNATURE-----
diff --git a/README b/README
index 15bc1a458c7aeac6cb449408802352c3c4a334a8..8f711941566c64516967734958774c0d4067464e 100644 (file)
--- a/README
+++ b/README
@@ -13,3 +13,6 @@ algorithm on current system, whatever it is.
 
 meta4ra is copylefted free software: see the file COPYING for copying
 conditions. It should work on all POSIX-compatible systems.
+
+You can select desired fields by ordinary XML-related utulities:
+    xml sel -t -m "/_:metalink/_:file/_:url" -v . -nl data.meta4
index 20d48150f13f840e8085f3c1b1c0535d88766f93..1218ed63770dbfaab35f1b562bc20e43766076f6 100755 (executable)
@@ -1,4 +1,6 @@
 #!/bin/sh -e
+# Autodetect possible commandlines for various hashes. Example usage:
+# meta4ra-{create,check} -hashes "$(meta4ra-hashes-detect)" ...
 
 hw="hello world"
 hashes=""
diff --git a/build b/build
index 32381dd94849c6b97d7250c050981d9d8e681931..9e81b1cad50ddf46649bfa2909363973cc786bb8 100755 (executable)
--- a/build
+++ b/build
@@ -1,3 +1,4 @@
 #!/bin/sh -e
 
-exec go build -C cmd/meta4ra -ldflags=-s $@ -o ../../bin/meta4ra
+[ -d vendor ] && mod_vendor="-mod=vendor"
+exec go build -C cmd/meta4ra -ldflags=-s $mod_vendor $@ -o ../../bin/meta4ra
index c030f8b8417ec376d2008ab8aed377efa43ac15e..c53ccb9f0e7c7768ada5c1ff2d8f92eeb49a39da 100644 (file)
@@ -50,6 +50,15 @@ and -extract-sig, then you can just specify an empty ("") FILE.
        }
        flag.Parse()
 
+       if *showVersion {
+               fmt.Println(meta4ra.Version())
+               return
+       }
+       if *showWarranty {
+               fmt.Println(meta4ra.Warranty)
+               return
+       }
+
        data, err := os.ReadFile(*metaPath)
        if err != nil {
                log.Fatalln(err)
@@ -216,8 +225,10 @@ and -extract-sig, then you can just specify an empty ("") FILE.
                }
        }
        if len(toCheck) != 0 {
-               fmt.Println("not all FILEs met")
-               bad = true
+               if _, ok := toCheck["."]; !(len(toCheck) == 1 && ok) {
+                       fmt.Println("not all FILEs met")
+                       bad = true
+               }
        }
        if bad {
                os.Exit(1)
index cfa7f4ef1e5c187b990ab2a226b2e1f4d494c8ac..f7d17b0854a9c68ffecf0bae97811126df0a5821 100644 (file)
@@ -46,11 +46,20 @@ func runCreate() {
        torrent := flag.String("torrent", "", "Torrent URL")
        flag.Usage = func() {
                fmt.Fprintf(flag.CommandLine.Output(),
-                       "Usage: %s [options] [URL ...] < DATA > XXX.meta4\n", os.Args[0])
+                       "Usage: %s [options] [URL ...] < data > data.meta4\n", os.Args[0])
                flag.PrintDefaults()
        }
        flag.Parse()
 
+       if *showVersion {
+               fmt.Println(meta4ra.Version())
+               return
+       }
+       if *showWarranty {
+               fmt.Println(meta4ra.Warranty)
+               return
+       }
+
        if *fn == "" {
                log.Fatalln("empty -fn")
        }
index 266aa61a59724db4797673acb45dc311b5069ef3..3fb98f462b253b4d6d149700f77842c47989552c 100644 (file)
@@ -40,6 +40,15 @@ Only the first hash from -hashes will be used.
        }
        flag.Parse()
 
+       if *showVersion {
+               fmt.Println(meta4ra.Version())
+               return
+       }
+       if *showWarranty {
+               fmt.Println(meta4ra.Warranty)
+               return
+       }
+
        hsh := *hashes
        if i := strings.Index(hsh, ","); i != -1 {
                hsh = hsh[:i]
index 334ddc89f3b560a74131368a0405c122276afeab..b0a5958d92930a5fdca21b3c96853a7b406979d3 100644 (file)
@@ -1,11 +1,17 @@
 package main
 
 import (
+       "flag"
        "log"
        "os"
        "path"
 )
 
+var (
+       showVersion  = flag.Bool("version", false, "print version")
+       showWarranty = flag.Bool("warranty", false, "print warranty information")
+)
+
 func main() {
        log.SetFlags(log.Lshortfile)
        switch path.Base(os.Args[0]) {
index 04185743810b35eba4cd49ba850e318aada61232..fc016d665a17ba9a032db9a3ed4fecd0892f6170 100644 (file)
 // Metalink 4.0 utilities
 package internal
 
+import (
+       "runtime"
+)
+
 const (
        Generator       = "meta4ra/0.7.0"
        SigMediaTypePGP = "application/pgp-signature"
        SigMediaTypeSSH = "application/ssh-signature"
        BufLen          = 1 << 20
+
+       Warranty = `Copyright (C) 2021-2024 Sergey Matveev
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 3 of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.`
 )
+
+func Version() string {
+       return Generator + " built with " + runtime.Version()
+}
diff --git a/makedist b/makedist
new file mode 100755 (executable)
index 0000000..a4fc796
--- /dev/null
+++ b/makedist
@@ -0,0 +1,32 @@
+#!/bin/sh -ex
+
+cur=$(pwd)
+tmp=$(mktemp -d)
+release=$1
+[ -n "$release" ]
+
+git clone . $tmp/meta4ra-$release
+cd $tmp/meta4ra-$release
+git checkout v$release
+
+echo v$release > VERSION
+
+go mod vendor
+find . -name .gitignore -delete
+
+rm -rf .git makedist
+find . -type d -exec chmod 755 {} +
+find . -type f -exec chmod 644 {} +
+chmod +x bin/meta4ra-hashes-detect contrib/mk-meta4 build build-with-thirdparty
+
+cd ..
+tar cvf meta4ra-"$release".tar --uid=0 --gid=0 --numeric-owner meta4ra-"$release"
+zstd -19 -v meta4ra-"$release".tar
+tarball=meta4ra-"$release".tar.zst
+ssh-keygen -Y sign -f ~/.ssh/sign/meta4ra@stargrave.org -n file $tarball
+meta4ra-create -fn "$tarball" -mtime "$tarball" \
+    -sig-ssh "$tarball".sig \
+    http://www.meta4ra.stargrave.org/download/"$tarball" \
+    http://y.www.meta4ra.stargrave.org/download/"$tarball" < "$tarball" > "$tarball".meta4
+
+mv $tmp/$tarball $tarball.meta4 $cur/www/download