aboutsummaryrefslogtreecommitdiff
path: root/contrib/bump-taler-version.sh
blob: 3d770de3a22236589b41e5de1f213e3172dceaaf (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
#!/usr/bin/env bash
set -eu

if [ $# != 1 ]; then
    >&2 echo "Illegal number of arguments"
    >&2 echo "Usage: $0 <version>"
    exit -1
fi

VERSION="$1"
DATE="$(date -R)"
GIT_USER="$(git config user.name)"
GIT_EMAIL="$(git config user.email)"

function updated {
    local FILE=$1
    if [[ $(grep "${VERSION}" "${FILE}") ]]; then
        echo "${FILE} already in ${VERSION}"
        return -1
    fi
}

# update configure.ac
function configure_ac {
    updated configure.ac || return 0

    sed -i "/AC_INIT/s/,\\[\\(.*\\)\\],/,[${VERSION}],/" configure.ac
    echo "configure.ac ${VERSION}"
}

# update debian/changelog
function debian_changelog {
    updated debian/changelog || return 0

    cat <<EOF > ./debian/changelog.tmp
taler-merchant (${VERSION}) unstable; urgency=low

  * Release ${VERSION}.

 -- ${GIT_USER} <${GIT_EMAIL}>  ${DATE}

EOF
    cat ./debian/changelog >> ./debian/changelog.tmp
    mv ./debian/changelog.tmp ./debian/changelog
    echo "debian/changelog ${VERSION}"
}

configure_ac
debian_changelog