diff options
author | Joseph Hunkeler <jhunk@stsci.edu> | 2015-12-10 20:03:18 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunk@stsci.edu> | 2015-12-10 20:03:18 -0500 |
commit | e2d622813533fe1291da547688c0442a61a4ba21 (patch) | |
tree | f1d08ecef00e6a5326e88a1772c14a188397264d /scripts | |
parent | 1161b681e794ed034f6d43f5995dda71f7fbb5d0 (diff) | |
parent | b004deb0eca736cb844cc927462b9e03e35a8287 (diff) | |
download | cbc-e2d622813533fe1291da547688c0442a61a4ba21.tar.gz |
Merge branch 'master' of bitbucket.org:jhunkeler/cbc1.3.2
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/cbc_functions.inc | 18 | ||||
-rwxr-xr-x | scripts/cbc_monolith | 33 |
2 files changed, 44 insertions, 7 deletions
diff --git a/scripts/cbc_functions.inc b/scripts/cbc_functions.inc index 6713d81..14586a0 100644 --- a/scripts/cbc_functions.inc +++ b/scripts/cbc_functions.inc @@ -36,12 +36,28 @@ function user_choice { } +function pyreadlink { + TARGET="$1" + python -c "import os; print(os.path.realpath('${TARGET}'))" +} + function get_conda_build { _OK=`program_exists conda` if [ ! $_OK ]; then echo '' fi - echo $( echo $( readlink -f $(dirname `which conda`)/../conda-bld ) ) + + get_os_info + case "$OS" in + osx) + pyreadlink $(dirname `which conda`)/../conda-bld + ;; + linux) + readlink -f $(dirname `which conda`)/../conda-bld + ;; + *) + ;; + esac } function get_conda_repo { diff --git a/scripts/cbc_monolith b/scripts/cbc_monolith index c8078dc..a55798c 100755 --- a/scripts/cbc_monolith +++ b/scripts/cbc_monolith @@ -1,6 +1,9 @@ #!/bin/bash EXEC_PATH=$(dirname "${BASH_SOURCE[0]}") source "$EXEC_PATH/cbc_functions.inc" +# declare $OS and $ARCH (don't touch) +get_os_info + LOGFILE="monolith.log" LOGFILE_PREV="$LOGFILE.prev" TMPDIR=/tmp @@ -50,10 +53,22 @@ function build_prepare { function build_prepare_branch() { - # This works, mostly. I need to implement a whitelist for git_url entries. echo Building from branch: $BRANCH CBC_HOME_ORIG="$CBC_HOME" - export CBC_HOME="$(mktemp -u -d)" + + mktemp_args= + case "$OS" in + osx) + export mktemp_args="-d -u -t $(basename $0)" + ;; + linux) + export mktemp_args="-u -d" + ;; + *) + ;; + esac + + export CBC_HOME="$(mktemp $mktemp_args)" mkdir -pv "$CBC_HOME" echo "CBC_HOME=$CBC_HOME" @@ -69,6 +84,11 @@ function build_prepare_branch() # Redundant code alert... ugh (WILL FIX) + is_osx= + if [[ $OS == "osx" ]]; then + export is_osx=".orig" + fi + if [ -n "$BRANCH_MANIFEST" ]; then while read pattern do @@ -78,8 +98,8 @@ function build_prepare_branch() _OK=`success` if [ $_OK -eq 0 ]; then echo "Applying branch: $BRANCH -> $(dirname $f)" - sed -i 's|git_tag|#git_tag|g' "$f" >/dev/null - sed -i "/git_url/ a \ \ \ \ git_tag: '$BRANCH'" "$f" >/dev/null + sed -i$is_osx 's|git_tag|#git_tag|g' "$f" >/dev/null + sed -i$is_osx "/git_url/ a \ \ \ \ git_tag: '$BRANCH'" "$f" >/dev/null fi done done < "$BRANCH_MANIFEST" @@ -90,8 +110,8 @@ function build_prepare_branch() _OK=`success` if [ $_OK -eq 0 ]; then echo "Applying branch $BRANCH -> $(dirname $f)" - sed -i 's|git_tag|#git_tag|g' "$f" >/dev/null - sed -i "/git_url/ a \ \ \ \ git_tag: '$BRANCH'" "$f" >/dev/null + sed -i$is_osx 's|git_tag|#git_tag|g' "$f" >/dev/null + sed -i$is_osx "/git_url/ a \ \ \ \ git_tag: '$BRANCH'" "$f" >/dev/null fi done fi @@ -227,6 +247,7 @@ do shift done + # DO NOT LOG THIS... build_prepare build_restart |