root / autotools / run-in-tempdir @ 44e08911
History | View | Annotate | Download (819 Bytes)
1 |
#!/bin/bash |
---|---|
2 |
|
3 |
# Helper for running things in a temporary directory; used for docs |
4 |
# building, unittests, etc. |
5 |
|
6 |
set -e |
7 |
|
8 |
tmpdir=$(mktemp -d -t gntbuild.XXXXXXXX) |
9 |
trap "rm -rf $tmpdir" EXIT |
10 |
|
11 |
# fully copy items |
12 |
cp -r autotools daemons scripts lib tools qa $tmpdir |
13 |
|
14 |
if [[ -z "$COPY_DOC" ]]; then |
15 |
mkdir $tmpdir/doc |
16 |
ln -s $PWD/doc/examples $tmpdir/doc |
17 |
else |
18 |
# Building documentation requires all files |
19 |
cp -r doc $tmpdir |
20 |
fi |
21 |
|
22 |
mkdir $tmpdir/test/ |
23 |
cp -r test/py $tmpdir/test/py |
24 |
ln -s $PWD/test/data $tmpdir/test |
25 |
ln -s $PWD/test/hs $tmpdir/test |
26 |
|
27 |
mv $tmpdir/lib $tmpdir/ganeti |
28 |
ln -T -s $tmpdir/ganeti $tmpdir/lib |
29 |
|
30 |
mkdir -p $tmpdir/src $tmpdir/test/hs |
31 |
for hfile in htools ganeti-confd mon-collector; do |
32 |
if [ -e src/$hfile ]; then |
33 |
ln -s $PWD/src/$hfile $tmpdir/src/ |
34 |
fi |
35 |
done |
36 |
|
37 |
cd $tmpdir && GANETI_TEMP_DIR="$tmpdir" "$@" |