debian: Attempt to keep debian/changelog up-to-date.
[sliver-openvswitch.git] / build-aux / update-debian-changelog
1 #! /bin/sh
2
3 if test $# != 2; then
4     cat <<EOF 
5 $0, to update version information a Debian changelog
6 usage: $0 CHANGELOG VERSION
7
8 This utility checks whether CHANGELOG, which should be a Debian changelog
9 file, contains a record for VERSION.  If not, then it adds one at the top.
10 EOF
11     exit 1
12 fi
13
14 CHANGELOG=$1
15 VERSION=$2
16 if test ! -e "$CHANGELOG"; then
17     echo "$0: $CHANGELOG does not exist (use --help for help"
18     exit 1
19 fi
20
21 if grep '($(VERSION))' debian/changelog >/dev/null 2>&1; then
22     :
23 else
24     echo "Adding change log record for $VERSION to $CHANGELOG"
25     {
26         cat <<EOF
27 openvswitch ($VERSION) unstable; urgency=low
28
29   * New upstream version.
30
31  -- Open vSwitch team <dev@openvswitch.org>  `date -u +"%a, %d %b %Y %H:%M:%S +0000"`
32
33 EOF
34         cat "$CHANGELOG"
35     } > "$CHANGELOG".new
36     mv "$CHANGELOG".new "$CHANGELOG"
37 fi