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