import repository from arizona
[raven.git] / rpm_builds / build-ravenlib
1 #!/usr/local/bin/bash
2
3 if [ ! $# -eq 2 ]
4 then
5         echo "usage: build-ravenlib <version> <release>"
6         exit 1
7 fi
8
9 VER=$1
10 REL=$2
11 SOURCE=`cat source`
12 FOLDER="ravenlib-$VER"
13
14
15 #create a folder to do the stuff in
16 mkdir $FOLDER 
17
18 echo "# this file is automatically generated by the build script" > $FOLDER/ravenlibversion.py
19 echo "VER= '"$VER"'" >> $FOLDER/ravenlibversion.py
20 echo "REL= '"$REL"'" >> $FOLDER/ravenlibversion.py
21 echo "VERREL = VER + '-' + REL" >> $FOLDER/ravenlibversion.py
22
23 cp $SOURCE/lib/ravenstats $FOLDER
24 cp $SOURCE/lib/ravenlib/setup.py $FOLDER
25 cp $SOURCE/lib/ravenlib/acl/baseacl.py $FOLDER
26 cp $SOURCE/lib/ravenlib/acl/mysqlacl.py $FOLDER
27 cp $SOURCE/lib/ravenlib/client/repoclient.py $FOLDER
28 cp $SOURCE/lib/ravenlib/client/digdugapi.py $FOLDER
29 #cat $FOLDER/digdugapi.py
30 cp $SOURCE/lib/ravenlib/crypto.py $FOLDER
31 cp $SOURCE/lib/ravenlib/daemon.py $FOLDER
32 cp $SOURCE/lib/ravenlib/dirchecker.py $FOLDER
33 cp $SOURCE/lib/ravenlib/files/asn1.py $FOLDER
34 cp $SOURCE/lib/ravenlib/files/pacpackages.py $FOLDER
35 cp $SOURCE/lib/ravenlib/files/pacgroups.py $FOLDER
36 cp $SOURCE/lib/ravenlib/files/tpfile.py $FOLDER
37 cp $SOURCE/lib/ravenlib/files/tpparse.py $FOLDER
38 cp $SOURCE/lib/ravenlib/files/sshkey.py $FOLDER
39 cp $SOURCE/lib/ravenlib/hash.py $FOLDER
40 cp $SOURCE/lib/ravenlib/listutil.py $FOLDER
41 cp $SOURCE/lib/ravenlib/ravenconfigparser.py $FOLDER
42 cp $SOURCE/lib/ravenlib/ravenlog.py $FOLDER
43 cp $SOURCE/lib/ravenlib/report.py $FOLDER
44 cp $SOURCE/lib/ravenlib/stats.py $FOLDER
45 cp $SOURCE/lib/ravenlib/tableformat.py $FOLDER
46 cp $SOURCE/lib/ravenlib/tableprint.py $FOLDER
47 cp $SOURCE/lib/ravenlib/typecheck.py $FOLDER
48 cp $SOURCE/lib/ravenlib/modpythonapi/BaseClient.py $FOLDER
49 cp $SOURCE/lib/ravenlib/modpythonapi/AuthenticatedClient.py $FOLDER
50 cp $SOURCE/lib/ravenlib/modpythonapi/ApiExceptionCodes.py $FOLDER
51 cp $SOURCE/lib/ravenlib/package/exception.py $FOLDER
52 cp $SOURCE/lib/ravenlib/package/rpm.py $FOLDER
53 cp $SOURCE/lib/ravenlib/package/storkpackage.py $FOLDER
54 cp $SOURCE/lib/ravenlib/package/tar.py $FOLDER
55 cp $SOURCE/lib/ravenlib/package/transaction.py $FOLDER
56 cp $SOURCE/lib/ravenlib/platform/all.py $FOLDER
57 cp $SOURCE/lib/ravenlib/platform/platform_sfa.py $FOLDER
58 cp $SOURCE/lib/ravenlib/platform/platform_unix.py $FOLDER
59 cp $SOURCE/lib/ravenlib/platform/platform_planetlab.py $FOLDER
60 cp $SOURCE/lib/ravenlib/platform/platform_protogeni.py $FOLDER
61 cp $SOURCE/lib/ravenlib/pubsub/sender.py $FOLDER
62 cp $SOURCE/lib/ravenlib/pubsub/receiver.py $FOLDER
63 cp $SOURCE/lib/ravenlib/xmlrpc/server.py $FOLDER
64 cp $SOURCE/lib/ravenlib/xmlrpc/client.py $FOLDER
65
66
67 #mv the source files we need to there
68
69 touch $FOLDER/__init__.py
70
71 #tar the dir up into the SOURCES folder
72 tar -czf SOURCES/$FOLDER.tar.gz $FOLDER
73
74 #remove the folder
75 rm -rf $FOLDER
76
77 #prepare the awk command
78 AWK="awk '{gsub(/@VER@/,\"$VER\"); gsub(/@REL@/,\"$REL\"); print;}' SPECS/ravenlib.spec.template"
79
80 #execute awk command
81 eval $AWK > .stork-ravenlib.spec
82
83 #make rpm
84 rpmbuild -ba .stork-ravenlib.spec --target noarch
85 RETSTAT=$?
86
87
88 rm .stork-ravenlib.spec
89
90 #clean up the debug rpms that get created for some reason
91 for foo in `find ./ -name "*debuginfo*"`
92 do
93         rm -f $foo
94 done
95
96 exit $RETSTAT