File: update-version

package info (click to toggle)
tla-tools 2005.0.patch.29-2
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 504 kB
  • ctags: 119
  • sloc: sh: 2,982; awk: 490; makefile: 63
file content (45 lines) | stat: -rwxr-xr-x 1,252 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
# Update a source version file using arch version info if available
# Usage: update-version SRCDIR VERSION_FILE
#
#  Copyright (C) 2003, 2004  Miles Bader <miles@gnu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Written by Miles Bader <miles@gnu.org>

srcdir="$1"
version_file="$2"

# Version used previously
if test -r "$version_file"; then
 old_version=`cat "$version_file"`
else
 old_version=NONE
fi

# Calculate current version
if test -d "$srcdir"/{arch}; then
  # Try to get arch version
  new_version=`$TLA logs -f --dir "$srcdir" 2>/dev/null | $SED -n '$p'`

  # If that failed, the tla program is probably missing
  if test x"$new_version" = x; then
    new_version=unknown-version
  fi
elif test -r "$srcdir/DIST-VERSION"; then
  # Use dist version
  new_version=`cat "$srcdir/DIST-VERSION"`
else
  new_version="unknown-version"
fi

# Update $version_file if they're different
if test x"$old_version" != x"$new_version"; then
  echo "$new_version" > "$version_file"
fi

# arch-tag: 35f533d5-3070-4bd0-9ff6-b95fea3c126a