Add BSD license file
[platform/upstream/db4.git] / dist / bumprel
1 #!/bin/sh
2 #
3 # $Id: $
4 #
5 # Bump the Berkeley DB version
6
7 P=`pwd`
8 R=`dirname $P`
9 progname="$0"
10 VERSION="$1"
11 assembly="../csharp/Properties/AssemblyInfo.cs"
12 t=/tmp/__assembly
13
14 # Sanity check
15 if [ ! -f $R/dist/RELEASE ] ; then
16         echo "$progname must be run in the dist directory of a Berkeley DB tree"
17         exit 1
18 fi
19
20 OIFS="$IFS"
21 IFS=.
22 set -- $VERSION
23
24 if [ $# != 3 ] ; then
25         echo "Usage: $progname X.X.X -- sets the Berkeley DB version to X.X.X"
26         exit 1
27 fi
28 MAJOR="$1" MINOR="$2" PATCH="$3"
29
30 IFS="$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.
37 cd $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
43 VERSION=`sh -c '. RELEASE; echo $DB_VERSION'`
44 echo "Berkeley DB release $VERSION."
45
46 # Build auto-generated files.
47 cd $R/dist && sh s_all
48
49 # Update the CSharp assembly information
50 sed -e "s:AssemblyVersion(\"[0-9]*\.[0-9]*\.[0-9]*\"):AssemblyVersion(\"$MAJOR\.$MINOR\.$PATCH\"):" < $assembly > $t
51 cmp $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.
55 echo "Now run 'hg commit && hg tag db-$MAJOR.$MINOR.$PATCH && hg push'"