* doc/*.xml:
[ntk/apt.git] / prepare-release
CommitLineData
3a496cd2
DK
1#!/bin/sh
2
3VERSION=$(dpkg-parsechangelog | sed -n -e '/^Version:/s/^Version: //p')
4DISTRIBUTION=$(dpkg-parsechangelog | sed -n -e '/^Distribution:/s/^Distribution: //p')
5
5ca28ebd
DK
6LIBAPTPKGVERSION="$(awk -v ORS='.' '/^\#define APT_PKG_M/ {print $3}' apt-pkg/init.h | sed 's/\.$//')"
7LIBAPTINSTVERSION="$(egrep '^MAJOR=' apt-inst/makefile |cut -d '=' -f 2)"
8
3a496cd2 9if [ "$1" = 'pre-export' ]; then
154fd04e 10 libraryversioncheck() {
58921d7d
DK
11 local LIBRARY="$1"
12 local VERSION="$2"
154fd04e
DK
13 if [ ! -e "debian/${LIBRARY}${VERSION}.symbols" ]; then
14 echo >&2 "Library ${LIBRARY} in version ${VERSION} has no symbols file! (maybe forgot to rename?)"
15 exit 1
16 fi
17 if [ "$(head -n1 "debian/${LIBRARY}${VERSION}.symbols")" != "${LIBRARY}.so.${VERSION} ${LIBRARY}${VERSION} #MINVER#" ]; then
18 echo >&2 "Library ${LIBRARY}${VERSION} has incorrect version in symbol header! (»$(head -n1 "debian/${LIBRARY}${VERSION}.symbols")«)"
19 exit 2
20 fi
21 }
22
5ca28ebd
DK
23 libraryversioncheck 'libapt-pkg' "$LIBAPTPKGVERSION"
24 libraryversioncheck 'libapt-inst' "$LIBAPTINSTVERSION"
154fd04e
DK
25
26
3a496cd2
DK
27 if [ "$DISTRIBUTION" = 'sid' ]; then
28 echo >&2 '»sid« is not a valid distribution. Replace it with »unstable« for you'
29 sed -i -e 's/) sid; urgency=/) unstable; urgency=/' debian/changelog
30 DISTRIBUTION='unstable'
31 elif [ "$DISTRIBUTION" = 'UNRELEASED' ]; then
32 echo >&2 'WARNING: Remember to change to a valid distribution for release'
33 VERSION="$VERSION~$(date +%Y%m%d)"
34 fi
35
36 if [ "$(date +%Y-%m-%d)" != "$(grep --max-count=1 '^"POT-Creation-Date: .*\n"$' po/apt-all.pot | cut -d' ' -f 2)" -o \
37 "$(date +%Y-%m-%d)" != "$(grep --max-count=1 '^"POT-Creation-Date: .*\n"$' doc/po/apt-doc.pot | cut -d' ' -f 2)" ]; then
38 echo >&2 'POT files are not up-to-date. Execute »make update-po« for you…'
39 make update-po
40 fi
41
42 sed -i -e "s/^PACKAGE_VERSION=\".*\"$/PACKAGE_VERSION=\"${VERSION}\"/" configure.in
43elif [ "$1" = 'post-build' ]; then
44 if [ "$DISTRIBUTION" != "UNRELEASED" ]; then
45 echo >&2 "REMEMBER: Tag this release with »bzr tag ${VERSION}« if you are satisfied"
46 else
47 echo >&2 'REMEMBER: Change to a valid distribution before release'
48 fi
372c2a2d
DK
49 if ! xmllint --nonet --valid --noout $(find doc/ -maxdepth 1 -name '*.xml'); then
50 echo >&2 'WARNING: original docbook manpages have errors!'
51 elif ! xmllint --nonet --valid --noout $(find doc/ -mindepth 2 -maxdepth 2 -name '*.xml'); then
52 echo >&2 'WARNING: translated docbook manpages have errors, but originals are okay!'
53 fi
5ca28ebd
DK
54elif [ "$1" = 'library' ]; then
55 librarysymbols() {
56 echo "Checking $1 in version $2"
58921d7d 57 local tmpfile=$(mktemp)
5ca28ebd
DK
58 dpkg-gensymbols -p${1}${2} -ebuild/bin/${1}.so.${2} -Idebian/${1}${2}.symbols -O/dev/null 2> /dev/null > $tmpfile
59 echo '=== Missing symbols:'
60 grep '^+#MISSING' $tmpfile
61 echo '=== New symbols:'
62 grep '^+ ' $tmpfile | cut -d' ' -f 2 | cut -d'@' -f 1 | c++filt | while read line; do
63 echo " (c++)\"${line}@Base\" $VERSION"
64 done | sort -u
65 rm $tmpfile
66 }
67 librarysymbols 'libapt-pkg' "${LIBAPTPKGVERSION}"
68 echo
69 librarysymbols 'libapt-inst' "${LIBAPTINSTVERSION}"
3a496cd2
DK
70else
71 echo >&1 "Usage:\t$0 pre-export
72\t$0 post-build
5ca28ebd 73\t$0 library
3a496cd2
DK
74
75If you use »bzr builddeb« you can leave this script alone as it will
76be run at the right places auto-magically. Otherwise you should use
77»pre-export« to update po and pot files as well as version numbering.
5ca28ebd
DK
78»post-build« can be used to run some more or less useful checks later on.
79
80»library« isn't run automatically but can be useful for maintaining the
81(more or less experimental) symbols files we provide"
3a496cd2 82fi