buildDUNE2.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 # build dunetpc and related packages.
4 # uses buildFW
5 # designed to work on Jenkins
6 
7 # Extract set qualifier from $LARSOFT_QUAL (we don't care about anything else in $LARSOFT_QUAL).
8 
9 SQUAL=`echo $LARSOFT_QUAL | tr : '\n' | grep ^s`
10 
11 echo "dunetpc version: $VERSION"
12 echo "base qualifiers: $QUAL"
13 echo "set qualifier: $SQUAL"
14 echo "build type: $BUILDTYPE"
15 echo "workspace: $WORKSPACE"
16 
17 # Parse qualifier parameter into base qualifier and label (if any).
18 # Use hyphen as separator.
19 
20 basequal=''
21 label=''
22 quals=`echo $QUAL | tr '-' ' '`
23 for q in $quals
24 do
25  if [[ $q == e* || $q == c* ]]; then
26  basequal=$q
27  else
28  label=$q
29  fi
30 done
31 echo "basequal: $basequal"
32 echo "label: $label"
33 
34 if [ x$basequal = x ]; then
35  echo "No base qualifier."
36  exit 1
37 fi
38 
39 # Create area for biuld artifacts.
40 rm -rf $WORKSPACE/copyBack
41 mkdir -p $WORKSPACE/copyBack || exit 1
42 
43 # Check for unsupported combinations of base qualifier, OS, and build label.
44 if [[ `uname -s` == Darwin ]] && [[ $basequal == e* ]]; then
45  echo "${basequal} build not supported on `uname -s`"
46  echo "${basequal} build not supported on `uname -s`" > $WORKSPACE/copyBack/skipping_build
47  exit 0
48 fi
49 if [[ `uname -s` == Darwin ]] && [[ x$label == xpy2 ]]; then
50  echo "Python 2 build not supported on `uname -s`"
51  echo "Python 2 build not supported on `uname -s`" > $WORKSPACE/copyBack/skipping_build
52  exit 0
53 fi
54 if [[ `uname -s` == Linux ]] && [[ `lsb_release -rs` == 6* ]] && [[ x$label == x ]] && [[ $basequal != e17 ]] && [[ $basequal != c2 ]]; then
55  echo "Python 3 build not supported on SL6"
56  echo "Python 3 build not supported on SL6" > $WORKSPACE/copyBack/skipping_build
57  exit 0
58 fi
59 
60 # Create build directory and go there.
61 blddir=${WORKSPACE}/build
62 logdir=${WORKSPACE}/log
63 rm -rf $blddir
64 rm -rf $logdir
65 mkdir -p $blddir || exit 1
66 mkdir -p $logdir || exit 1
67 cd $blddir || exit 1
68 
69 # Fetch buildFW script.
70 echo "Fetching buildFW."
71 curl --fail --silent --location --insecure -O http://scisoft.fnal.gov/scisoft/bundles/tools/buildFW || exit 1
72 chmod +x buildFW
73 
74 # Do build.
75 echo
76 echo "Begin build."
77 echo
78 if [ x$label = x ]; then
79  ./buildFW -t -b $basequal -s $SQUAL $blddir $BUILDTYPE dune-$VERSION || \
80  { mv *.log $logdir
81  exit 1
82  }
83 else
84  ./buildFW -t -b $basequal -s $SQUAL -l $label $blddir $BUILDTYPE dune-$VERSION || \
85  { mv *.log $logdir
86  exit 1
87  }
88 fi
89 
90 # Save log files.
91 
92 mv *.log $logdir || exit 1
93 
94 # Save artifacts.
95 
96 mv dunetpc*.bz2 $WORKSPACE/copyBack/ || exit 1
97 mv dune_raw_data*.bz2 $WORKSPACE/copyBack/ || exit 1
98 mv *.txt $WORKSPACE/copyBack/ || exit 1
99 
100 # Clean up.
101 
102 cd $WORKSPACE || exit 1
103 rm -rf $blddir || exit 1
104 
105 exit 0