forked from hajs/pylodger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_base.sh
executable file
·80 lines (66 loc) · 1.64 KB
/
build_base.sh
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
#!/bin/bash
set -e -x
DIST=$1
TARGET=$2
function usage() {
echo "Usage: $0 FROM_DISTRIBUTION TARGET"
exit 1
}
if [ "$DIST" = "" ]
then
usage
else
for tool in python conda
do
if [ -f "$DIST/bin/$tool" ]
then
echo "Found $DIST/bin/$tool"
else
echo "Error: Could not find $DIST/bin/$tool"
exit 2
fi
done
fi
if [ "$TARGET" = "" ]
then
usage
else
if [ -d $TARGET ]
then
echo "Warning: Target $TARGET already exists"
fi
fi
# XXX: assume that pkgdir is empty
PKGDIR=$DIST/conda-bld/linux-64/
PYTHON=$DIST/bin/python
CONDA="$PYTHON $DIST/bin/conda"
mkdir -p $TARGET/{pkgs,envs,conda-meta,conda-bld}
for package in system zlib bzip2 openssl ncurses readline sqlite python setuptools distribute pycosat yaml pyyaml conda
do
test -f $PKGDIR/$package*.tar.bz2 || $CONDA build --no-binstar-upload recipes/base/$package
pkgfile=$PKGDIR/$package*.tar.bz2
tar -xj -C $TARGET -f $pkgfile
done
# Fix wrong paths
PLACEHOLDER="/opt/anaconda1anaconda2anaconda3"
for fixfile in $(grep -rl "$PLACEHOLDER" $TARGET/bin)
do
$TARGET/bin/python relocate.py $PLACEHOLDER $TARGET $fixfile
done
# copy created packages
#cp $PKGDIR/*.tar.bz2 $TARGET/pkgs/
for package in system zlib bzip2 openssl ncurses readline sqlite python setuptools distribute pycosat yaml pyyaml conda
do
cp $PKGDIR/${package}*.tar.bz2 $TARGET/pkgs/
done
# reinstall via conda
test -f $HOME/.condarc && cp $HOME/.condarc $HOME/.condarc.$(date +"%Y%m%d%H%M")
echo "
binstar_upload: false
channels:
- file://$(readlink -f $PKGDIR/..)
" > $HOME/.condarc
for pkgfile in $TARGET/pkgs/*.tar.bz2
do
$TARGET/bin/conda install -f -c system $pkgfile
done