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