prepare-release 5.6 KB

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