import repository from arizona
[raven.git] / rpm_builds / build-nest
1 #!/usr/local/bin/bash
2
3
4 if [ ! $# -eq 2 ]
5 then
6         echo "usage: build-nest <version> <release>"
7         exit 1
8 fi
9
10 VER=$1
11 REL=$2
12 SOURCE=`cat source`
13 FOLDER="stork-nest-$VER"
14
15
16 #create a folder to do the stuff in
17 mkdir $FOLDER 
18
19 echo "# this file is automatically generated by the build script" > $FOLDER/storkversion.py
20 echo "VER= '"$VER"'" >> $FOLDER/stork_nest_version.py
21 echo "REL= '"$REL"'" >> $FOLDER/stork_nest_version.py
22 echo "VERREL = VER + '-' + REL" >> $FOLDER/stork_nest_version.py
23
24 #mv the source files we need to there
25 cp $SOURCE/ld-preload/libstorkwrap.so $FOLDER
26 cp $SOURCE/ld-preload/libproper.so.0 $FOLDER
27 cp $SOURCE/2.0/python/stork_nest_comm.py $FOLDER
28 cp $SOURCE/2.0/python/stork_nest_update.py $FOLDER
29 cp $SOURCE/2.0/python/pseprlib2.py $FOLDER
30 cp $SOURCE/2.0/python/pseprmessages.py $FOLDER
31 cp $SOURCE/2.0/python/stork_nest_comm.init $FOLDER
32 cp $SOURCE/2.0/python/storkupdatedaemon $FOLDER
33 cp $SOURCE/2.0/python/stork_prepare.py $FOLDER
34 cp $SOURCE/2.0/python/arizona_share.py $FOLDER
35 cp $SOURCE/2.0/python/prepare/stork_rpm_prepare.py $FOLDER
36 cp $SOURCE/pyspecer/stork/StorkRepository_nr06.publickey $FOLDER
37 cp $SOURCE/pyspecer/stork/arizona_stork2.publickey $FOLDER
38
39 touch $FOLDER/__init__.py
40
41 #tar the dir up into the SOURCES folder
42 tar -czf SOURCES/$FOLDER.tar.gz $FOLDER
43
44 #remove the folder
45 rm -rf $FOLDER
46
47 #prepare the awk command
48 AWK="awk '{gsub(/@VER@/,\"$VER\"); gsub(/@REL@/,\"$REL\"); print;}' SPECS/stork-nest.spec.template"
49
50 #execute awk command
51 eval $AWK > .stork-nest.spec
52
53 #make rpm
54 rpmbuild -ba .stork-nest.spec
55 RETSTAT=$?
56
57 rm .stork-nest.spec
58
59 #clean up the debug rpms that get created for some reason
60 for foo in `find ./ -name "*debuginfo*"`
61 do
62         rm -f $foo
63 done
64
65 exit $RETSTAT