1 | #!/bin/sh |
---|
2 | |
---|
3 | # Check envorionment variables set by Jenkins ############################# |
---|
4 | if [ -z "$WORKSPACE" ]; then |
---|
5 | WORKSPACE=`pwd` |
---|
6 | fi |
---|
7 | |
---|
8 | if [ -z "$SVN_REVISION" ]; then |
---|
9 | SVN_REVISION='' |
---|
10 | fi |
---|
11 | |
---|
12 | export SASVIEW_INSTALL=sasview-install |
---|
13 | |
---|
14 | if [ -z "$EASY_INSTALL" ]; then |
---|
15 | EASY_INSTALL=`which easy_install` |
---|
16 | fi |
---|
17 | |
---|
18 | |
---|
19 | # Set up build environmentRun tests ####################################### |
---|
20 | cd $WORKSPACE |
---|
21 | |
---|
22 | # Check dependencies |
---|
23 | if [ ! -d "utils" ]; then |
---|
24 | mkdir utils |
---|
25 | fi |
---|
26 | export PYTHONPATH=$PYTHONPATH:$WORKSPACE/utils |
---|
27 | "$EASY_INSTALL" -d "$WORKSPACE/utils" unittest-xml-reporting |
---|
28 | "$EASY_INSTALL" -d "$WORKSPACE/utils" lxml |
---|
29 | "$EASY_INSTALL" -d "$WORKSPACE/utils" pyparsing==1.5.5 |
---|
30 | "$EASY_INSTALL" -d "$WORKSPACE/utils" bumps==0.7.5.4 |
---|
31 | "$EASY_INSTALL" -d "$WORKSPACE/utils" periodictable==1.3.0 |
---|
32 | python deps.py |
---|
33 | |
---|
34 | # Set up working directories |
---|
35 | rm -rf $SASVIEW_INSTALL |
---|
36 | mkdir $SASVIEW_INSTALL |
---|
37 | |
---|
38 | rm -rf $WORKSPACE/dist |
---|
39 | mkdir $WORKSPACE/dist |
---|
40 | |
---|
41 | rm -rf build |
---|
42 | |
---|
43 | |
---|
44 | # Build SasView ########################################################### |
---|
45 | export PYTHONPATH=$PYTHONPATH:$WORKSPACE/$SASVIEW_INSTALL:$WORKSPACE/utils |
---|
46 | python setup.py bdist_egg |
---|
47 | |
---|
48 | |
---|
49 | # Run tests ############################################################### |
---|
50 | # Install it locally so we can test it |
---|
51 | cd $WORKSPACE/dist |
---|
52 | easy_install -d ../$SASVIEW_INSTALL sasview*.egg |
---|
53 | |
---|
54 | # Run tests |
---|
55 | cd $WORKSPACE/test |
---|
56 | python utest_sasview.py |
---|
57 | |
---|
58 | |
---|
59 | # Build RPM ############################################################### |
---|
60 | cd ${HOME}/rpmbuild/SOURCES |
---|
61 | rm -rf *.egg |
---|
62 | cp $WORKSPACE/dist/*.egg . |
---|
63 | |
---|
64 | rm -rf $WORKSPACE/dist/*.rpm |
---|
65 | |
---|
66 | cd ${WORKSPACE}/build_tools/rpm |
---|
67 | python create_rpm_spec.py ${SVN_REVISION} |
---|
68 | cp sasview.spec ${HOME}/rpmbuild/SPECS |
---|
69 | |
---|
70 | cd ${HOME}/rpmbuild/SPECS |
---|
71 | rpmbuild -bb sasview.spec --clean |
---|
72 | cp ${HOME}/rpmbuild/RPMS/x86_64/* ${WORKSPACE}/dist |
---|
73 | |
---|