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