Patchwork [01/13] configure: Don't create symlinks to nonexistent targets

login
register
mail settings
Submitter Stefan Hajnoczi
Date June 24, 2011, 4:56 p.m.
Message ID <1308934609-20824-2-git-send-email-stefanha@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/101851/
State New
Headers show

Comments

Stefan Hajnoczi - June 24, 2011, 4:56 p.m.
From: Peter Maydell <peter.maydell@linaro.org>

When we create the symlinks to source tree files, don't create them
if the file is not actually present in the source tree; this will
happen if the file is in a git submodule that wasn't checked out.

This also avoids the odd effect where an in-source-tree configure
will end up creating the missing file as a symlink to itself.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 configure |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Patch

diff --git a/configure b/configure
index 856b41e..4fa9a57 100755
--- a/configure
+++ b/configure
@@ -3479,7 +3479,9 @@  for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.rom $source_p
 done
 mkdir -p $DIRS
 for f in $FILES ; do
-    test -e $f || symlink $source_path/$f $f
+    if [ -e "$source_path/$f" ] && ! [ -e "$f" ]; then
+        symlink "$source_path/$f" "$f"
+    fi
 done
 
 # temporary config to build submodules