From bbf3a665eace9a901d6e4d48e85b9c6921e26bbf Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Fri, 24 Jul 2020 12:44:48 +0300 Subject: [PATCH] Less hardcoded module name --- .gitignore | 1 + gocheese.do | 4 ++-- makedist.sh | 12 ++++++++---- module-name.do | 2 ++ test.do | 3 ++- 5 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 module-name.do diff --git a/.gitignore b/.gitignore index 87d55b6..10f838d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ gocheese gocheese.info gocheese.html +module-name diff --git a/gocheese.do b/gocheese.do index f7937fd..3a7df90 100644 --- a/gocheese.do +++ b/gocheese.do @@ -1,2 +1,2 @@ -redo-ifchange *.go -${GO:=go} build -o $3 -ldflags "-X main.Version=`cat VERSION`" go.cypherpunks.ru/gocheese/v2 +redo-ifchange *.go module-name +${GO:=go} build -o $3 -ldflags "-X main.Version=`cat VERSION`" `cat module-name` diff --git a/makedist.sh b/makedist.sh index 8693220..b9e3d27 100755 --- a/makedist.sh +++ b/makedist.sh @@ -4,12 +4,14 @@ 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 -mod_name=$(sed -n 's/^module //p' go.mod) +redo-ifchange module-name +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 mv *.go go.mod go.sum src/$mod_name @@ -68,7 +70,7 @@ cat > download.texi < $texi < $texi < gocheese.do +echo 'GOPATH=`pwd` ${GO:=go} test `cat module-name`/... >&2' > test.do find . -type d -exec chmod 755 {} \; find . -type f -exec chmod 644 {} \; diff --git a/module-name.do b/module-name.do new file mode 100644 index 0000000..8284690 --- /dev/null +++ b/module-name.do @@ -0,0 +1,2 @@ +redo-ifchange go.mod +sed -n 's/^module //p' < go.mod diff --git a/test.do b/test.do index 88272c2..1575791 100644 --- a/test.do +++ b/test.do @@ -1 +1,2 @@ -${GO:=go} test go.cypherpunks.ru/gocheese/v2/... >&2 +redo-ifchange module-name +${GO:=go} test `cat module-name`/... >&2 -- 2.44.0