]> sjero.net Git - wget/blob - build-aux/bzr-version-gen
bzr-version-gen: Fix some portability issues.
[wget] / build-aux / bzr-version-gen
1 #!/bin/sh
2
3 scriptversion=2011-08-09.13; # UTC
4
5 # Copyright (C) 2010, 2011 Free Software Foundation, Inc.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20 # Additional permission under GNU GPL version 3 section 7
21
22
23 # Written by Giuseppe Scrivano.
24
25 if test -f .tarball-version
26 then
27     cat .tarball-version | tr -d '\n'
28     exit 0
29 fi
30
31 DIRTY=""
32
33 test -n "`bzr diff | tr -d '\n'`" && DIRTY="-dirty"
34
35 REVNO=`bzr revno`
36
37 TAG=`bzr tags -r $REVNO | cut -d' ' -f1`
38 if test -z "$TAG"
39 then
40     TAG=`bzr tags -r ..$REVNO | cut -d' ' -f1`
41
42     # No tags yet
43     test -z "$TAG" && TAG="unknown"
44
45     TAG=$TAG-$REVNO
46 fi
47
48
49 printf "%s%s" "$TAG" "$DIRTY"
50
51 # Local variables:
52 # eval: (add-hook 'write-file-hooks 'time-stamp)
53 # time-stamp-start: "scriptversion="
54 # time-stamp-format: "%:y-%02m-%02d.%02H"
55 # time-stamp-time-zone: "UTC"
56 # time-stamp-end: "; # UTC"
57 # End: