prepare-release 3.6 KB

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