minor: make packdist.sh more convenient for me
[lighttpd.git] / packdist.sh
blob295673067ffe557f7997b98c862c399988818300
1 #!/bin/bash
3 SRCTEST=src/server.c
4 PACKAGE=lighttpd
5 BASEDOWNLOADURL="http://download.lighttpd.net/lighttpd/releases-1.4.x"
6 SNAPSHOTURL="http://download.lighttpd.net/lighttpd/snapshots-1.4.x"
8 if [[ "`id -un`" != "stbuehler" ]] && [[ -z "$AUTHOR" ]]; then
9 export AUTHOR="gstrauss"
10 export KEYID="AF16D0F0"
13 AUTHOR="${AUTHOR:-stbuehler}"
15 # may take one argument for prereleases like
16 # ./packdist.sh [--nopack] rc1-r10
18 syntax() {
19 echo "./packdist.sh [--nopack] [--help] [~rc1]" >&2
20 exit 2
23 if [ ! -f ${SRCTEST} ]; then
24 echo "Current directory is not the source directory"
25 exit 1
28 dopack=1
30 while [ $# -gt 0 ]; do
31 case "$1" in
32 "--nopack")
33 dopack=0
35 "--help")
36 syntax
38 "rc"*|"~rc"*)
39 if [ -n "$append" ]; then
40 echo "Only one append allowed" >&2
41 syntax
43 echo "Appending '$1'"
44 append="$1"
45 BASEDOWNLOADURL="${SNAPSHOTURL}"
48 echo "Unknown option '$1'" >&2
49 syntax
51 esac
52 shift
53 done
55 force() {
56 "$@" || {
57 echo "Command failed: $*"
58 exit 1
62 # summarize all changes since last release
63 genchanges() {
65 cat ../NEWS | sed "/^- ${version}/,/^-/p;d" | sed "/^- /d;/^$/d" | sed -e 's/^ \*/\*/'
66 ) > CHANGES
67 return 0
70 # genereate links in old textile format "text":url
71 genlinks_changes() {
72 local repourl ticketurl inf out
73 repourl="http://redmine.lighttpd.net/projects/lighttpd/repository/revisions/"
74 ticketurl="http://redmine.lighttpd.net/issues/"
75 inf="$1"
76 outf="$1".links
78 sed -e 's%\(http://[a-zA-Z0-9.:_/\-]\+\)%"\1":\1%g' |
79 sed -e 's%#\([0-9]\+\)%"#\1":'"${ticketurl}"'\1%g' |
80 sed -e 's%r\([0-9]\+\)%"r\1":'"${repourl}"'\1%g' |
81 sed -e 's%\(CVE-[0-9\-]\+\)%"\1":http://cve.mitre.org/cgi-bin/cvename.cgi?name=\1%g' |
82 cat
83 ) < "$inf" > "$outf"
85 genlinks_downloads() {
86 local repourl ticketurl inf out
87 repourl="http://redmine.lighttpd.net/projects/lighttpd/repository/revisions/"
88 ticketurl="http://redmine.lighttpd.net/issues/"
89 inf="$1"
90 outf="$1".links
92 sed -e 's%\(http://[a-zA-Z0-9.:_/\-]\+\)%"\1":\1%g' |
93 cat
94 ) < "$inf" > "$outf"
97 blog_post() {
98 if [ -z "${append}" ]; then
99 # release
100 cat <<EOF
102 layout: post
103 title: ${version}
104 author: $AUTHOR
105 author_email: ${AUTHOR}@lighttpd.net
106 categories:
107 - download
108 tags:
109 - ${version}
110 - lighttpd
111 - releases
113 {% excerpt %}
115 TODO
117 h2. Important changes
119 TODO
121 h2. Downloads
124 cat DOWNLOADS.links
125 cat <<EOF
127 {% endexcerpt %}
128 h2. Changes from ${prevversion}
131 cat CHANGES.links
132 else
133 # pre release
134 cat <<EOF
136 layout: post
137 title: 'PRE-RELEASE: lighttpd ${version}${append}'
138 categories:
139 - lighttpd
140 tags:
141 - '1.4'
142 - ${version}
143 - lighttpd
144 - prerelease
146 {% excerpt %}
147 We would like to draw your attention to the latest pre-release of the stable 1.4 branch of lighttpd.
149 You can get the pre-release from these urls:
151 cat DOWNLOADS.links
152 cat <<EOF
154 Please test it as much as possible and provide us with feedback.
155 A lot of testing ensures a good release.
157 <!-- TODO: describe major changes -->
159 {% endexcerpt %}
161 h4. Changes from ${prevversion}
164 cat CHANGES.links
166 cat <<EOF
168 If you want to get the latest source for any branch, you can get it from our svn repository.
169 Documentation to do so can be obtained from this page: "DevelSubversion":http://redmine.lighttpd.net/projects/lighttpd/wiki/DevelSubversion
170 Bug reports or feature requests can be filed in our ticket system: "New Issue":http://redmine.lighttpd.net/projects/lighttpd/issues/new
171 Please make sure to check if there isn't a ticket already here: "Issues":http://redmine.lighttpd.net/projects/lighttpd/issues
172 Perhaps you also want to have a look at our "download site":http://download.lighttpd.net/lighttpd/
174 Thank you for flying light.
179 if [ ${dopack} = "1" ]; then
180 force ./autogen.sh
182 if [ -d distbuild ]; then
183 # make distcheck may leave readonly files
184 chmod u+w -R distbuild
185 rm -rf distbuild
188 force mkdir distbuild
189 force cd distbuild
191 force ../configure --prefix=/usr
193 # force make
194 # force make check
196 force make -j 4 distcheck
197 force fakeroot make dist
198 else
199 force cd distbuild
202 version=`./config.status -V | head -n 1 | cut -d' ' -f3`
203 name="${PACKAGE}-${version}"
204 if [ -n "${append}" ]; then
205 cp "${name}.tar.gz" "${name}${append}.tar.gz"
206 cp "${name}.tar.xz" "${name}${append}.tar.xz"
207 name="${name}${append}"
210 force sha256sum "${name}.tar."{gz,xz} > "${name}.sha256sum"
212 rm -f "${name}".tar.*.asc
214 force gpg ${KEYID:+-u "${KEYID}"} -a --output "${name}.tar.gz.asc" --detach-sig "${name}.tar.gz"
215 force gpg ${KEYID:+-u "${KEYID}"} -a --output "${name}.tar.xz.asc" --detach-sig "${name}.tar.xz"
218 echo "* ${BASEDOWNLOADURL}/${name}.tar.gz"
219 echo "** GPG signature: ${BASEDOWNLOADURL}/${name}.tar.gz.asc"
220 echo "** SHA256: @$(sha256sum ${name}.tar.gz | cut -d' ' -f1)@"
221 echo "* ${BASEDOWNLOADURL}/${name}.tar.xz"
222 echo "** GPG signature: ${BASEDOWNLOADURL}/${name}.tar.xz.asc"
223 echo "** SHA256: @$(sha256sum ${name}.tar.xz | cut -d' ' -f1)@"
224 echo "* SHA256 checksums: ${BASEDOWNLOADURL}/${name}.sha256sum"
225 ) > DOWNLOADS
228 echo "* \"${name}.tar.gz\":${BASEDOWNLOADURL}/${name}.tar.gz (\"GPG signature\":${BASEDOWNLOADURL}/${name}.tar.gz.asc)"
229 echo "** SHA256: @$(sha256sum ${name}.tar.gz | cut -d' ' -f1)@"
230 echo "* \"${name}.tar.xz\":${BASEDOWNLOADURL}/${name}.tar.xz (\"GPG signature\":${BASEDOWNLOADURL}/${name}.tar.xz.asc)"
231 echo "** SHA256: @$(sha256sum ${name}.tar.xz | cut -d' ' -f1)@"
232 echo "* \"SHA256 checksums\":${BASEDOWNLOADURL}/${name}.sha256sum"
233 ) > DOWNLOADS.links
235 force genchanges
236 force genlinks_changes CHANGES
237 #force genlinks_downloads DOWNLOADS
239 prevversion="${version%.*}.$((${version##*.} - 1))"
241 if [ -z "${append}" ]; then
242 # only for Releases
244 cat <<EOF
245 h1. Release Info
247 * Version: ${version}
248 * Previous version: [[Release-${prevversion//./_}|${prevversion}]]
249 * Branch: 1.4
250 * Status: stable
251 * Release Purpose: bug fixes
252 * Release manager: $AUTHOR
253 * Released date: $(date +"%Y-%m-%d")
255 h1. Important changes from ${prevversion}
257 TODO
259 h1. Downloads
262 cat DOWNLOADS
263 cat <<EOF
265 h1. Changes from ${prevversion}
268 cat CHANGES
269 cat <<EOF
271 h1. External references
273 * http://www.lighttpd.net/$(date +"%Y/%-m/%-d")/${version}
276 ) > "Release-${version//./_}.page"
278 cat "Release-${version//./_}.page"
281 echo
282 echo -------
283 echo
287 blog_post > $(date +"%Y-%m-%d")-"${version}.textile"
288 cat $(date +"%Y-%m-%d")-"${version}.textile"
290 echo
291 echo -------
292 echo
294 echo wget "${BASEDOWNLOADURL}/${name}".'{tar.gz,tar.xz,sha256sum}; sha256sum -c '${name}'.sha256sum'