prepare-release 3.4 KB

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