]> Cypherpunks.ru repositories - gocheese.git/blob - makedist.sh
URL fixes
[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 mod_name=$(sed -n 's/^module //p' go.mod)
13 crypto_mod_path=$(sed -n 's#^require \(golang.org/x/crypto\) \(.*\)$#\1@\2#p' go.mod)
14 mkdir -p src/$mod_name
15 mv *.go go.mod go.sum src/$mod_name
16
17 mods="
18 golang.org/x/crypto
19 golang.org/x/net
20 "
21 for mod in $mods; do
22     mod_path=$(sed -n "s# // indirect## ; s#^   \($mod\) \(.*\)\$#\1@\2#p" src/$mod_name/go.mod)
23     [ -n "$mod_path" ]
24     mkdir -p src/$mod
25     ( cd $GOPATH/pkg/mod/$mod_path ; tar cf - --exclude ".git*" * ) | tar xfC - src/$mod
26     chmod -R +w src/$mod
27 done
28
29 for mod in golang.org/x/sys; do
30     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)
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 cat > $tmp/includes <<EOF
38 golang.org/x/crypto/AUTHORS
39 golang.org/x/crypto/argon2
40 golang.org/x/crypto/blake2b
41 golang.org/x/crypto/CONTRIBUTORS
42 golang.org/x/crypto/go.mod
43 golang.org/x/crypto/go.sum
44 golang.org/x/crypto/LICENSE
45 golang.org/x/crypto/PATENTS
46 golang.org/x/crypto/README.md
47 golang.org/x/net/AUTHORS
48 golang.org/x/net/CONTRIBUTORS
49 golang.org/x/net/go.mod
50 golang.org/x/net/go.sum
51 golang.org/x/net/LICENSE
52 golang.org/x/net/netutil
53 golang.org/x/net/PATENTS
54 golang.org/x/net/README.md
55 golang.org/x/sys/AUTHORS
56 golang.org/x/sys/CONTRIBUTORS
57 golang.org/x/sys/cpu
58 golang.org/x/sys/go.mod
59 golang.org/x/sys/LICENSE
60 golang.org/x/sys/PATENTS
61 golang.org/x/sys/README.md
62 EOF
63 tar cfCI - src $tmp/includes | tar xfC - $tmp
64 rm -fr src/golang.org $tmp/includes
65 mv $tmp/golang.org src
66
67 cat > download.texi <<EOF
68 You can obtain releases source code prepared tarballs on
69 @url{http://www.gocheese.cypherpunks.ru/}.
70 EOF
71 make gocheese.info
72
73 texi=$(mktemp)
74 cat > $texi <<EOF
75 \input texinfo
76 @documentencoding UTF-8
77 @settitle INSTALL
78 @include install.texi
79 @bye
80 EOF
81 perl -i -p -e "s/.verbatiminclude PUBKEY.asc/Look in PUBKEY.asc file./" install.texi
82 makeinfo --plaintext -o INSTALL $texi
83 rm $texi
84
85 rm -rf .git .gitignore style.css makedist.sh www.mk
86
87 find . -type d -exec chmod 755 {} \;
88 find . -type f -exec chmod 644 {} \;
89 chmod +x pyshop2packages.sh
90
91 cd ..
92 tar cvf gocheese-"$release".tar --uid=0 --gid=0 --numeric-owner gocheese-"$release"
93 xz -9 gocheese-"$release".tar
94 gpg --detach-sign --sign --local-user CD5CD01F55343D88 gocheese-"$release".tar.xz
95
96 tarball=gocheese-"$release".tar.xz
97 size=$(( $(stat -f %z $tarball) / 1024 ))
98 hash=$(gpg --print-md SHA256 < $tarball)
99 release_date=$(date "+%Y-%m-%d")
100
101 cat <<EOF
102 An entry for documentation:
103 @item $release @tab $release_date @tab $size KiB
104 @tab @url{gocheese-${release}.tar.xz, link} @url{gocheese-${release}.tar.xz.sig, sign}
105 @tab @code{$hash}
106 EOF
107
108 mv $tmp/$tarball $tmp/"$tarball".sig $cur/gocheese.html/