Make build_chroot self-contained
[ganeti-local] / autotools / run-in-tempdir
index d5bdb7a..3c1a79b 100755 (executable)
@@ -8,25 +8,29 @@ set -e
 tmpdir=$(mktemp -d -t gntbuild.XXXXXXXX)
 trap "rm -rf $tmpdir" EXIT
 
-mkdir $tmpdir/doc
-
-cp -r autotools daemons scripts lib tools test qa $tmpdir
-cp -r doc/examples $tmpdir/doc
+# fully copy items
+cp -r autotools daemons scripts lib tools qa $tmpdir
+
+if [[ -z "$COPY_DOC" ]]; then
+  mkdir $tmpdir/doc
+  ln -s $PWD/doc/examples $tmpdir/doc
+else
+  # Building documentation requires all files
+  cp -r doc $tmpdir
+fi
+
+mkdir $tmpdir/test/
+cp -r test/py $tmpdir/test/py
+ln -s $PWD/test/data $tmpdir/test
+ln -s $PWD/test/hs $tmpdir/test
 
 mv $tmpdir/lib $tmpdir/ganeti
 ln -T -s $tmpdir/ganeti $tmpdir/lib
 
-mkdir -p $tmpdir/htools $tmpdir/htest
+mkdir -p $tmpdir/src $tmpdir/test/hs
 for hfile in htools ganeti-confd mon-collector; do
-  if [ -e htools/$hfile ]; then
-    cp -p htools/$hfile $tmpdir/htools/
-  fi
-done
-
-for hfile in hpc-htools test offline-test.sh cli-tests-defs.sh \
-  hbal hscan hspace hinfo hcheck hail hroller hpc-mon-collector; do
-  if [ -e htest/$hfile ]; then
-    cp -p htest/$hfile $tmpdir/htest/
+  if [ -e src/$hfile ]; then
+    ln -s $PWD/src/$hfile $tmpdir/src/
   fi
 done