From 232408af2996be5a87350e81c151508ca55cd171 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sat, 5 Sep 2020 11:42:03 +0300 Subject: [PATCH] Version refactoring --- .gitignore | 1 + VERSION | 1 - VERSION.do | 2 ++ clean.do | 1 + .../pyshop2packages.sh | 0 gocheese.do | 2 +- gocheese.go | 2 +- gocheese.info.do | 8 +++-- install.texi | 13 +++----- makedist.sh | 30 ++++++++++++------- www.do | 12 ++++---- 11 files changed, 42 insertions(+), 30 deletions(-) delete mode 100644 VERSION create mode 100644 VERSION.do create mode 100644 clean.do rename pyshop2packages.sh => contrib/pyshop2packages.sh (100%) diff --git a/.gitignore b/.gitignore index 10f838d..fa62ba1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ gocheese gocheese.info gocheese.html module-name +VERSION diff --git a/VERSION b/VERSION deleted file mode 100644 index 197c4d5..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -2.4.0 diff --git a/VERSION.do b/VERSION.do new file mode 100644 index 0000000..afefe20 --- /dev/null +++ b/VERSION.do @@ -0,0 +1,2 @@ +redo-ifchange gocheese.go +perl -ne 'print "$1\n" if /Version.*"(.*)"$/' < gocheese.go diff --git a/clean.do b/clean.do new file mode 100644 index 0000000..4201b5f --- /dev/null +++ b/clean.do @@ -0,0 +1 @@ +rm -f gocheese module-name VERSION diff --git a/pyshop2packages.sh b/contrib/pyshop2packages.sh similarity index 100% rename from pyshop2packages.sh rename to contrib/pyshop2packages.sh diff --git a/gocheese.do b/gocheese.do index 3a7df90..a5f7cc5 100644 --- a/gocheese.do +++ b/gocheese.do @@ -1,2 +1,2 @@ redo-ifchange *.go module-name -${GO:=go} build -o $3 -ldflags "-X main.Version=`cat VERSION`" `cat module-name` +${GO:=go} build -o $3 `cat module-name` diff --git a/gocheese.go b/gocheese.go index 70573b8..fa12d18 100644 --- a/gocheese.go +++ b/gocheese.go @@ -43,6 +43,7 @@ import ( ) const ( + Version = "2.4.1" HTMLBegin = ` @@ -98,7 +99,6 @@ var ( version = flag.Bool("version", false, "Print version information") warranty = flag.Bool("warranty", false, "Print warranty information") - Version string = "UNKNOWN" killed bool pypiURLParsed *url.URL ) diff --git a/gocheese.info.do b/gocheese.info.do index f9fef35..7cbe4ca 100644 --- a/gocheese.info.do +++ b/gocheese.info.do @@ -1,2 +1,6 @@ -redo-ifchange *.texi -${MAKEINFO:=makeinfo} -o $3 gocheese.texi +redo-ifchange *.texi VERSION +${MAKEINFO:-makeinfo} \ + -D "VERSION `cat VERSION`" \ + --set-customization-variable CLOSE_QUOTE_SYMBOL=\" \ + --set-customization-variable OPEN_QUOTE_SYMBOL=\" \ + --output $3 gocheese.texi diff --git a/install.texi b/install.texi index 3c46c5a..2b605ee 100644 --- a/install.texi +++ b/install.texi @@ -1,8 +1,6 @@ @node Install @unnumbered Install -@set VERSION 2.4.0 - Preferable way is to download tarball with the signature from website and, for example, run tests with benchmarks: @@ -12,17 +10,14 @@ $ [fetch|wget] http://www.gocheese.cypherpunks.ru/gocheese-@value{VERSION}.tar.x $ gpg --verify gocheese-@value{VERSION}.tar.xz.sig gocheese-@value{VERSION}.tar.xz $ xz -d < gocheese-@value{VERSION}.tar.xz | tar xf - $ cd gocheese-@value{VERSION} -$ redo all test +$ redo test all @end example It uses @url{http://cr.yp.to/redo.html, redo} build system for that examples. You can use either dozen of various implementations, or at -least minimalistic POSIX shell @code{apenwarr/do}: - -@example -$ [fetch|wget] https://github.com/apenwarr/redo/raw/master/minimal/do -$ mv do redo ; chmod +x redo -@end example +least minimalistic POSIX shell @command{contrib/do} (just replace +@command{redo} with @command{contrib/do} in the example above) included +in tarball. @include download.texi diff --git a/makedist.sh b/makedist.sh index b9e3d27..87e7b6f 100755 --- a/makedist.sh +++ b/makedist.sh @@ -4,14 +4,20 @@ cur=$(pwd) tmp=$(mktemp -d) release=$1 [ -n "$release" ] -MAKEINFO=${MAKEINFO:=makeinfo} git clone . $tmp/gocheese-$release cd $tmp/gocheese-$release git checkout v$release -redo-ifchange module-name +redo-ifchange module-name VERSION mod_name=`cat module-name` + +cat > download.texi < download.texi < $texi < $texi < gocheese.do +rm -rf .redo .git .gitignore style.css makedist.sh www.do module-name.do VERSION.do +echo 'GOPATH=`pwd` ${GO:=go} build -o $3 `cat module-name`' > gocheese.do echo 'GOPATH=`pwd` ${GO:=go} test `cat module-name`/... >&2' > test.do +cp ~/work/redo/minimal/do contrib/do find . -type d -exec chmod 755 {} \; find . -type f -exec chmod 644 {} \; -chmod +x pyshop2packages.sh +chmod 755 contrib/pyshop2packages.sh contrib/do cd .. tar cvf gocheese-"$release".tar --uid=0 --gid=0 --numeric-owner gocheese-"$release" diff --git a/www.do b/www.do index 61a9a96..778c3d4 100644 --- a/www.do +++ b/www.do @@ -1,12 +1,14 @@ -rm -f gocheese.html/*.html +redo-ifchange *.texi VERSION +html=gocheese.html +rm -f $html/*.html ${MAKEINFO:=makeinfo} --html \ + -D "VERSION `cat VERSION`" \ --set-customization-variable CSS_LINES="`cat style.css`" \ --set-customization-variable SHOW_TITLE=0 \ - --set-customization-variable USE_ACCESSKEY=0 \ --set-customization-variable DATE_IN_HEADER=1 \ --set-customization-variable TOP_NODE_UP_URL=index.html \ --set-customization-variable CLOSE_QUOTE_SYMBOL=\" \ --set-customization-variable OPEN_QUOTE_SYMBOL=\" \ - -o gocheese.html gocheese.texi -find gocheese.html -type d -exec chmod 755 {} \; -find gocheese.html -type f -exec chmod 644 {} \; + -o $html gocheese.texi +find $html -type d -exec chmod 755 {} \; +find $html -type f -exec chmod 644 {} \; -- 2.44.0