]> Cypherpunks.ru repositories - gocheese.git/blob - makedist.sh
Raise copyright years
[gocheese.git] / makedist.sh
1 #!/bin/sh -ex
2
3 cur=$(pwd)
4 tmp=$(mktemp -d)
5 release=$1
6 [ -n "$release" ]
7
8 git clone . $tmp/gocheese-$release
9 cd $tmp/gocheese-$release
10 git checkout v$release
11
12 redo-ifchange module-name VERSION
13 mod_name=`cat module-name`
14
15 cat > download.texi <<EOF
16 You can obtain releases source code prepared tarballs on
17 @url{http://www.gocheese.cypherpunks.ru/}.
18 EOF
19 redo gocheese.info
20
21 crypto_mod_path=$(sed -n 's#^require \(golang.org/x/crypto\) \(.*\)$#\1@\2#p' go.mod)
22 mkdir -p src/$mod_name
23 mv *.go go.mod go.sum src/$mod_name
24
25 mods="
26 golang.org/x/crypto
27 golang.org/x/net
28 "
29 for mod in $mods; do
30     mod_path=$(sed -n "s# // indirect## ; s#^   \($mod\) \(.*\)\$#\1@\2#p" src/$mod_name/go.mod)
31     [ -n "$mod_path" ]
32     mkdir -p src/$mod
33     ( cd $GOPATH/pkg/mod/$mod_path ; tar cf - --exclude ".git*" * ) | tar xfC - src/$mod
34     chmod -R +w src/$mod
35 done
36
37 for mod in golang.org/x/sys; do
38     mod_path=$(sed -n "s#^\($mod\) \(.*\) h1:.*\$#\1@\2#p" src/$mod_name/go.sum | sed /go.mod/d | sort -n -r | sed -n 1p)
39     [ -n "$mod_path" ]
40     mkdir -p src/$mod
41     ( cd $GOPATH/pkg/mod/$mod_path ; tar cf - --exclude ".git*" * ) | tar xfC - src/$mod
42     chmod -R +w src/$mod
43 done
44
45 cat > $tmp/includes <<EOF
46 golang.org/x/crypto/AUTHORS
47 golang.org/x/crypto/argon2
48 golang.org/x/crypto/blake2b
49 golang.org/x/crypto/CONTRIBUTORS
50 golang.org/x/crypto/go.mod
51 golang.org/x/crypto/go.sum
52 golang.org/x/crypto/LICENSE
53 golang.org/x/crypto/PATENTS
54 golang.org/x/crypto/README.md
55 golang.org/x/net/AUTHORS
56 golang.org/x/net/CONTRIBUTORS
57 golang.org/x/net/go.mod
58 golang.org/x/net/go.sum
59 golang.org/x/net/LICENSE
60 golang.org/x/net/netutil
61 golang.org/x/net/PATENTS
62 golang.org/x/net/README.md
63 golang.org/x/sys/AUTHORS
64 golang.org/x/sys/CONTRIBUTORS
65 golang.org/x/sys/cpu
66 golang.org/x/sys/go.mod
67 golang.org/x/sys/LICENSE
68 golang.org/x/sys/PATENTS
69 golang.org/x/sys/README.md
70 EOF
71 tar cfCI - src $tmp/includes | tar xfC - $tmp
72 rm -fr src/golang.org $tmp/includes
73 mv $tmp/golang.org src
74
75 mkinfo() {
76     ${MAKEINFO:=makeinfo} --plaintext \
77         --set-customization-variable CLOSE_QUOTE_SYMBOL=\" \
78         --set-customization-variable OPEN_QUOTE_SYMBOL=\" \
79         -D "VERSION `cat VERSION`" $@
80 }
81
82 texi=$(mktemp)
83 cat > $texi <<EOF
84 \input texinfo
85 @documentencoding UTF-8
86 @settitle INSTALL
87 @include install.texi
88 @bye
89 EOF
90 perl -i -p -e "s/.verbatiminclude PUBKEY.asc/Look in PUBKEY.asc file./" install.texi
91 mkinfo --output INSTALL $texi
92 rm $texi
93
94 rm -rf .redo .git .gitignore style.css makedist.sh www.do module-name.do VERSION.do
95 echo 'GOPATH=`pwd` ${GO:=go} build -o $3 `cat module-name`' > gocheese.do
96 echo 'GOPATH=`pwd` ${GO:=go} test `cat module-name`/... >&2' > test.do
97 cp ~/work/redo/minimal/do contrib/do
98
99 find . -type d -exec chmod 755 {} \;
100 find . -type f -exec chmod 644 {} \;
101 chmod 755 contrib/pyshop2packages.sh contrib/do
102
103 cd ..
104 tar cvf gocheese-"$release".tar --uid=0 --gid=0 --numeric-owner gocheese-"$release"
105 xz -9 gocheese-"$release".tar
106 gpg --detach-sign --sign --local-user CD5CD01F55343D88 gocheese-"$release".tar.xz
107
108 tarball=gocheese-"$release".tar.xz
109 size=$(( $(stat -f %z $tarball) / 1024 ))
110 hash=$(gpg --print-md SHA256 < $tarball)
111 release_date=$(date "+%Y-%m-%d")
112
113 cat <<EOF
114 An entry for documentation:
115 @item $release @tab $release_date @tab $size KiB
116 @tab @url{gocheese-${release}.tar.xz, link} @url{gocheese-${release}.tar.xz.sig, sign}
117 @tab @code{$hash}
118 EOF
119
120 mv $tmp/$tarball $tmp/"$tarball".sig $cur/gocheese.html/