prepare-release 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 »git tag ${VERSION}« if you are satisfied"
  41. else
  42. echo >&2 'REMEMBER: Change to a valid distribution before release'
  43. fi
  44. # check the manpages with each vendor for vendor-specific errors…
  45. find vendor -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2 | while read DISTRO; do
  46. ln -sf ../vendor/${DISTRO}/apt-vendor.ent doc
  47. if ! xmllint --nonet --valid --noout $(find doc/ -maxdepth 1 -name '*.xml'); then
  48. echo >&2 "WARNING: original docbook manpages have errors with vendor ${DISTRO}!"
  49. fi
  50. done
  51. # … but check the translations only with one vendor for translation-specific errors
  52. if ! xmllint --nonet --valid --noout $(find doc/ -mindepth 2 -maxdepth 2 -name '*.xml'); then
  53. echo >&2 "WARNING: translated docbook manpages have errors!"
  54. fi
  55. rm -f doc/apt-vendor.ent
  56. elif [ "$1" = 'library' ]; then
  57. librarysymbols() {
  58. echo "Checking $1 in version $2"
  59. local tmpfile=$(mktemp)
  60. dpkg-gensymbols -p${1}${2} -ebuild/bin/${1}.so.${2} -Idebian/${1}${2}.symbols -O/dev/null 2> /dev/null > $tmpfile || true
  61. echo '=== Missing symbols:'
  62. grep '^+#MISSING' $tmpfile || true
  63. echo '=== New symbols:'
  64. grep '^+ ' $tmpfile | cut -d' ' -f 2 | cut -d'@' -f 1 | c++filt | while read line; do
  65. echo " (c++)\"${line}@Base\" $VERSION"
  66. done | sort -u
  67. rm -f $tmpfile
  68. }
  69. librarysymbols 'libapt-pkg' "${LIBAPTPKGVERSION}"
  70. echo
  71. librarysymbols 'libapt-inst' "${LIBAPTINSTVERSION}"
  72. else
  73. echo >&1 "Usage:\t$0 pre-export
  74. \t$0 post-build
  75. \t$0 library
  76. If you use »git buildpackage« you can leave this script alone as it will
  77. be run at the right places auto-magically. Otherwise you should use
  78. »pre-export« to update po and pot files as well as version numbering.
  79. »post-build« can be used to run some more or less useful checks later on.
  80. »library« isn't run automatically but can be useful for maintaining the
  81. (more or less experimental) symbols files we provide"
  82. fi