From 4889e529cd1bbbf8a02a1d7062f2b954438ffe36 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sat, 5 Sep 2020 10:32:33 +0300 Subject: [PATCH] Take version from source code directly --- .gitignore | 1 + VERSION | 1 - VERSION.do | 2 ++ clean.do | 2 +- default.do | 3 +-- gogost.go | 4 +--- install.texi | 2 -- makedist.sh | 35 ++++++++++++++++++++++++++--------- www.do | 3 ++- 9 files changed, 34 insertions(+), 19 deletions(-) delete mode 100644 VERSION create mode 100644 VERSION.do diff --git a/.gitignore b/.gitignore index 7418c4c..10d32f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ module-name +VERSION diff --git a/VERSION b/VERSION deleted file mode 100644 index 0062ac9..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -5.0.0 diff --git a/VERSION.do b/VERSION.do new file mode 100644 index 0000000..4868bed --- /dev/null +++ b/VERSION.do @@ -0,0 +1,2 @@ +redo-ifchange gogost.go +perl -ne 'print $1 if /Version.*"(.*)"$/' < gogost.go diff --git a/clean.do b/clean.do index 615710c..8cd8ae5 100644 --- a/clean.do +++ b/clean.do @@ -1 +1 @@ -rm -f module-name streebog256 streebog512 +rm -f module-name streebog256 streebog512 VERSION diff --git a/default.do b/default.do index 85bd5f1..db7986d 100644 --- a/default.do +++ b/default.do @@ -1,3 +1,2 @@ redo-ifchange module-name -MOD=`cat module-name` -go build -o $3 -ldflags "-X ${MOD}.Version=`cat VERSION`" ${MOD}/cmd/$1 +go build -o $3 `cat module-name`/cmd/$1 diff --git a/gogost.go b/gogost.go index de5246b..8fd2fc7 100644 --- a/gogost.go +++ b/gogost.go @@ -1,6 +1,4 @@ // Pure Go GOST cryptographic functions library. package gogost -var ( - Version string = "UNKNOWN" -) +const Version = "v5.0.1" diff --git a/install.texi b/install.texi index e756897..dcb8b25 100644 --- a/install.texi +++ b/install.texi @@ -1,8 +1,6 @@ @node Download @unnumbered Download -@set VERSION 5.0.0 - Preferable way is to download tarball with the signature from website and, for example, run tests with benchmarks: diff --git a/makedist.sh b/makedist.sh index 8480121..c8f0d76 100755 --- a/makedist.sh +++ b/makedist.sh @@ -5,11 +5,12 @@ tmp=$(mktemp -d) release=$1 [ -n "$release" ] -redo-ifchange module-name streebog256 -mod_name=`cat module-name` +redo-ifchange streebog256 git clone . $tmp/gogost-$release cd $tmp/gogost-$release git checkout v$release +redo module-name VERSION +mod_name=`cat module-name` crypto_mod_path=$(sed -n 's#^require \(golang.org/x/crypto\) \(.*\)$#\1@\2#p' go.mod) mkdir -p src/$mod_name @@ -26,10 +27,8 @@ mv \ prfplus \ cmd internal gogost.go go.mod go.sum src/$mod_name -rm module-name.do clean.do echo $mod_name > module-name find . -name "*.do" -exec perl -i -npe "s/^go/GOPATH=\`pwd\` go/" {} \; -perl -i -npe "s/UNKNOWN/v$release/" src/$mod_name/gogost.go mkdir contrib cp ~/work/redo/minimal/do contrib/do @@ -43,6 +42,13 @@ You can obtain releases source code prepared tarballs on @url{http://www.gogost.cypherpunks.ru/}. EOF +mkinfo() { + ${MAKEINFO:-makeinfo} --plaintext \ + --set-customization-variable CLOSE_QUOTE_SYMBOL=\" \ + --set-customization-variable OPEN_QUOTE_SYMBOL=\" \ + -D "VERSION `cat VERSION`" $@ +} + texi=$(mktemp) cat > $texi < $texi < $texi < $texi < $texi < $texi <