blob: 0d6dcce9accbc7f57cc78e4fa95079387f521226 (
plain) (
blame)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
#!/bin/bash
EXEC_PATH=$(dirname "${BASH_SOURCE[0]}")
source "$EXEC_PATH/cbc_functions.inc"
LOGFILE="monolith.log"
LOGFILE_PREV="$LOGFILE.prev"
start_pos=
PYTHON_VERSION="3.4"
NUMPY_VERSION="1.9"
function usage {
echo "usage: $(basename $0) {manifest} [-pnco]
manifest List of recipes to build (in order)
--python -p Version to pass to conda-build
--numpy -n Version to pass to conda-build
--cbc-recipes -c Path to CBC recipes directory
--cbc-output-dir -o Path to CONDA recipes
"
}
function build_restart {
if [ -f "$LOGFILE" ]; then
echo "Build restarting..."
cp -av "$LOGFILE" $LOGFILE.prev
sync
export start_pos=$(tail -n 1 "$LOGFILE_PREV" | tr -d ' ')
fi
}
function build_prepare {
echo "Translating CBC recipes..."
cbc_build --no-build $(echo $CBC_RECIPES/*/*.ini)
_OK=`success`
if [ $_OK -ne 0 ]; then
echo "Something went wrong with cbc_build..."
exit 1
fi
}
function build() {
CWD=`pwd`
while read recipe
do
if [ -n "$start_pos" ]; then
if [[ $recipe != $start_pos ]]; then
echo "Skipping: $recipe"
continue
else
# Iterate through remaining recipes
unset start_pos
fi
fi
cd "$CBC_HOME"
conda build \
--no-binstar-upload \
--python $PYTHON_VERSION \
--numpy $NUMPY_VERSION \
--override-channels -c defaults "$recipe"
_OK=`success`
if [ $_OK -ne 0 ]; then
echo
echo "Monolithic build failure..."
echo "Cause:"
echo " $recipe"
cd "$CWD"
exit $_OK
fi
done < "$MANIFEST"
cd "$CWD"
}
function bad_arg {
usage
echo "Bad argument: $@"
exit 1
}
ARGC="${#}"
if [[ ${ARGC} < 1 ]]; then
usage
exit 1
fi
MANIFEST="$1"
if [ ! -f "$MANIFEST" ]; then
echo "\"$MANIFEST\" does not exist."
exit 1
fi
# MAIN
shift
while [ $# -gt 0 ];
do
case "$1" in
'')
usage
exit 1
;;
--python|-p)
PYTHON_VERSION="$2"
if [ -z "$PYTHON_VERSION" ]; then
bad_arg "Missing python version."
fi
shift
;;
--numpy|-n)
NUMPY_VERSION="$2"
if [ -z "$NUMPY_VERSION" ]; then
bad_arg "Missing numpy version."
fi
shift
;;
--cbc-recipes|-c)
CBC_RECIPES="$2"
if [ -z "$CBC_RECIPES" ]; then
bad_arg "Missing recipe directory."
fi
shift
;;
--cbc-output-dir|-o)
CBC_HOME="$2"
if [ -z "$CBC_HOME" ]; then
bad_arg "Missing conda recipe directory."
fi
shift
;;
*)
echo "Unknown option: $1"
usage
exit 1
;;
esac
shift
done
# DO NOT LOG THIS...
build_prepare
build_restart
# LOG THIS
( build ) 2>&1 | tee "$LOGFILE"
|