summaryrefslogtreecommitdiffstats
path: root/scripts/debian-update-versions
blob: e196a39fda0237bd0d6b7aa14f21c9fb69e3c483 (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
#!/bin/sh

get_version()
{
    (
        cd $1 > /dev/null
	      VERSION=$(git describe --tags | sed 's/^[^0-9]*//')
	      echo 1:${VERSION}
    )
}

get_timestamp_commit()
{
    (
        cd $1 > /dev/null
	      TIMESTAMP=$(git log -1 --date=short --format=%cd | sed 's/-/./g')
	      COMMIT=$(git rev-parse --short HEAD)
	      echo 2:${TIMESTAMP}.${COMMIT}
    )
}

do_subst() {
    sed  -e "0,/^mpv (.*)/s/(.*)/($1)/" \
	      -e "s/^  \* local build.*/  \* local build with ffmpeg $2, libass $3/" \
	      -e"s/\(^ -- Local User <localuser@localhost>\).*/\1  $(date -R)/" debian/changelog.TEMPLATE > debian/changelog
}

do_version_all() {
    do_subst $(get_version mpv) $(get_version ffmpeg) $(get_version libass)
}

do_timestamp_commit_all() {
    do_subst $(get_timestamp_commit mpv) $(get_timestamp_commit ffmpeg) $(get_timestamp_commit libass)
}

case "$1" in
    --master)
        do_timestamp_commit_all
        ;;
    --release|'')
        do_version_all
        ;;
    *)
        echo >&2 "$0 --master"
        echo >&2 "$0 --release"
        exit 0
        ;;
esac