release 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/bin/sh
  2. # Usage: ./release NEW_VERSION [ dev | SINCE_COMMITISH ]
  3. #
  4. # If "dev" is supplied as the second argument, a development snapshot
  5. # is done rather than a real release, i.e.:
  6. # * the --snapshot --auto options are passed to gbp-dch
  7. # * no commit or tag is created
  8. # else, the second argument is passed to gbp-dch's --since option.
  9. ### source the configuration files
  10. . config/amnesia
  11. if [ -e config/amnesia.local ] ; then
  12. . config/amnesia.local
  13. fi
  14. ### init variables
  15. NEW_VERSION="$1"
  16. if [ "$2" = dev ]; then
  17. SNAPSHOT=yes
  18. else
  19. SNAPSHOT=no
  20. SINCE="$2"
  21. fi
  22. ### helper functions
  23. fatal () {
  24. echo "Fatal: $@" >&2
  25. exit 2
  26. }
  27. ### sanity checks
  28. [ -n "${NEW_VERSION}" ] \
  29. || fatal "the new version must be supplied on the command-line."
  30. [ -n "${AMNESIA_DEV_FULLNAME}" ] \
  31. || fatal "AMNESIA_DEV_FULLNAME must be set in config/amnesia"
  32. [ -n "${AMNESIA_DEV_EMAIL}" ] \
  33. || fatal "AMNESIA_DEV_EMAIL must be set in config/amnesia"
  34. [ -n "${AMNESIA_DEV_KEYID}" ] \
  35. || fatal "AMNESIA_DEV_KEYID must be set in config/amnesia"
  36. [ -x "`which git`" ] \
  37. || fatal "could not find git, please apt-get install git-core"
  38. [ -x "`which gbp`" ] \
  39. || fatal "could not find gbp, please apt-get install git-buildpackage"
  40. ### main
  41. export DEBFULLNAME="${AMNESIA_DEV_FULLNAME}"
  42. export DEBEMAIL="${AMNESIA_DEV_EMAIL}"
  43. # update the Changelog
  44. echo "Updating debian/changelog from Git history..."
  45. gbp dch \
  46. `if [ ${SNAPSHOT} = yes ]; then echo '--snapshot --auto' ; fi` \
  47. `if [ ${SNAPSHOT} = no -a -n ${SINCE} ]; then echo "--since=${SINCE}" ; fi` \
  48. `if [ ${SNAPSHOT} = no -a -z ${SINCE} ]; then echo "--auto" ; fi` \
  49. --new-version="${NEW_VERSION}" \
  50. --ignore-branch \
  51. -- '*' ':!wiki' \
  52. || fatal "gbp dch failed."
  53. # cleanup some parts of the changelog
  54. perl -pi'' -e 's/\A \[ IkiWiki::Plugin::po::change \]\n//' debian/changelog
  55. perl -pi'' -e 's/\A \* update[d]? PO file[s]?[.]?\n//' debian/changelog
  56. perl -pi'' -e 's/\A \* \n//' debian/changelog
  57. perl -pi'' -e 's/\A \[ 127\.0\.0\.1 \]\n//' debian/changelog
  58. perl -pi'' -e 's/\A \[ amnesia \]\n//' debian/changelog
  59. perl -pi'' -e 's/\A \[ anonym \]\n//' debian/changelog
  60. perl -pi'' -e 's/\A \[ bertagaz \]\n//' debian/changelog
  61. perl -pi'' -e 's/\A \[ BitingBird \]\n//' debian/changelog
  62. perl -pi'' -e 's/\A \[ intrigeri \]\n//' debian/changelog
  63. perl -pi'' -e 's/\A \[ kytv \]\n//' debian/changelog
  64. perl -pi'' -e 's/\A \[ sajolida \]\n//' debian/changelog
  65. perl -pi'' -e 's/\A \[ T\(A\)ILS developers \]\n//' debian/changelog
  66. perl -pi'' -e 's/\A \[ Tails developers \]\n//' debian/changelog
  67. perl -pi'' -e 's/\A \[ Tails \]\n//' debian/changelog
  68. perl -pi'' -e 's/\A \* Added a comment\n//' debian/changelog
  69. perl -pi'' -e 's/\A \* Added a comment:.*\n//' debian/changelog
  70. perl -pi'' -e 's/\A \* Remove spam\.\n//' debian/changelog
  71. perl -pi'' -e 's/\A \* todo\+\+\n//i' debian/changelog
  72. perl -pi'' -e 's/\A \* todo--\n//i' debian/changelog
  73. perl -pi'' -e 's/\A \* TODO update[.]?\n//i' debian/changelog
  74. perl -pi'' -e 's/\A \* Update ticket[.]?\n//i' debian/changelog
  75. perl -pi'' -e 's/\A \* Now pending[.]?\n//i' debian/changelog
  76. perl -pi'' -e 's/\A \* Done[.]?\n//i' debian/changelog
  77. perl -pi'' -e 's/\A \* Upcoming release\n//' debian/changelog
  78. # commit and tag the release
  79. # if [ "${SNAPSHOT}" = no ]; then
  80. # echo "Commit'ing debian/changelog..."
  81. # git commit -m "releasing version ${NEW_VERSION}" debian/changelog \
  82. # || fatal "failed to commit debian/changelog"
  83. # echo "Tagging new version..."
  84. # git tag -u "${AMNESIA_DEV_KEYID}" -m "tagging version ${NEW_VERSION}" "${NEW_VERSION}"
  85. # fi
  86. echo "done."