summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/conda_porcelain.sh40
-rw-r--r--include/error.sh136
-rwxr-xr-xinclude/midnight_special.sh4
-rw-r--r--include/post-common.sh2
-rw-r--r--include/pre-common.sh2
5 files changed, 179 insertions, 5 deletions
diff --git a/include/conda_porcelain.sh b/include/conda_porcelain.sh
index d4de1b7..f04ee50 100644
--- a/include/conda_porcelain.sh
+++ b/include/conda_porcelain.sh
@@ -2,6 +2,7 @@
source /eng/ssb/auto/astroconda/include/sysinfo.sh
porcelain_continuum_url=https://repo.continuum.io/miniconda
porcelain_continuum_script=Miniconda3-latest-${sysinfo_platform}-${sysinfo_arch}.sh
+porcelain_extra_config=/eng/ssb/auto/astroconda/etc/porcelain-extra
PORCELAIN_ALREADY_DEAD=0
PORCELAIN_SIGNALED=0
@@ -106,6 +107,27 @@ function porcelain_run_installer
echo "Dying..."
exit 1
fi
+
+ # do extraneous package installation
+ porcelain_extra_install
+}
+
+function porcelain_extra_install
+{
+ if [[ -f $porcelain_extra_config ]]; then
+ porcelain_verify
+
+ while read pkg
+ do
+ if [[ $pkg == "" ]]; then
+ continue
+ elif [[ $pkg == "#"* ]]; then
+ continue
+ fi
+
+ conda install -y -q $pkg
+ done < $porcelain_extra_config
+ fi
}
function porcelain_deinit
@@ -129,14 +151,28 @@ function porcelain_deinit
# thourough.
function porcelain_signal
{
+ # Obtain last return value
retval=$?
+
+ # If error.sh recorded errors; use the count instead
+ if [[ -n $_E_COUNT ]] && [[ $_E_COUNT > 0 ]]; then
+ retval=$_E_COUNT
+ fi
+
+ # Already signaled, so die
if [[ $PORCELAIN_SIGNALED != 0 ]]; then
- exit $?
+ exit $retval
+ fi
+
+ # If error.sh has been activated; display error report
+ if [[ -n $_E_FLAGS ]] && [[ $_E_FLAGS != 0 ]]; then
+ echo '----'
+ error_report
fi
export PORCELAIN_SIGNALED=1
porcelain_deinit
- exit $?
+ exit $retval
}
diff --git a/include/error.sh b/include/error.sh
new file mode 100644
index 0000000..dd0ddce
--- /dev/null
+++ b/include/error.sh
@@ -0,0 +1,136 @@
+#!/bin/bash
+
+_E_WIDTH=15
+_E_COUNT=0
+_E_FLAGS=0
+_E_FLAGS_STR=""
+
+_E_FLAG_FAILURE=1
+_E_FLAG_EXIT_STANDARD=2
+_E_FLAG_EXIT_NONSTANDARD=4
+_E_FLAG_EXIT_SIGNALED=8
+_E_FLAG_EXIT_PEBKAC=16
+_E_FLAG_HALT_AND_CATCH_FIRE=32
+_E_FLAG_BAD_ARGUMENT=64
+_E_FLAG_BAD_RETVAL=128
+_E_FLAG_BAD_PACKAGE=256
+_E_FLAG_RES4=512
+_E_FLAG_RES5=1024
+_E_FLAG_RES6=2048
+_E_FLAG_RES7=4096
+_E_FLAG_RES8=8192
+_E_FLAG_RES9=16384
+_E_FLAG_INTERNAL=32768
+#_E_FLAG_UNUSED=65536
+
+function error_mask_report
+{
+ local flags=$1
+
+ for (( i=${_E_WIDTH}; i>=0; i-- ))
+ do
+ (( mask = flags & ( 1 << i ) ))
+ case $mask in
+ $_E_FLAG_FAILURE)
+ echo "Script failed."
+ ;;
+ $_E_FLAG_EXIT_STANDARD)
+ echo "Normal exit."
+ ;;
+ $_E_FLAG_EXIT_NONSTANDARD)
+ echo "Non-standard exit."
+ ;;
+ $_E_FLAG_EXIT_SIGNALED)
+ echo "Recievied signal."
+ ;;
+ $_E_FLAG_EXIT_PEBCAC)
+ echo "Problem exists between keyboard and chair."
+ ;;
+ $_E_FLAG_HALT_AND_CATCH_FIRE)
+ echo "A fatal error occurred."
+ ;;
+ $_E_FLAG_BAD_ARGUMENT)
+ echo "Bad argument."
+ ;;
+ $_E_FLAG_BAD_RETVAL)
+ echo "An external program exited abnormally."
+ ;;
+ $_E_FLAG_BAD_PACKAGE)
+ echo "A package failed to build."
+ ;;
+ $_E_FLAG_RES4)
+ echo "Reserved"
+ ;;
+ $_E_FLAG_RES5)
+ echo "Reserved"
+ ;;
+ $_E_FLAG_RES6)
+ echo "Reserved"
+ ;;
+ $_E_FLAG_RES7)
+ echo "Reserved"
+ ;;
+ $_E_FLAG_RES8)
+ echo "Reserved"
+ ;;
+ $_E_FLAG_RES9)
+ echo "Reserved"
+ ;;
+ $_E_FLAG_INTERNAL)
+ echo "Error handler experienced an internal error."
+ ;;
+ *)
+
+ ;;
+ esac
+ done
+}
+
+function error_report
+{
+ local flags=`error_mask_string`
+ printf "Error count: %16s\n" $_E_COUNT
+ printf "Error mask: %16s\n" $_E_FLAGS
+ printf "Error flags: %16s\n" $flags
+ echo "Error message(s):"
+ while read line
+ do
+ echo "* $line"
+ done< <(error_mask_report $_E_FLAGS)
+}
+
+function error_set
+{
+ local flag=$1
+ if [[ -z $flag ]]; then
+ echo "error.sh: Unable to set error flag: '$flag'"
+ flag=$_E_FLAG_INTERNAL
+ fi
+ (( _E_FLAGS |= $flag ))
+ (( _E_COUNT++ ))
+ #echo "Error flag modified: $_E_FLAGS_STR"
+}
+
+function error_mask_string
+{
+ declare -a -i bits
+ local flags=$_E_FLAGS
+ local output=""
+
+ for i in $(seq 0 $_E_WIDTH)
+ do
+ (( bits[i] = 0 ))
+ (( bit = flags >> i ))
+ if (( flags & ( 1 << i ) )); then
+ (( bits[i] = 1 ))
+ fi
+ done
+
+ for (( x=${_E_WIDTH}; x>=0; x-- ))
+ do
+ output+=$(( bits[x] ))
+ done
+
+ echo $output
+}
+
diff --git a/include/midnight_special.sh b/include/midnight_special.sh
index 5781588..90c3638 100755
--- a/include/midnight_special.sh
+++ b/include/midnight_special.sh
@@ -4,7 +4,9 @@
source /eng/ssb/auto/astroconda/include/host_config.sh
#[[ "$USER" != "" ]] && exec -c $0
-export sm_base="$PWD"
+if [[ -n $sm_run ]]; then
+ export sm_base="$PWD"
+fi
unset $(/usr/bin/env \
| egrep '^(\w+)=(.*)$' \
diff --git a/include/post-common.sh b/include/post-common.sh
index 0ea77b6..c9fb7e1 100644
--- a/include/post-common.sh
+++ b/include/post-common.sh
@@ -30,7 +30,7 @@ export PDK_CONTEXT=$context:${PYTHON_VERSION}
export PDK_LOG="$LOGDIR/${HOSTNAME}-$PDK_TESTRUN"
echo '----'
-echo "Applying SHELL fix (thanks Continnum)..."
+echo "Applying SHELL fix (thanks Continuum)..."
if [[ $SHELL == bash ]]; then
export SHELL=/bin/bash
elif [[ $SHELL == zsh ]]; then
diff --git a/include/pre-common.sh b/include/pre-common.sh
index ac14f6f..9a9ef9b 100644
--- a/include/pre-common.sh
+++ b/include/pre-common.sh
@@ -64,7 +64,7 @@ function svn_update()
pushd "$elem" &>/dev/null
echo "Updating $elem ..."
- svn up --non-interactive --accept theirs-conflict
+ svn up --non-interactive --depth infinity --accept theirs-conflict
popd &>/dev/null
done