Mailinglist Archive: radeonhd (698 mails)

< Previous Next >
[radeonhd] [PATCH] Fix git_version.sh if builddir is subdir of srcdir
  • From: Hans Ulrich Niedermann <hun@xxxxxxxxxxxxxxxx>
  • Date: Fri, 30 Nov 2007 15:30:50 +0100
  • Message-id: <1196433050-362-1-git-send-email-hun@xxxxxxxxxxxxxxxx>
Only accept the found git repo iff it is in our top srcdir, as
determined by comparing absolute pathnames created by running
"pwd" in the respective dir.

Fixes bug introduced in ff796eba:
In srcdir!=builddir builds, if builddir is a subdirectory of srcdir,
"make distcheck" exposes a conflict between the dist tarballs'
git_version.h and the new git_version.h erroneously created while
compiling the source tree from the dist tarball.
---
git_version.sh | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/git_version.sh b/git_version.sh
index cfc5a4a..6f70076 100644
--- a/git_version.sh
+++ b/git_version.sh
@@ -104,6 +104,7 @@ else
fi

# Done with creating output files, so we can change to source dir
+abs_srcdir="$(cd "$srcdir" && pwd)"
cd "$srcdir"

# Write program header
@@ -142,7 +143,11 @@ fi

git_repo=no
# "git-rev-parse --git-dir" since git-0.99.7
-if [ "x$(git-rev-parse --git-dir 2> /dev/null)" != "x" ]; then
+git_repo_dir="$(git-rev-parse --git-dir 2> /dev/null)"
+abs_repo_dir="$(cd "$git_repo_dir" && pwd)"
+# Only accept the found git repo iff it is in our top srcdir, as determined
+# by comparing absolute pathnames creaged by running pwd in the respective dir.
+if [ "x$git_repo_dir" != "x" ] && [ "x${abs_repo_dir}" = "x${abs_srcdir}/.git"
]; then
git_repo=yes
if [ "x$git_found" = "xyes" ]; then
# git-1.4 and probably earlier understand "git-rev-parse HEAD"
--
1.5.3.4

--
To unsubscribe, e-mail: radeonhd+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: radeonhd+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups