]>
Commit | Line | Data |
---|---|---|
3a496cd2 DK |
1 | #!/bin/sh |
2 | ||
fb83d0cc SL |
3 | set -e |
4 | ||
3a496cd2 DK |
5 | VERSION=$(dpkg-parsechangelog | sed -n -e '/^Version:/s/^Version: //p') |
6 | DISTRIBUTION=$(dpkg-parsechangelog | sed -n -e '/^Distribution:/s/^Distribution: //p') | |
7 | ||
5ca28ebd DK |
8 | LIBAPTPKGVERSION="$(awk -v ORS='.' '/^\#define APT_PKG_M/ {print $3}' apt-pkg/init.h | sed 's/\.$//')" |
9 | LIBAPTINSTVERSION="$(egrep '^MAJOR=' apt-inst/makefile |cut -d '=' -f 2)" | |
10 | ||
fb83d0cc SL |
11 | dpkg-checkbuilddeps -d 'libxml2-utils' |
12 | ||
3a496cd2 | 13 | if [ "$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 |
48 | elif [ "$1" = 'post-build' ]; then |
49 | if [ "$DISTRIBUTION" != "UNRELEASED" ]; then | |
3fadd319 | 50 | echo >&2 "REMEMBER: Tag this release with »git tag ${VERSION}« if you are satisfied" |
3a496cd2 DK |
51 | else |
52 | echo >&2 'REMEMBER: Change to a valid distribution before release' | |
53 | fi | |
0c268997 DK |
54 | |
55 | # check the manpages with each vendor for vendor-specific errors… | |
56 | find vendor -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2 | while read DISTRO; do | |
57 | ln -sf ../vendor/${DISTRO}/apt-vendor.ent doc | |
58 | if ! xmllint --nonet --valid --noout $(find doc/ -maxdepth 1 -name '*.xml'); then | |
59 | echo >&2 "WARNING: original docbook manpages have errors with vendor ${DISTRO}!" | |
60 | fi | |
61 | done | |
62 | # … but check the translations only with one vendor for translation-specific errors | |
63 | if ! xmllint --nonet --valid --noout $(find doc/ -mindepth 2 -maxdepth 2 -name '*.xml'); then | |
64 | echo >&2 "WARNING: translated docbook manpages have errors!" | |
372c2a2d | 65 | fi |
0c268997 DK |
66 | rm -f doc/apt-vendor.ent |
67 | ||
5ca28ebd DK |
68 | elif [ "$1" = 'library' ]; then |
69 | librarysymbols() { | |
70 | echo "Checking $1 in version $2" | |
58921d7d | 71 | local tmpfile=$(mktemp) |
f1d87437 | 72 | dpkg-gensymbols -p${1}${2} -ebuild/bin/${1}.so.${2} -Idebian/${1}${2}.symbols -O/dev/null 2> /dev/null > $tmpfile || true |
5ca28ebd | 73 | echo '=== Missing symbols:' |
f1d87437 | 74 | grep '^+#MISSING' $tmpfile || true |
5ca28ebd DK |
75 | echo '=== New symbols:' |
76 | grep '^+ ' $tmpfile | cut -d' ' -f 2 | cut -d'@' -f 1 | c++filt | while read line; do | |
77 | echo " (c++)\"${line}@Base\" $VERSION" | |
78 | done | sort -u | |
f1d87437 | 79 | rm -f $tmpfile |
5ca28ebd DK |
80 | } |
81 | librarysymbols 'libapt-pkg' "${LIBAPTPKGVERSION}" | |
82 | echo | |
83 | librarysymbols 'libapt-inst' "${LIBAPTINSTVERSION}" | |
3a496cd2 DK |
84 | else |
85 | echo >&1 "Usage:\t$0 pre-export | |
86 | \t$0 post-build | |
5ca28ebd | 87 | \t$0 library |
3a496cd2 | 88 | |
3fadd319 | 89 | If you use »git buildpackage« you can leave this script alone as it will |
3a496cd2 DK |
90 | be run at the right places auto-magically. Otherwise you should use |
91 | »pre-export« to update po and pot files as well as version numbering. | |
5ca28ebd DK |
92 | »post-build« can be used to run some more or less useful checks later on. |
93 | ||
94 | »library« isn't run automatically but can be useful for maintaining the | |
95 | (more or less experimental) symbols files we provide" | |
3a496cd2 | 96 | fi |