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