-
Notifications
You must be signed in to change notification settings - Fork 2
/
build
executable file
·90 lines (81 loc) · 2.77 KB
/
build
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
#!/bin/sh
# Simple wrapper for conda-build that defines the appropriate tag and date for
# internal Gemini package builds.
#
# (If the local date is liable to change between invoking ./checkout & ./build,
# it can be set in the environment prior to running these scripts, but will
# then need updating when building on different days in a persistent session).
deps="conda-build"
# Parse script arguments:
status=1
unset tag conda_args
while [ -n "$1" ]; do
case "$1" in
-h|--help)
conda_args=""
status=0
break
;;
--tag)
if [ -n "$tag" ]; then
status=1
break
fi
shift
tag=$1
;;
*)
val=`echo "$1" | sed -e 's|/*$||'`
if [ -z "$conda_args" ]; then
conda_args=$val
status=0
else
conda_args="${conda_args} $val"
fi
;;
esac
shift
done
if [ -z "$conda_args" -o $status = 1 ]; then
echo "Usage: `basename $0` [-h] [--tag tag] conda_args" >&2
exit $status
fi
# Get common build configuration & parse the version tag:
. ./config || exit 1
# This whole block just decides whether the build path length must be reduced
# to 70 for building Gemini IRAF (otherwise better to stick to 255, allowing
# installation under longer paths). Although dependencies are expanded out here
# to check for "iraf*", conda-build should decide the right order in which (and
# whether) to build them, so is allowed to resolve them again below, for
# generality. The "--prefix-length" option requires conda-build >= 2.1. This
# would be better implemented per-package, as a meta.yaml option for
# conda-build, or failing that by hooking into its dependency resolution.
if conda-build -h | grep -q "\--prefix-length[ \t]"; then
pkg_names=""
for arg in $conda_args; do
case "$arg" in
-*) ;;
*) pkg_names="${pkg_names:+$pkg_names }$arg" ;;
esac
done
get_local_pkgs "$pkg_names"
for arg in $local_pkgs; do
case "$arg" in
iraf*)
conda_args="$conda_args --prefix-length=70"
break
;;
esac
done
else
echo "Warning: conda-build has no --prefix-length option?" >&2
echo " Try \"conda update conda-build\" if IRAF builds fail." >&2
echo >&2
fi
# Delegate the build to conda (recipes pick up tag & DATE from environment).
# Logging while displaying to STDOUT without losing the error status gets
# insanely convoluted (http://www.unix.com/302265010-post3.html), so capture
# the output from this script if needed (which is more modular anyway).
echo "conda-build $conda_args"
conda-build $conda_args || exit 1
exit $status