merged from donkults experimental branch
[ntk/apt.git] / prepare-release
1 #!/bin/sh
2
3 VERSION=$(dpkg-parsechangelog | sed -n -e '/^Version:/s/^Version: //p')
4 DISTRIBUTION=$(dpkg-parsechangelog | sed -n -e '/^Distribution:/s/^Distribution: //p')
5
6 if [ "$1" = 'pre-export' ]; then
7 if [ "$DISTRIBUTION" = 'sid' ]; then
8 echo >&2 '»sid« is not a valid distribution. Replace it with »unstable« for you'
9 sed -i -e 's/) sid; urgency=/) unstable; urgency=/' debian/changelog
10 DISTRIBUTION='unstable'
11 elif [ "$DISTRIBUTION" = 'UNRELEASED' ]; then
12 echo >&2 'WARNING: Remember to change to a valid distribution for release'
13 VERSION="$VERSION~$(date +%Y%m%d)"
14 fi
15
16 if [ "$(date +%Y-%m-%d)" != "$(grep --max-count=1 '^"POT-Creation-Date: .*\n"$' po/apt-all.pot | cut -d' ' -f 2)" -o \
17 "$(date +%Y-%m-%d)" != "$(grep --max-count=1 '^"POT-Creation-Date: .*\n"$' doc/po/apt-doc.pot | cut -d' ' -f 2)" ]; then
18 echo >&2 'POT files are not up-to-date. Execute »make update-po« for you…'
19 make update-po
20 fi
21
22 sed -i -e "s/^PACKAGE_VERSION=\".*\"$/PACKAGE_VERSION=\"${VERSION}\"/" configure.in
23 elif [ "$1" = 'post-build' ]; then
24 if [ "$DISTRIBUTION" != "UNRELEASED" ]; then
25 echo >&2 "REMEMBER: Tag this release with »bzr tag ${VERSION}« if you are satisfied"
26 else
27 echo >&2 'REMEMBER: Change to a valid distribution before release'
28 fi
29 else
30 echo >&1 "Usage:\t$0 pre-export
31 \t$0 post-build
32
33 If you use »bzr builddeb« you can leave this script alone as it will
34 be run at the right places auto-magically. Otherwise you should use
35 »pre-export« to update po and pot files as well as version numbering.
36 »post-build« can be used to run some more or less useful checks later on."
37 fi