forked from lighttpd/spawn-fcgi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackdist.sh
executable file
·155 lines (126 loc) · 3.72 KB
/
packdist.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/bash
SRCTEST=src/spawn-fcgi.c
PACKAGE=spawn-fcgi
# may take one argument for prereleases like
# ./packdist.sh [--nopack] -rc1-r10
tmpdir=$(mktemp --tmpdir -d packdist-XXXXXXX)
trap 'rm -rf "${tmpdir}"' EXIT
if [ ! -f ${SRCTEST} ]; then
echo "Current directory is not the source directory"
exit 1
fi
dopack=1
if [ "$1" = "--nopack" ]; then
dopack=0
shift
fi
append="$1"
force() {
"$@" || {
echo "Command failed: $*"
exit 1
}
}
# summarize all changes since last release
genchanges() {
(
echo "h1. Changes"
echo
cat ../NEWS | sed "/^- ${version}/,/^-/p;d" | sed "/^- /d;/^$/d" | sed -e 's/^ \*/\*/'
) > CHANGES
return 0
}
# genereate links in old textile format "text":url
genlinks_changes() {
local repourl ticketurl inf out
repourl="http://redmine.lighttpd.net/projects/spawn-fcgi/repository/revisions/"
ticketurl="http://redmine.lighttpd.net/issues/show/"
inf="$1"
outf="$1".links
(
sed -e 's%\(http://[a-zA-Z0-9.:_/\-]\+\)%"\1":\1%g' |
sed -e 's%#\([0-9]\+\)%"#\1":'"${ticketurl}"'\1%g' |
sed -e 's%r\([0-9]\+\)%"r\1":'"${repourl}"'\1%g'
) < "$inf" > "$outf"
}
genlinks_downloads() {
local repourl ticketurl inf out
repourl="http://redmine.lighttpd.net/projects/spawn-fcgi/repository/revisions/"
ticketurl="http://redmine.lighttpd.net/issues/show/"
inf="$1"
outf="$1".links
(
sed -e 's%\(http://[a-zA-Z0-9.:_/\-]\+\)%"\1":\1%g'
) < "$inf" > "$outf"
}
if [ ${dopack} = "1" ]; then
force ./autogen.sh
if [ -d distbuild ]; then
# make distcheck may leave readonly files
chmod u+w -R distbuild
rm -rf distbuild
fi
force mkdir distbuild
force cd distbuild
force ../configure --prefix=/usr
# force make
# force make check
force make distcheck
force make dist-gzip
force make dist-bzip2
force make dist-xz
else
force cd distbuild
fi
version=`./config.status -V | head -n 1 | cut -d' ' -f3`
name="${PACKAGE}-${version}"
if [ -x "$(which tardiff)" -a -x "$(which git)" ]; then
force cd ..
force git archive --format tar.gz -o "${tmpdir}/git-archive.tar.gz" --prefix "${name}/" HEAD
force cd distbuild
echo "Diff git -> dist tar"
force tardiff --modified --autoskip "${tmpdir}/git-archive.tar.gz" "${name}.tar.gz"
fi
downloadbaseurl="http://download.lighttpd.net/spawn-fcgi/releases-1.6.x"
if [ -n "${append}" ]; then
cp "${name}.tar.gz" "${name}${append}.tar.gz"
cp "${name}.tar.bz2" "${name}${append}.tar.bz2"
cp "${name}.tar.xz" "${name}${append}.tar.xz"
name="${name}${append}"
downloadbaseurl="http://download.lighttpd.net/spawn-fcgi/snapshots-1.6.x"
fi
force sha256sum "${name}.tar."{gz,bz2,xz} > "${name}.sha256sum"
rm -f "${name}".tar.*.asc
force gpg -a --output "${name}.tar.gz.asc" --detach-sig "${name}.tar.gz"
force gpg -a --output "${name}.tar.bz2.asc" --detach-sig "${name}.tar.bz2"
force gpg -a --output "${name}.tar.xz.asc" --detach-sig "${name}.tar.xz"
(
echo "h1. Downloads"
echo
echo "* ${downloadbaseurl}/${name}.tar.gz"
echo "** GPG signature: ${downloadbaseurl}/${name}.tar.gz.asc"
echo "** SHA256: @$(sha256sum ${name}.tar.gz | cut -d' ' -f1)@"
echo "* ${downloadbaseurl}/${name}.tar.bz2"
echo "** GPG signature: ${downloadbaseurl}/${name}.tar.bz2.asc"
echo "** SHA256: @$(sha256sum ${name}.tar.bz2 | cut -d' ' -f1)@"
echo "* ${downloadbaseurl}/${name}.tar.xz"
echo "** GPG signature: ${downloadbaseurl}/${name}.tar.xz.asc"
echo "** SHA256: @$(sha256sum ${name}.tar.xz | cut -d' ' -f1)@"
echo "* SHA256 checksums: ${downloadbaseurl}/${name}.sha256sum"
) > DOWNLOADS
force genchanges
force genlinks_changes CHANGES
force genlinks_downloads DOWNLOADS
cat CHANGES
echo
cat DOWNLOADS
echo
echo -------
echo
cat CHANGES.links
echo
cat DOWNLOADS.links
echo
echo -------
echo
echo wget "${downloadbaseurl}/${name}".'{tar.gz,tar.bz2,tar.xz,sha256sum}; sha256sum -c '${name}'.sha256sum'