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