NRG Admin  committed 97a2857

Added ability to clone cnda_scripts dir if doesn't already exist. Fixed email message format.

  • Participants
  • Parent commits 59d7598

Comments (0)

Files changed (3)

File buildScripts/

 CURDATE_FILE=`echo ${CURDATE} | sed -e 's/\//-/g'`
 # Where should the build be run
-export BUILDPATH=${CURDIR}/tmp
+export BUILDPATH=/tmp/build_cnda-dev-daily
 # Pipeline directory
 export PIPELINE_HOME=${BUILDPATH}/xnat/pipeline
 export LASTBUILDDATE_FILE=`echo ${LASTBUILDDATE} | sed -e 's/\//-/g'`

File buildScripts/

 # Set change file to be mailed when build is complete
 echo Updates to ${HOSTNAME} for ${CURDATE} > ${MAILFILE}
+echo "" > ${MAILFILE}
 # Create CNDA merge repo 
 mergeRepo ${MERGE_CNDA_REPO}

File buildScripts/

 if [ -s ./ ]; then
    export CURDIR=`pwd`
-   source ./
+   source ./ || die "Variable initialization failed."
    export HOSTNAME=`hostname | cut -d'.' -f1`
    export CURDIR="/home/SGE/cnda/cnda_build/${HOSTNAME}"
-   source ${CURDIR}/
+   source ${CURDIR}/ || die "Variable initialization failed."
+echo Running from directory: ${CURDIR} 
 # If an error occurs, this method outputs the error and ends the script
   echo >&2 "$@"
 # Clean-up the build env
 echo removing ${BUILDPATH}
-rm -rf ${BUILDPATH} 
+rm -rf ${BUILDPATH} || die "Build directory could not be removed" 
 mkdir ${BUILDPATH} || die "This directory should have been deleted in the previous step."
 # Retrieve the latest build scripts
-cd ${CURDIR}/cnda_scripts
-hg fetch
-cd ..
-cp -rf ${CURDIR}/cnda_scripts/buildScripts/ .
+if [ ! -d ${CURDIR}/cnda_scripts ]; then
+  cd ${CURDIR}
+  hg clone ${BUILD_SCRIPT_REPO} 
+  cd ${CURDIR}/cnda_scripts
+  hg fetch
+  cd ${CURDIR} 
+#cp -rf ${CURDIR}/cnda_scripts/buildScripts/ .
 #cp -rf ${CURDIR}/cnda_scripts/buildScripts/ ./
-cp -rf ${CURDIR}/cnda_scripts/buildScripts/ .
-cp -rf ${CURDIR}/cnda_scripts/buildScripts/ .
-dos2unix *.sh
-chmod +x *.sh
-# Set paths and shared functions
-echo "Initializing variables"
-source ${CURDIR}/ || die "Variable initialization failed"
+#cp -rf ${CURDIR}/cnda_scripts/buildScripts/ .
+#cp -rf ${CURDIR}/cnda_scripts/buildScripts/ .
+#dos2unix *.sh
+#chmod +x *.sh
 # Run the repository merge
 echo "Merging code"
   # Post or send build notification
   cd /home/SGE/cnda/james
-  ./send_file ${MAILFILE} ${EMAIL_ADDRESS} 
+  ./send_file ${MAILFILE} ${EMAIL_ADDRESS} ${HOSTNAME} 
   # send ${CURDIR}/${LOGDIR}/changes_${MERGE_XDAT_REPO}_${CURDATE_FILE}.log
   # send ${CURDIR}/${LOGDIR}/changes_${MERGE_XNAT_REPO}_${CURDATE_FILE}.log