]> Cypherpunks.ru repositories - prepro.git/blobdiff - mk-mod
Separate .zip and .ziphash.sig steps for assurrance
[prepro.git] / mk-mod
diff --git a/mk-mod b/mk-mod
index 1d9332ab197aeecf24e3a1829ef7daa0f8ed5929988da00d4a5a2c0d26fe4290..dda8450773a2dc47c1f98fc77496ab862ef99ca70e3547fe4b38113476097d34 100755 (executable)
--- a/mk-mod
+++ b/mk-mod
@@ -1,25 +1,24 @@
 #!/usr/bin/env zsh
 
-set -e
+setopt ERR_EXIT
 
 vcsurl=$1
 vcspath=$2
 modname=$3
 version=$4
-signkey=$5
 
 dst=$modname/@v
 mkdir -p $dst
 cd $dst
-[[ -s $version.zip ]] && exit
+[[ ! -s $version.zip ]] || exit 0
 
 root=$0:h:a
 zipcreate=$root/zip-create
 ziphash=$root/zip-hash
 zmodload -F zsh/datetime b:strftime
 git -C $vcspath cat-file -p $version | while read line ; do
-    [[ $line =~ ^object ]] && hsh=${${=line}[-1]}
-    [[ $line =~ ^tagger ]] && {
+    [[ ! $line =~ ^object ]] || hsh=${${=line}[-1]}
+    [[ ! $line =~ ^tagger ]] || {
         strftime -s sec -r "%s %z" "${${=line}[-2,-1]}"
         break
     }
@@ -33,9 +32,4 @@ $ziphash $version.zip > $version.ziphash
 unzip -p $version.zip ${modname}@${version}/go.mod > $version.mod
 printf '{"Version":"%s","Time":"%s","Origin":{"VCS":"git","URL":"%s","Ref":"refs/tags/%s","Hash":"%s"}}' \
     $version $when $vcsurl $version $hsh > $version.info
-totouch=($version.info $version.mod $version.zip $version.ziphash)
-[[ -z $signkey ]] || {
-    ssh-keygen -Y sign -f $signkey -n file $version.ziphash
-    totouch=($totouch $version.ziphash.sig)
-}
-touch -d $when $totouch
+touch -d $when $version.info $version.mod $version.zip $version.ziphash