1#!/bin/sh
2#
3# $Id: $
4#
5# Bump the Berkeley DB version
6
7P=`pwd`
8R=`dirname $P`
9progname="$0"
10VERSION="$1"
11assembly="../csharp/Properties/AssemblyInfo.cs"
12t=/tmp/__assembly
13
14# Sanity check
15if [ ! -f $R/dist/RELEASE ] ; then
16	echo "$progname must be run in the dist directory of a Berkeley DB tree"
17	exit 1
18fi
19
20OIFS="$IFS"
21IFS=.
22set -- $VERSION
23
24if [ $# != 3 ] ; then
25	echo "Usage: $progname X.X.X -- sets the Berkeley DB version to X.X.X"
26	exit 1
27fi
28MAJOR="$1" MINOR="$2" PATCH="$3"
29
30IFS="$OFS"
31
32# Update the change log patch number -- there's 1 location to update in
33# the change log "table of contents", and 2 in the Change Log itself.
34#cd $R/docs_src/ref/changelog && vi toc.so ${MAJOR}.${MINOR}.html
35
36# Update the release number.
37cd $R/dist &&\
38    (echo "/^DB_VERSION_MAJOR/s/=.*/=$MAJOR/" &&\
39     echo "/^DB_VERSION_MINOR/s/=.*/=$MINOR/" &&\
40     echo "/^DB_VERSION_PATCH/s/=.*/=$PATCH/" &&\
41     echo w &&\
42     echo q) | ed RELEASE > /dev/null
43VERSION=`sh -c '. RELEASE; echo $DB_VERSION'`
44echo "Berkeley DB release $VERSION."
45
46# Build auto-generated files.
47cd $R/dist && sh s_all
48
49# Update the CSharp assembly information
50sed -e "s:AssemblyVersion(\"[0-9]*\.[0-9]*\.[0-9]*\"):AssemblyVersion(\"$MAJOR\.$MINOR\.$PATCH\"):" < $assembly > $t
51cmp $t $assembly > /dev/null 2>&1 ||
52    (rm -f $assembly && cp $t $assembly && rm -f $t && chmod 444 $assembly)
53
54# Commit all of the changes.
55echo "Now run 'hg commit && hg tag db-$MAJOR.$MINOR.$PATCH && hg push'"
56