From 75b32fffb62ecddf67d3855284ee9dd5017789e6 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Sat, 22 Dec 2012 01:19:37 +0100
Subject: [PATCH] Optimise autotools/run-in-tempdir
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

I made a mistake when adding support for htools to run-in-tempdir, by
needlessly copying the htools binaries, when it's enough to link
them. The copying is only really needed for python code, so we change
the Haskell binaries to linking and also a few other directories.

Difference:
- before: 0.8s, 95MB copied
- after: 0.6s, 6.2MB copied

And, by the way, can't wait for Python 2.6 as minimum supported
version…

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 autotools/run-in-tempdir | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/autotools/run-in-tempdir b/autotools/run-in-tempdir
index d5bdb7a06..202844e8f 100755
--- a/autotools/run-in-tempdir
+++ b/autotools/run-in-tempdir
@@ -11,7 +11,7 @@ trap "rm -rf $tmpdir" EXIT
 mkdir $tmpdir/doc
 
 cp -r autotools daemons scripts lib tools test qa $tmpdir
-cp -r doc/examples $tmpdir/doc
+ln -s $PWD/doc/examples $tmpdir/doc
 
 mv $tmpdir/lib $tmpdir/ganeti
 ln -T -s $tmpdir/ganeti $tmpdir/lib
@@ -19,14 +19,14 @@ ln -T -s $tmpdir/ganeti $tmpdir/lib
 mkdir -p $tmpdir/htools $tmpdir/htest
 for hfile in htools ganeti-confd mon-collector; do
   if [ -e htools/$hfile ]; then
-    cp -p htools/$hfile $tmpdir/htools/
+    ln -s $PWD/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/
+    ln -s $PWD/htest/$hfile $tmpdir/htest/
   fi
 done
 
-- 
GitLab