]> git.sur5r.net Git - bacula/bacula/blob - bacula/release/makebacularel
Backport from BEE
[bacula/bacula] / bacula / release / makebacularel
1 #!/bin/sh
2 #
3 #
4 # This script is used to make a Bacula release
5 #   bacula
6 #   regress
7 #   gui
8 # It writes in the current directory, so we recommend that you
9 #  do not run it in the Bacula source or Git directory, but
10 #  in a special release directory.
11 #
12 # Commit all changes, update the language files, 
13 #    export the release, make a release tar.
14 #
15 # source config
16 . ./config
17
18 tagbase=Release-
19 base_dir=bacula
20 base_pkg=bacula
21
22 remote=$2
23 branch=$3
24 ver=$4
25
26 if [ $# != 4 ] ; then
27   echo "Need $0 <source-directory> <remote-name> <branch> <version>"
28   echo "e.g. $0 release-source bee Branch-4.0 4.0.3"
29   exit 1
30 fi
31 cd $1
32 if [ $? -ne 0 ]; then
33    echo "Directory: $1 does not exist"
34    exit 1
35 fi
36 src=`pwd` 
37 current=`git branch | awk '/*/ { print $2 }'`
38 cd $base_dir 
39 if [ $?  -ne 0 ]; then
40    echo "Directory: $1 does not exist"
41    exit 1
42 fi
43 git checkout ${branch}
44 git pull ${remote} ${branch}
45 if [ $? -ne 0 ]; then
46    echo "Checkout of branch ${branch} failed."
47    exit 1
48 fi
49 fulltag=$tagbase$ver
50 echo " "
51 echo "Making $reltype for $base_pkg-$ver ..."
52 echo " "
53 #echo "OK?  ctl-c to stop"
54 #read a
55 rm -rf Release-$ver
56 if [ $reltype != "beta" ] ; then
57    cd src
58    cp -fp version.h 1
59    sed 's%^#define DEVELOPER 1%/* #define DEVELOPER 1 */%g' 1 >version.h
60    rm -f 1
61    cd ..
62 fi
63 if [ a$updatepo != ano ]; then
64    ./configure --enable-client-only
65    cd po
66    make update-po
67    cd ${src}   
68 fi
69
70 git tag -d ${fulltag}
71 echo "Creating new tag -- $fulltag"
72 git tag $fulltag
73 if [ $? != 0 ] ; then
74   echo " "
75   echo "Non-zero return status from Git"
76   echo " "
77   exit 1
78 fi
79 echo "Create Tag $fulltag done"
80 cd ${cwd}
81 rm -rf $base_pkg-$ver $base_pkg-$ver.tar.gz $base_pkg-$ver.tar.gz.sig
82 rm -rf $fulltag
83 cd ${src}
84 git archive --format=tar --prefix=$base_pkg-$ver/ $fulltag | gzip >${cwd}/$base_pkg-$ver.tar.gz
85
86 if [ $? != 0 ] ; then
87   echo " "
88   echo "Non-zero return status from Git"
89   echo " "
90   exit 1
91 fi
92 echo "Exported release into ${cwd}/$base_pkg-$ver.tar.gz"
93 cd ${cwd}
94 tar xfz $base_pkg-$ver.tar.gz 
95 # First remove Enterprise Win32 plugin source
96 cd $base_pkg-$ver/bacula
97 cp -fp ReleaseNotes ${cwd}/ReleaseNotes
98
99 cd ${cwd}/$base_pkg-$ver
100 # Move directories to release names including version
101 mv bacula $base_pkg-$ver
102 mv gui $base_pkg-gui-$ver
103 mv regress $base_pkg-regress-$ver
104 # Tar each component individually
105 tar cvfz ../$base_pkg-$ver.tar.gz $base_pkg-$ver
106 tar cvfz ../$base_pkg-gui-$ver.tar.gz $base_pkg-gui-$ver
107 tar cvfz ../$base_pkg-regress-$ver.tar.gz $base_pkg-regress-$ver
108 cd ..
109 rm -rf $base_pkg-$ver
110 ./sign $base_pkg-$ver.tar.gz
111 ./sign $base_pkg-gui-$ver.tar.gz
112 ./sign $base_pkg-regress-$ver.tar.gz
113
114 if [ a$push != ano ]; then
115    cd ${src}
116    git push ${remote} ${branch}
117    git push ${remote} tag ${fulltag}
118    echo "Pushed ${remote} and push tag ${fulltag}"
119 fi
120
121 cd ${src}
122 git checkout ${current}