prepare-release 4.5 KB

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