prepare-release 4.2 KB

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