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