-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrebuild.sh.template
87 lines (71 loc) · 2.22 KB
/
rebuild.sh.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# stop in case of trouble
set -e
# Re-execute within a docker container, if requested
if [[ ! -z $REBUILD_RECIPES_IN_CONTAINER ]]; then
# export REBUILD_RECIPES_IN_CONTAINER="docker run --rm -it -v $HOME:$HOME --hostname "conda-centos5" centos5-host"
echo "Re-executing in container using: $REBUILD_RECIPES_IN_CONTAINER bash $BASH_SOURCE $@"
exec /usr/bin/env REBUILD_RECIPES_IN_CONTAINER= $REBUILD_RECIPES_IN_CONTAINER bash $BASH_SOURCE "$@"
exit -1
fi
# change into script directory
cd "$(dirname $BASH_SOURCE)"
# the name of the current platform (Linux or Darwin)
PLATFORM=$(uname)
log-output()
{
# Starting with v4.1.0, conda began sending output to the
# terminal (tty) instead of stdout. We use the 'script' command
# to capture it.
# Account for GNU vs. BSD differences in the script command
if [[ $OSTYPE == darwin* ]]; then
# OS X flavor of script
script -q "$@" > /dev/null 2>&1
else
# Linux flavor of script
OUTFILE="$1"
shift
# Assuming RHEL5-compatible version of script
# Using a more modern version, all of the below could be replaced
# with something like:
# script -e -q -c "$*" $OUTFILE > /dev/null 2>&1
SUCCFILE=$(mktemp succfile.XXXXXXX)
rm -f "$SUCCFILE"
script -q -c "$* && touch \"$SUCCFILE\"" $OUTFILE > /dev/null 2>&1
[[ -f "$SUCCFILE" ]] && rm -f "$SUCCFILE" || /bin/false
fi
}
rebuild()
{
# Conda name/version
PACKAGE="$1"
VERSION="$2"
# EUPS name/version
PRODUCT="$3"
PRODUCT_VERSION="$4"
pushd "$PACKAGE" > /dev/null
if [[ ! -f .done && ! -f .skip.$PLATFORM ]]; then
echo -n " $PACKAGE"
if [[ "$PRODUCT" != None ]]; then
echo -n " (ver $VERSION) [from $PRODUCT-$PRODUCT_VERSION] ... "
else
echo -n " (ver $VERSION) [from static recipe] ... "
fi
if log-output _build.log conda build .; then
touch .done
echo 'OK'
else
echo 'ERROR'
echo 'Last 20 lines from the log file:'
echo "========================================================================"
tail -n 20 _build.log
echo "========================================================================"
echo "The complete build log is in $PWD/_build.log"
exit -1
fi
fi
popd > /dev/null
}
# this is where rebuild calls will get inserted
%(rebuilds)s
echo "done."