dd0ad957665e9567f3b73afe55f104d0806decb7
[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/localhost-gacks-applyinvoices.sh $FOLDER
31 cp $SOURCE/apps/gacks/gackscentral.cron $FOLDER
32
33 cp $SOURCE/apps/gacks/gacksbackend.init $FOLDER
34
35 chmod +x $FOLDER/*.sh
36 chmod +x $FOLDER/gackscli.py
37
38 # stuff for the modpython API
39 cp $SOURCE/lib/ravenlib/modpythonapi/ModPython.py $FOLDER
40 cp $SOURCE/lib/ravenlib/modpythonapi/BaseApi.py $FOLDER
41 cp $SOURCE/lib/ravenlib/modpythonapi/AuthenticatedApi.py $FOLDER
42 cp $SOURCE/lib/ravenlib/modpythonapi/ApiExceptionCodes.py $FOLDER
43
44 cp $GENIWRAPPER_UTIL/*.py $FOLDER
45 cp $GENIWRAPPER_TRUST/*.py $FOLDER
46
47 touch $FOLDER/__init__.py
48
49 #tar the dir up into the SOURCES folder
50 tar -czf SOURCES/$FOLDER.tar.gz $FOLDER
51
52 #remove the folder
53 rm -rf $FOLDER
54
55 #prepare the awk command
56 AWK="awk '{gsub(/@VER@/,\"$VER\"); gsub(/@REL@/,\"$REL\"); print;}' SPECS/gackscentral.spec.template"
57
58 #execute awk command
59 eval $AWK > .gackscentral.spec
60
61 #make rpm
62 rpmbuild -ba .gackscentral.spec --target noarch
63 RETSTAT=$?
64
65 rm .gackscentral.spec
66
67 #clean up the debug rpms that get created for some reason
68 for foo in `find ./ -name "*debuginfo*"`
69 do
70         rm -f $foo
71 done
72
73 exit $RETSTAT