]> Cypherpunks.ru repositories - prepro.git/commitdiff
mk-mods
authorSergey Matveev <stargrave@stargrave.org>
Mon, 14 Aug 2023 17:24:30 +0000 (20:24 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 14 Aug 2023 17:33:54 +0000 (20:33 +0300)
USAGE
mk-mods [new file with mode: 0755]

diff --git a/USAGE b/USAGE
index ea0d790df5faff22cea4eca81f1782b4e08a6868fc810bd2854bf43f80fd5095..cf2408d210be523ebd1f7f42cf8d27bb53a19ad9440761f2cf18987f6072002c 100644 (file)
--- a/USAGE
+++ b/USAGE
@@ -1,19 +1,21 @@
 mk-mod utility creates GOPROXY-compatible version of the module in the
 current directory:
-    mk-mod VCS-URL VCS-PATH MODULE-NAME VERSION.
+    mk-mod VCS-URL VCS-PATH MODULE-NAME VERSION
 Only Git VCS is supported. Git tag's name must be equal to VERSION.
+mk-mods iterates through all tags:
+    mk-mods VCS-URL VCS-PATH MODULE-BASE-NAME
 
 mk-list utility collects all known versions in current GOPROXY directory
 and creates corresponding "list" files.
 
 mk-goget creates go-import-compatible static files:
-    mk-goget VCS-WEB-URL MODULE-NAME.
+    mk-goget VCS-WEB-URL MODULE-NAME
 
 For example:
     mkdir proxy
     cd proxy
-    mk-mod https://git.cypherpunks.ru/balloon.git ~w/balloon go.cypherpunks.ru/balloon v1.1.1
-    mk-mod https://git.cypherpunks.ru/balloon.git ~w/balloon go.cypherpunks.ru/balloon/v2 v2.0.0
+    mk-mods https://git.cypherpunks.ru/balloon.git ~w/balloon go.cypherpunks.ru/balloon
+    mk-mods https://git.cypherpunks.ru/gotai64n.git ~w/gotai64n go.cypherpunks.ru/balloon/tai64n
     mk-list
     cd ..
 
diff --git a/mk-mods b/mk-mods
new file mode 100755 (executable)
index 0000000..ccee342
--- /dev/null
+++ b/mk-mods
@@ -0,0 +1,18 @@
+#!/usr/bin/env zsh
+
+set -e
+
+mkmod=$0:h:a/mk-mod
+
+vcsurl=$1
+vcspath=$2
+modbase=$3
+
+( cd $vcspath ; git tag ) | while read version ; do
+    [[ $version =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]] || continue
+    cols=(${(s:.:)version})
+    v=${cols[1]}
+    modname=$modbase
+    [[ $v == v0 || $v == v1 ]] || modname=${modname}/$v
+    $mkmod $vcsurl $vcspath $modname $version
+done