Skip to contentSkip to conversation

configure: Don't create symlinks to nonexistent targets

PATCH Applied Peter Maydell 2 participants 3 messages Jun 3, 2011 – Jun 22, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 configure: Don't create symlinks to nonexistent targets

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.

---
v1->v2: remove debug printing
v2->v3: don't use test constructs marked by POSIX as obsolete, as pointed out by Paolo Bonzini

 configure |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
configure +3 -1
index a318d37..7f8ad24 100755
@@ -3564,7 +3564,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
Signature · 1 line
1.7.1
#1 lore raw

ping?

I didn't cc trivial first time round on the theory that any patch that makes it to v3 isn't trivial, but since nobody's commented on this version I guess it's OK...

-- PMM

Quoted 33 lines · Peter Maydell

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.

---
v1->v2: remove debug printing
v2->v3: don't use test constructs marked by POSIX as obsolete, as pointed out by Paolo Bonzini

 configure |    4 +++-

 1 files changed, 3 insertions(+), 1 deletions(-)
configure +0 -0
index a318d37..7f8ad24 100755
@@ -3564,7 +3564,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
--
1.7.1
#2 lore raw
In reply to Peter Maydell
Quoted 7 lines · Peter Maydell

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.

Quoted 8 lines

---
v1->v2: remove debug printing
v2->v3: don't use test constructs marked by POSIX as obsolete, as pointed out by Paolo Bonzini

 configure |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Tested here and you've addressed review comments.

Thanks, applied to the trivial patches tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches

Stefan