From: Sergey Matveev Date: Mon, 14 Aug 2023 17:24:30 +0000 (+0300) Subject: mk-mods X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b77937a5ced08ce5e9bd93d8438e9c4a36b1fb6dcf03799cac297d6919fd36fd;p=prepro.git mk-mods --- diff --git a/USAGE b/USAGE index ea0d790..cf2408d 100644 --- 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 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