aboutsummaryrefslogtreecommitdiff
path: root/scripts/release
blob: 3b16a5a52a0228645b0d90db3f123e9543daa50c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh

set -e

if [ "$#" -ne 1 ]; then
    echo >&2 "usage: scripts/release VERSION"
    exit 1
fi

version=$1

if ! (git diff-index --quiet --cached HEAD && \
          git diff-files --quiet && \
          test -z "$(git status --porcelain)" \
     ) >/dev/null 2>&1; then
    echo >&2 "must commit first"
    exit 1
fi

perl -pi -we's/:version ".+"/:version "'$version'"/' consfigurator.asd
perl -pi -we's/^;; Version: .+/;; Version: '$version'/' \
     emacs/consfigurator.el.in
perl -pi -we"s/release = '.+'/release = '$version'/" doc/conf.py

perl -MPOSIX=strftime -pi \
     -we's/^\Q'$version' (unreleased)\E$/
           strftime "'$version' (%Y-%m-%d)", localtime/e' doc/news.rst

dist=$(dpkg-parsechangelog -SDistribution)
if [ "$dist" = "UNRELEASED" ]; then
    dch -v$version-1 ""
else
    dch -v$version-1 New upstream release.
fi
dch -r

changed_files="consfigurator.asd emacs/consfigurator.el.in doc/conf.py doc/news.rst debian/changelog"

if ! dpkg-parsechangelog | grep -q "New upstream release."; then
    echo >&2 'Debian changelog lacks line "New upstream release."'
    git checkout -- $changed_files
    exit 1
fi

msg="release Consfigurator $version (-1 to Debian unstable)"
git commit -s -m"$msg" -- $changed_files
git tag -s -m"$msg" v$version

git deborig
dgit sbuild --run-piuparts --run-autopkgtest