From d182e82482b61ac3b0e9e0005ca7a018acf899f1 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sun, 17 Jan 2021 20:12:49 +0300 Subject: [PATCH] Vendorizing --- .gitignore | 2 - bin/default.do | 14 +++--- clean.do | 2 +- doc/cmds.texi | 2 +- doc/news.ru.texi | 5 ++ doc/news.texi | 5 ++ gopath.do | 1 - makedist.sh | 128 +++++++++-------------------------------------- module-name.do | 2 - test.do | 7 ++- 10 files changed, 46 insertions(+), 122 deletions(-) delete mode 100644 gopath.do delete mode 100644 module-name.do diff --git a/.gitignore b/.gitignore index b7ee15f..fd85e30 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -gopath -module-name VERSION diff --git a/bin/default.do b/bin/default.do index bda5482..352b014 100644 --- a/bin/default.do +++ b/bin/default.do @@ -1,12 +1,10 @@ -cd .. -redo-ifchange config gopath module-name -. ./config -. ./gopath -mod=`cat module-name` -redo-ifchange src/*.go src/cmd/$1/*.go +cd ../src +redo-ifchange ../config *.go cmd/$1/*.go +. ../config +GO=${GO:-go} +mod=`$GO list -m` GO_LDFLAGS="$GO_LDFLAGS -X $mod.DefaultCfgPath=$CFGPATH" GO_LDFLAGS="$GO_LDFLAGS -X $mod.DefaultSendmailPath=$SENDMAIL" GO_LDFLAGS="$GO_LDFLAGS -X $mod.DefaultSpoolPath=$SPOOLPATH" GO_LDFLAGS="$GO_LDFLAGS -X $mod.DefaultLogPath=$LOGPATH" -cd src -GOPATH=$GOPATH ${GO:-go} build -o ../bin/$3 -ldflags "$GO_LDFLAGS" $mod/cmd/$1 +$GO build -o ../bin/$3 -ldflags "$GO_LDFLAGS" ./cmd/$1 diff --git a/clean.do b/clean.do index 8ccd8cf..ebefc3e 100644 --- a/clean.do +++ b/clean.do @@ -1,2 +1,2 @@ redo bin/clean -rm -f gopath module-name VERSION +rm -f VERSION diff --git a/doc/cmds.texi b/doc/cmds.texi index 05ffe54..ae7bd52 100644 --- a/doc/cmds.texi +++ b/doc/cmds.texi @@ -284,7 +284,7 @@ appended and decompressed body fed to command's @code{stdin}. If @option{-use-tmp} option is specified, then @code{stdin} data is read into temporary file first, requiring twice more disk space, but no memory requirements. @ref{StdinTmpFile, Same temporary file} rules -applies as with @ref{nncp-file -} command. +applies as with @ref{nncp-file, nncp-file -} command. For example, if remote side has following configuration file for your node: diff --git a/doc/news.ru.texi b/doc/news.ru.texi index d2c0479..97c108c 100644 --- a/doc/news.ru.texi +++ b/doc/news.ru.texi @@ -16,6 +16,11 @@ @option{autotoss-noexec}, @option{autotoss-notrns}. Вы можете настраивать опции автоматического tosser для каждого вызова. +@item +Использовать vendoring вместо переопределения @env{GOPATH} во время +установки tarball, так как текущая минимальная версия Go это 1.12, +поддерживающая модули. + @end itemize @node Релиз 5.5.1 diff --git a/doc/news.texi b/doc/news.texi index 1b701a9..83b6f96 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -18,6 +18,11 @@ second while it is active. @option{calls} configuration section. You can configure per-call automatic tosser options. +@item +Use vendoring, instead of @env{GOPATH} overriding during tarball +installation, because current minimal Go's version is 1.12 and it +supports modules. + @end itemize @node Release 5.5.1 diff --git a/gopath.do b/gopath.do deleted file mode 100644 index 141e16d..0000000 --- a/gopath.do +++ /dev/null @@ -1 +0,0 @@ -echo GOPATH=${GOPATH:-`pwd`} diff --git a/makedist.sh b/makedist.sh index e62491f..8537c9e 100755 --- a/makedist.sh +++ b/makedist.sh @@ -8,109 +8,26 @@ release=$1 git clone . $tmp/nncp-$release cd $tmp/nncp-$release git checkout v$release -redo module-name VERSION -rm -r .redo -mod_name=`cat module-name` -rm -fr .git - -mv src src.orig -mkdir -p src/$mod_name -mv src.orig/* src/$mod_name -rmdir src.orig - -mods=" -github.com/davecgh/go-xdr -github.com/dustin/go-humanize -github.com/flynn/noise -github.com/gorhill/cronexpr -github.com/hjson/hjson-go -github.com/klauspost/compress -go.cypherpunks.ru/balloon -golang.org/x/crypto -golang.org/x/net -golang.org/x/sys -golang.org/x/term -" -for mod in $mods; do - mod_path=$(sed -n "s# // indirect## ; s#^ \($mod\) \(.*\)\$#\1@\2#p" src/$mod_name/go.mod) - [ -n "$mod_path" ] - mkdir -p src/$mod - ( cd $GOPATH/pkg/mod/$mod_path ; tar cf - --exclude ".git*" * ) | tar xfC - src/$mod - chmod -R +w src/$mod -done - -cat > $tmp/includes < $tmp/includes < $tmp/excludes < gopath.do - -perl -p -i -e "s#src/#src/$mod_name/#g" bin/default.do cat > doc/download.texi <&2 . ./config -. ./gopath -mod=`cat module-name` cd src -GOPATH=$GOPATH ${GO:-go} test -failfast $mod/... +GO=${GO:-go} +$GO test -failfast ./... -- 2.44.0