~ubuntu-branches/ubuntu/oneiric/bogofilter/oneiric

« back to all changes in this revision

Viewing changes to src/version.sh

  • Committer: Bazaar Package Importer
  • Author(s): Clint Adams
  • Date: 2004-06-27 09:22:31 UTC
  • Revision ID: james.westby@ubuntu.com-20040627092231-u26smic0nhp7rl4z
Tags: upstream-0.92.0
ImportĀ upstreamĀ versionĀ 0.92.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# no shebang line here, we want explicit $(SHELL) from make!
 
2
 
 
3
#       version.sh
 
4
#
 
5
#       create version.c to define BOGOFILTER_VERSION
 
6
#
 
7
#       if VERSION in config.h does not contain 'cvs', use its value.
 
8
#       if it does contain 'cvs', append a date to it.
 
9
#
 
10
#       We'll first try to find CVS/Entries files and use the most
 
11
#       current date from the files. To parse, we need Perl 5 and
 
12
#       the HTTP::Date module.
 
13
#
 
14
#       If that fails, either because HTTP::Date is missing, Perl is
 
15
#       missing or we're building outside the CVS working directory,
 
16
#       we'll fall back to use the current date (GMT time zone) with
 
17
#       hour precision.
 
18
#
 
19
#       On FreeBSD, HTTP::Date is part of the p5-libwww port.
 
20
 
 
21
VERSION=$(grep define.VERSION config.h | awk '{print $3}' | tr -d '"')
 
22
 
 
23
SUFFIX=$(echo $VERSION | egrep "\.cvs$")
 
24
 
 
25
srcdir=$1
 
26
shift
 
27
 
 
28
set -e
 
29
 
 
30
if [ ! -z "$SUFFIX" ]; then
 
31
    FILES=$(find $srcdir -name CVS -type d -print | while read a ; do find "$a" -name Entries -type f -print ; done)
 
32
    set +e
 
33
    DATE=CVStime_`perl -MHTTP::Date -e '
 
34
    $max = 0;
 
35
    while (<>) {
 
36
        split m(/);
 
37
        $a=str2time($_[3], "GMT");
 
38
        $max=$a if $a and $a > $max;
 
39
    }
 
40
    $date=HTTP::Date::time2isoz($max);
 
41
    $date=~tr/ :Z-/_/d;
 
42
    print $date, "\n";
 
43
    ' </dev/null $FILES` || DATE=
 
44
    if [ "x$FILES" = "x" ] || [ "x$DATE" = "x" ] ; then
 
45
       DATE=$(env TZ=GMT date "+build_date_%Y%m%d_%Hh")
 
46
    fi
 
47
#   VERSION="$VERSION.$DATE"
 
48
fi
 
49
 
 
50
echo "#include \"globals.h\""
 
51
echo "const char * const version = \"$VERSION\";"