-
Notifications
You must be signed in to change notification settings - Fork 286
/
packdist.sh
executable file
·288 lines (238 loc) · 7.36 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
#!/bin/bash
PACKAGE=lighttpd
BASEDOWNLOADURL="https://download.lighttpd.net/lighttpd/releases-1.4.x"
SNAPSHOTURL="https://download.lighttpd.net/lighttpd/snapshots-1.4.x"
if [[ "`id -un`" != "stbuehler" ]] && [[ -z "$AUTHOR" ]]; then
export AUTHOR="gstrauss"
export KEYID="AF16D0F0"
fi
AUTHOR="${AUTHOR:-stbuehler}"
# may take one argument for prereleases like
# ./packdist.sh rc1-r10
syntax() {
echo "./packdist.sh [--help] [~rc1]" >&2
exit 2
}
while [ $# -gt 0 ]; do
case "$1" in
"--help")
syntax
;;
"rc"*|"~rc"*)
if [ -n "$append" ]; then
echo "Only one append allowed" >&2
syntax
fi
echo "Appending '$1'"
append="$1"
BASEDOWNLOADURL="${SNAPSHOTURL}"
;;
*)
echo "Unknown option '$1'" >&2
syntax
;;
esac
shift
done
force() {
"$@" || {
echo "Command failed: $*"
exit 1
}
}
# summarize all changes since last release
genchanges() {
(
sed "/^- ${version}/,/^-/p;d" | sed "/^- /d;/^$/d" | sed -e 's/^ \*/\*/'
) < ${self}/NEWS > CHANGES
return 0
}
# generate links in old textile format "text":url
genlinks_changes() {
local repourl ticketurl inf out
#repourl="https://redmine.lighttpd.net/projects/lighttpd/repository/svn/revisions/"
ticketurl="https://redmine.lighttpd.net/issues/"
inf="$1"
outf="$1".links
(
sed -e 's%\(\[\|\]\)%\\\1%g' \
-e 's%\(.\)\*%\1\\*%g' \
-e 's% _% \\_%g' \
-e 's%\(https://[a-zA-Z0-9.:_/\-]\+\)%[\1](\1)%g' \
-e 's%#\([0-9]\+\)%[#\1]('"${ticketurl}"'\1)%g' \
-e 's%\(CVE-[0-9\-]\+\)%[\1](https://cve.mitre.org/cgi-bin/cvename.cgi?name=\1)%g'
#(svn-historical) sed -e 's%r\([0-9]\+\)%[r\1]('"${repourl}"'\1)%g' |
) < "$inf" > "$outf"
}
#genlinks_downloads() {
# local inf out
# inf="$1"
# outf="$1".links
# (
# sed -e 's%\(https://[a-zA-Z0-9.:_/\-]\+\)%[\1](\1)%g'
# ) < "$inf" > "$outf"
#}
www_l_n_post() {
if [ -z "${append}" ]; then
# release
cat <<EOF
---
title: ${version}
author: $AUTHOR
author_email: ${AUTHOR}@lighttpd.net
tags:
- ${version}
- lighttpd
- releases
---
{% excerpt -%}
## Important changes
TODO
## Downloads
EOF
cat DOWNLOADS.links
cat <<EOF
{%- endexcerpt %}
## Changes from ${prevversion}
EOF
cat CHANGES.links
else
# pre release
cat <<EOF
---
title: 'PRE-RELEASE: lighttpd ${version}${append}'
author: $AUTHOR
author_email: ${AUTHOR}@lighttpd.net
tags:
- ${version}
- lighttpd
- prerelease
---
{% excerpt -%}
We would like to draw your attention to the latest pre-release of the stable 1.4 branch of lighttpd.
You can get the pre-release from these urls:
EOF
cat DOWNLOADS.links
cat <<EOF
Please test it as much as possible and provide us with feedback.
A lot of testing ensures a good release.
<!-- TODO: describe major changes -->
{%- endexcerpt %}
#### Changes from ${prevversion}
EOF
cat CHANGES.links
cat <<EOF
If you want to get the latest source for any branch, you can get it from our git repository.
Documentation to do so can be obtained from this page: [InstallFromSource](https://redmine.lighttpd.net/projects/lighttpd/wiki/InstallFromSource)
Bug reports or feature requests can be filed in our ticket system: [New Issue](https://redmine.lighttpd.net/projects/lighttpd/issues/new)
Please make sure to check if there isn't a ticket already here: [Issues](https://redmine.lighttpd.net/projects/lighttpd/issues)
Perhaps you also want to have a look at our [download site](https://download.lighttpd.net/lighttpd/)
Thank you for flying light.
EOF
fi
}
self=$(dirname "$(readlink -f "$0")")
force cd "${self}"
if [ -d distbuild ]; then
# make distcheck may leave readonly files
chmod u+w -R distbuild
rm -rf distbuild
fi
force mkdir distbuild
version=$(grep "version: '1\\.4\\." ${self}/meson.build | cut -d"'" -f2)
name="${PACKAGE}-${version}${append}"
force git remote update
if [ -z "${KEYID}" ]; then
force git tag -s -m "${name}" "${name}"
else
force git tag -u "${KEYID}" -m "${name}" "${name}"
fi
force git archive --format tar -o "distbuild/${name}.tar" --prefix "${name}/" "${name}"
force cd distbuild
force gzip -n --keep "${name}.tar"
force xz --keep "${name}.tar"
force rm "${name}.tar"
force sha256sum "${name}.tar."{gz,xz} > "${name}.sha256sum"
force sha512sum "${name}.tar."{gz,xz} > "${name}.sha512sum"
force gpg ${KEYID:+-u "${KEYID}"} -a --output "${name}.tar.gz.asc" --detach-sig "${name}.tar.gz"
force gpg ${KEYID:+-u "${KEYID}"} -a --output "${name}.tar.xz.asc" --detach-sig "${name}.tar.xz"
(
echo "* ${BASEDOWNLOADURL}/${name}.tar.gz"
echo "** GPG signature: ${BASEDOWNLOADURL}/${name}.tar.gz.asc"
echo "** SHA256: @$(sha256sum ${name}.tar.gz | cut -d' ' -f1)@"
echo "* ${BASEDOWNLOADURL}/${name}.tar.xz"
echo "** GPG signature: ${BASEDOWNLOADURL}/${name}.tar.xz.asc"
echo "** SHA256: @$(sha256sum ${name}.tar.xz | cut -d' ' -f1)@"
echo "* SHA256 checksums: ${BASEDOWNLOADURL}/${name}.sha256sum"
echo "* SHA512 checksums: ${BASEDOWNLOADURL}/${name}.sha512sum"
) > DOWNLOADS
(
echo "* [${name}.tar.gz](${BASEDOWNLOADURL}/${name}.tar.gz) ([GPG signature](${BASEDOWNLOADURL}/${name}.tar.gz.asc))"
echo " * SHA256: \`$(sha256sum ${name}.tar.gz | cut -d' ' -f1)\`"
echo "* [${name}.tar.xz](${BASEDOWNLOADURL}/${name}.tar.xz) ([GPG signature](${BASEDOWNLOADURL}/${name}.tar.xz.asc))"
echo " * SHA256: \`$(sha256sum ${name}.tar.xz | cut -d' ' -f1)\`"
echo "* [SHA256 checksums](${BASEDOWNLOADURL}/${name}.sha256sum)"
echo "* [SHA512 checksums](${BASEDOWNLOADURL}/${name}.sha512sum)"
) > DOWNLOADS.links
force genchanges
force genlinks_changes CHANGES
#force genlinks_downloads DOWNLOADS
prevversion="${version%.*}.$((${version##*.} - 1))"
isodate=$(date +"%Y-%m-%d")
if [ -z "${append}" ]; then
# only for Releases
(
cat <<EOF
h1. Release Info
* Version: ${version}
* Previous version: [[Release-${prevversion//./_}|${prevversion}]]
* Branch: 1.4
* Status: stable
* Release Purpose: bug fixes
* Release manager: $AUTHOR
* Released date: ${isodate}
h1. Important changes from ${prevversion}
TODO
h1. Downloads
EOF
cat DOWNLOADS
cat <<EOF
h1. Changes from ${prevversion}
EOF
cat CHANGES
cat <<EOF
h1. External references
* https://www.lighttpd.net/$(date +"%Y/%-m/%-d")/${version}
EOF
) > "Release-${version//./_}.page"
cat "Release-${version//./_}.page"
fi
echo
echo -------
echo
www_l_n_post | tee ${isodate}-"${version}.md"
echo
echo -------
echo
escprevversion=$(printf "%s" "${prevversion}" | sed 's/\./[.]/g')
escversion=$(printf "%s" "${version}" | sed 's/\./[.]/g')
nextversion="${version%.*}.$((${version##*.} + 1))"
echo cd distbuild
echo scp "${name}.{tar*,sha*sum}" lighttpd.net:
echo ssh lighttpd.net \""cp ${name}.{tar*,sha*sum} download/lighttpd/releases-1.4.x/"\"
echo ssh lighttpd.net \""mv ${name}.{tar*,sha*sum} archive/"\"
# (not using 'sed -i' due to dir permissions)
echo ssh lighttpd.net \""sed -e 's/${escprevversion}/${version}/g' download/lighttpd/README.txt > README.txt.\\\$\\\$ && cat README.txt.\\\$\\\$ > download/lighttpd/README.txt && rm README.txt.\\\$\\\$"\"
echo ssh lighttpd.net \""echo lighttpd-${version} > download/lighttpd/releases-1.4.x/latest.txt"\"
echo
echo mkdir dl
echo cd dl
echo wget "${BASEDOWNLOADURL}/${name}".'{tar.gz,tar.xz,sha256sum,sha512sum}'
echo sha256sum -c "${name}".sha256sum
echo sha512sum -c "${name}".sha512sum
echo
echo cd "${self}"
echo sed -i -e "'s/${escversion}/${nextversion}/g'" CMakeLists.txt SConstruct configure.ac meson.build
echo git commit -m "'- next is ${nextversion}'" CMakeLists.txt SConstruct configure.ac meson.build
echo git push origin master
echo git push origin "${name}"