-
Notifications
You must be signed in to change notification settings - Fork 2
/
distribute
executable file
·104 lines (92 loc) · 2.82 KB
/
distribute
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
#!/bin/sh
# Copy built packages to a shared "channel" directory (after running ./build;
# only used on primary build OSs, to avoid duplicate architecture collisions).
#
# Only one instance at a time should be run on any given machine, due to a
# conda-build bug (retry warning goes to stdout instead of stderr), or for a
# given tag & platform (eg. linux-64), to avoid package copy collisions.
deps="conda-build conda-index"
# Parse script arguments:
status=1
index=1
unset tag pkg_names
while [ -n "$1" ]; do
case "$1" in
-h|--help)
conda_args=""
status=0
break
;;
--no-index)
index=""
;;
--tag)
if [ -n "$tag" ]; then
status=1
break
fi
shift
tag=$1
;;
-*)
status=1
break
;;
*)
val=`echo "$1" | sed -e 's|/*$||'`
if [ -z "$pkg_names" ]; then
pkg_names=$val
status=0
else
pkg_names="${pkg_names} $val"
fi
;;
esac
shift
done
if [ -z "$pkg_names" -o $status = 1 ]; then
echo "Usage: `basename $0` [-h] [--no-index] [--tag tag] recipes" >&2
exit $status
fi
# Get common build configuration & parse the version tag:
. ./config || exit 1
# Parse the conda platform from "conda info" and determine the corresponding
# channel subdirectory:
get_platform || exit 1
dest="$PKGDIR/gemini/$platform" # make public/gemini into a parameter?
mkdir -p "$dest" || exit 1
# Augment the list of requested recipes with their internal dependencies
# (which conda should also have built in turn):
if ! get_local_pkgs "$pkg_names"; then
echo "Failed to parse local deps from recipe meta.yaml file(s)" >&2
exit 1
fi
# Ask conda for the paths to the packages it should have built above and copy
# them to a shared collection.
if pkgs=`conda-build --output $local_pkgs`; then # chokes stdout on collisions
for pkg in $pkgs; do
fname=`basename "$pkg"`
if cp -pf "$pkg" "$dest/"; then
echo "Copied $fname"
elif [ ! -r "$pkg" -a -r "$dest/$fname" ]; then
echo "Re-used $fname" # (picked up from channel, not rebuilt)
else
# echo "Failed to copy $pkg to $dest" >&2 # no: propagate cp error
status=1
fi
done
else
echo "Failed to determine package paths from:" >&2
echo " conda-build --output $local_pkgs" >&2
status=1
fi
# Re-generate the channel index for the appropriate platform, if requested:
if [ -n "$index" ]; then
if ! conda-index "$dest"; then
echo "Failed to re-generate channel index for $platform"
status=1
fi
fi
# To do:
# - Use this step for public builds as well.
exit $status