new function, and better approach for error handling.
[feisty_meow.git] / scripts / buildor / build_xsedes.sh
1 #!/bin/bash
2
3 source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
4
5 #hmmm: if this works well, we can use it in lots of places.
6 alias BAIL_ON_FAIL='if [ $? -ne 0 ]; then echo "A problem occurred.  $msg"; return 1; fi'
7
8 function build_xsede()
9 {
10   if [ -z "$GENII_INSTALL_DIR" ]; then
11     echo GENII_INSTALL_DIR is not set.
12     return 1
13   fi
14   pushd $GENII_INSTALL_DIR
15   if [ $? -ne 0 ]; then return 1; fi
16   echo "Build starting at: $(date)"
17
18 # clean up some things.
19 #maybe not needed.
20 if [ ! -d unit-test-reports ]; then
21 echo this chunk in build_xsedes could be removed to clean up unit tests
22 else
23 \rm -rf unit-test-reports
24 fi
25
26   # build the trunk.
27   ant -Dbuild.targetArch=64 build
28   if [ $? -ne 0 ]; then return 1; fi
29   echo "Build done at: $(date)"
30   popd
31
32   success_sound  
33 }
34
35 function rebuild_xsede()
36 {
37   if [ -z "$GENII_INSTALL_DIR" ]; then
38     echo GENII_INSTALL_DIR is not set.
39     return 1
40   fi
41   pushd $GENII_INSTALL_DIR
42   ant clean
43   if [ $? -ne 0 ]; then return 1; fi
44   popd
45   build_xsede
46 }
47
48 # a shortcut for doing a new build and creating a bootstrap container with it.
49 function rebu_bootstrap()
50 {
51   rebuild_xsede 
52   if [ $? -ne 0 ]; then echo "failed to rebuild xsede code"; return 1; fi
53
54   bash $GENII_INSTALL_DIR/xsede_tools/library/bootstrap_quick_start.sh
55   if [ $? -ne 0 ]; then echo "failed to bootstrap a container"; return 1; fi
56
57   success_sound  
58 }
59
60 # a shortcut for doing a quick build and then creating an installer.
61 function fast_install_build()
62 {
63   build_xsede 
64   if [ $? -ne 0 ]; then echo "failed to build xsede code"; return 1; fi
65
66   bash $GENII_INSTALL_DIR/xsede_tools/tools/installer/fast_installer_build.sh $*
67   if [ $? -ne 0 ]; then echo "failed to create the installer."; return 1; fi
68
69   success_sound  
70 }
71
72