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