1d451f1a9e7ffe22a7aa8787d90d41be70489063
[raven.git] / rpm_builds / build-gackscentral
1 #!/bin/bash
2
3
4 if [ ! $# -eq 2 ]
5 then
6         echo "usage: build-gackscentral <version> <release>"
7         exit 1
8 fi
9
10 VER=$1
11 REL=$2
12 GENIWRAPPER_DIR=/home/smbaker/projects/sfa/trunk/sfa
13 GENIWRAPPER_UTIL=$GENIWRAPPER_DIR/util
14 GENIWRAPPER_TRUST=$GENIWRAPPER_DIR/trust
15 SOURCE=`cat source`
16 FOLDER="gackscentral-$VER"
17
18
19 #create a folder to do the stuff in
20 mkdir $FOLDER
21
22
23 #mv the source files we need to there
24 cp $SOURCE/apps/gacks/*.py $FOLDER
25 cp $SOURCE/apps/gacks/etc/*.conf $FOLDER
26
27 cp $SOURCE/apps/gacks/localhost-gacks-defragment.sh $FOLDER
28 cp $SOURCE/apps/gacks/localhost-gacks-garbagecollect.sh $FOLDER
29 cp $SOURCE/apps/gacks/localhost-gacks-runasap.sh $FOLDER
30 cp $SOURCE/apps/gacks/gackscentral.cron $FOLDER
31
32 chmod +x $FOLDER/*.sh
33 chmod +x $FOLDER/gackscli.py
34
35 # stuff for the modpython API
36 cp $SOURCE/lib/ravenlib/modpythonapi/ModPython.py $FOLDER
37 cp $SOURCE/lib/ravenlib/modpythonapi/BaseApi.py $FOLDER
38 cp $SOURCE/lib/ravenlib/modpythonapi/AuthenticatedApi.py $FOLDER
39 cp $SOURCE/lib/ravenlib/modpythonapi/ApiExceptionCodes.py $FOLDER
40
41 cp $GENIWRAPPER_UTIL/*.py $FOLDER
42 cp $GENIWRAPPER_TRUST/*.py $FOLDER
43
44 touch $FOLDER/__init__.py
45
46 #tar the dir up into the SOURCES folder
47 tar -czf SOURCES/$FOLDER.tar.gz $FOLDER
48
49 #remove the folder
50 rm -rf $FOLDER
51
52 #prepare the awk command
53 AWK="awk '{gsub(/@VER@/,\"$VER\"); gsub(/@REL@/,\"$REL\"); print;}' SPECS/gackscentral.spec.template"
54
55 #execute awk command
56 eval $AWK > .gackscentral.spec
57
58 #make rpm
59 rpmbuild -ba .gackscentral.spec --target noarch
60 RETSTAT=$?
61
62 rm .gackscentral.spec
63
64 #clean up the debug rpms that get created for some reason
65 for foo in `find ./ -name "*debuginfo*"`
66 do
67         rm -f $foo
68 done
69
70 exit $RETSTAT