]> Cypherpunks.ru repositories - nncp.git/commitdiff
Vendorizing
authorSergey Matveev <stargrave@stargrave.org>
Sun, 17 Jan 2021 17:12:49 +0000 (20:12 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 17 Jan 2021 17:59:30 +0000 (20:59 +0300)
.gitignore
bin/default.do
clean.do
doc/cmds.texi
doc/news.ru.texi
doc/news.texi
gopath.do [deleted file]
makedist.sh
module-name.do [deleted file]
test.do

index b7ee15f622947caa97a0128dc3439d819ad1fa5e..fd85e304082171b555e68c4a0ff99cf1004d9e2b 100644 (file)
@@ -1,3 +1 @@
-gopath
-module-name
 VERSION
index bda5482d13c257e5af603ebd17e3d37652d12d9b..352b014bd5aed5b9eca8d6e6f7bb315639ef43d5 100644 (file)
@@ -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
index 8ccd8cfe6d88bf82a22a4ebbfa1e04ec3a4e455b..ebefc3e5a33fc23bde517ee8b5a74c8fc7b50559 100644 (file)
--- a/clean.do
+++ b/clean.do
@@ -1,2 +1,2 @@
 redo bin/clean
-rm -f gopath module-name VERSION
+rm -f VERSION
index 05ffe54c479c3b0e41924731c5e0d54745a48444..ae7bd52824db6b5346220341612a1bfa223719ee 100644 (file)
@@ -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:
index d2c04797646818c73359f5c2e7ad042619aa44d7..97c108c2a2d05d78f47ffe616000feaa926cc26d 100644 (file)
 @option{autotoss-noexec}, @option{autotoss-notrns}.
 Вы можете настраивать опции автоматического tosser для каждого вызова.
 
+@item
+Использовать vendoring вместо переопределения @env{GOPATH} во время
+установки tarball, так как текущая минимальная версия Go это 1.12,
+поддерживающая модули.
+
 @end itemize
 
 @node Релиз 5.5.1
index 1b701a96b02f42bea37a4b2b5bdc88ff63fa0907..83b6f960419631b56e5ab2977ce1f3816819317f 100644 (file)
@@ -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 (file)
index 141e16d..0000000
--- a/gopath.do
+++ /dev/null
@@ -1 +0,0 @@
-echo GOPATH=${GOPATH:-`pwd`}
index e62491ff0df2426f7037e2a3c0b9dc4fed832375..8537c9e24bceab1ccd61e900d9e79d2393f9e0fa 100755 (executable)
@@ -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 <<EOF
-golang.org/x/crypto/AUTHORS
-golang.org/x/crypto/blake2b
-golang.org/x/crypto/blake2s
-golang.org/x/crypto/chacha20
-golang.org/x/crypto/chacha20poly1305
-golang.org/x/crypto/CONTRIBUTORS
-golang.org/x/crypto/curve25519
-golang.org/x/crypto/ed25519
-golang.org/x/crypto/go.mod
-golang.org/x/crypto/go.sum
-golang.org/x/crypto/internal/subtle
-golang.org/x/crypto/LICENSE
-golang.org/x/crypto/nacl
-golang.org/x/crypto/PATENTS
-golang.org/x/crypto/poly1305
-golang.org/x/crypto/README.md
-golang.org/x/crypto/salsa20
-golang.org/x/net/AUTHORS
-golang.org/x/net/CONTRIBUTORS
-golang.org/x/net/go.mod
-golang.org/x/net/go.sum
-golang.org/x/net/LICENSE
-golang.org/x/net/netutil
-golang.org/x/net/PATENTS
-golang.org/x/net/README.md
-golang.org/x/sys/AUTHORS
-golang.org/x/sys/CONTRIBUTORS
-golang.org/x/sys/cpu
-golang.org/x/sys/go.mod
-golang.org/x/sys/internal/unsafeheader
-golang.org/x/sys/LICENSE
-golang.org/x/sys/PATENTS
-golang.org/x/sys/README.md
-golang.org/x/sys/unix
-golang.org/x/term
-EOF
-tar cfCI - src $tmp/includes | tar xfC - $tmp
-rm -fr src/golang.org $tmp/includes
-mv $tmp/golang.org src
-
-cat > $tmp/includes <<EOF
-compress/compressible.go
-compress/fse
-compress/huff0
-compress/LICENSE
-compress/README.md
-compress/zstd
-EOF
-cat > $tmp/excludes <<EOF
-*testdata*
-*_test.go
-snappy.go
-EOF
-tar cfCIX - src/github.com/klauspost $tmp/includes $tmp/excludes | tar xfC - $tmp
-rm -fr src/github.com/klauspost/compress $tmp/includes $tmp/excludes
-mv $tmp/compress src/github.com/klauspost
-
-find src -name .travis.yml -delete
-rm -fr src/github.com/davecgh/go-xdr/xdr
-rm -r src/github.com/flynn/noise/vector*
-rm src/github.com/hjson/hjson-go/build_release.sh
-rm src/github.com/gorhill/cronexpr/APLv2
-rm -fr ports
-find . -name .gitignore -delete
-rm makedist.sh module-name.do VERSION.do
+redo VERSION
+cd src
+go mod vendor
+modvendor -v -copy="**/*_test.go **/words.go **/README.md **/main.go"
+cd vendor
+rm -r \
+    github.com/flynn/noise/vector* \
+    github.com/gorhill/cronexpr/APLv2 \
+    github.com/hjson/hjson-go/build_release.sh \
+    github.com/klauspost/compress/snappy \
+    github.com/klauspost/compress/zstd/snappy.go \
+    golang.org/x/sys/plan9 \
+    golang.org/x/sys/windows
+find github.com/klauspost/compress golang.org/x/sys -name "*_test.go" -delete
+cd ../..
+rm -r ports
+find . \( -name .gitignore -o -name .travis.yml \) -delete
 
 mkdir contrib
 cp ~/work/redo/minimal/do contrib/do
-echo echo GOPATH=\`pwd\` > gopath.do
-
-perl -p -i -e "s#src/#src/$mod_name/#g" bin/default.do
 
 cat > doc/download.texi <<EOF
 @node Tarballs
@@ -181,11 +98,16 @@ rm -r doc/.well-known doc/nncp.html/.well-known
 
 ########################################################################
 
-rm -r .redo doc/.redo
+perl -i -npe "s/GO build/GO build -mod=vendor/" bin/default.do
+perl -i -npe "s/GO list/GO list -mod=vendor/" bin/default.do
+perl -i -npe "s/GO test/GO test -mod=vendor/" test.do
+rm makedist.sh VERSION.do
+rm -r .git
+redo-cleanup full
 find . -type d -exec chmod 755 {} \;
 find . -type f -exec chmod 644 {} \;
-find . -type f -name "*.sh" -exec chmod 755 {} \;
-chmod 755 contrib/do
+find . -type f -name "*.sh" -exec chmod +x {} \;
+chmod +x contrib/do
 
 cd ..
 tar cvf nncp-"$release".tar --uid=0 --gid=0 --numeric-owner nncp-"$release"
diff --git a/module-name.do b/module-name.do
deleted file mode 100644 (file)
index 4de5370..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-redo-ifchange src/go.mod
-sed -n 's/^module //p' < src/go.mod
diff --git a/test.do b/test.do
index feb7b5fa8760b7bd2272f21f446715f2168923e1..13b228a8cbdf4e382c3445e06f37697727a08dcc 100644 (file)
--- a/test.do
+++ b/test.do
@@ -1,7 +1,6 @@
-redo-ifchange config gopath module-name
+redo-ifchange config
 exec >&2
 . ./config
-. ./gopath
-mod=`cat module-name`
 cd src
-GOPATH=$GOPATH ${GO:-go} test -failfast $mod/...
+GO=${GO:-go}
+$GO test -failfast ./...