Mailinglist Archive: radeonhd (699 mails)

< Previous Next >
[radeonhd] [PATCH 2/4] Fix git_version.sh srcdir==builddir
  • From: Hans Ulrich Niedermann <hun@xxxxxxxxxxxxxxxx>
  • Date: Sun, 4 Nov 2007 02:26:09 +0100
  • Message-id: <1194139571-23458-2-git-send-email-hun@xxxxxxxxxxxxxxxx>
Consequent separation of source tree dir ($srcdir) and working
dir ($working_dir). Fixes imake and automake in-tree builds.
---
git_version.sh | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/git_version.sh b/git_version.sh
index 370dc5b..daf61f1 100644
--- a/git_version.sh
+++ b/git_version.sh
@@ -15,8 +15,10 @@
# The caller may have found these programs for us
EGREP="${EGREP-"grep -E"}"
SED="${SED-sed}"
-GIT_DIR="${GIT_DIR-.git}"
-export GIT_DIR
+
+# Initialize
+GIT_DIR=".git"
+working_dir="$(pwd)"

# Who am I?
self="$(basename "$0")"
@@ -81,6 +83,9 @@ else
exec 1> "${outfile}.new"
fi

+# Done with creating output files, so we can change to source dir
+cd "$srcdir"
+
# Write program header
cat<<EOF
/*
@@ -102,15 +107,15 @@ if [ "x$git_tools" != "x" ]; then
echo ""

# Commit SHA-ID
- git_shaid=`cd "$srcdir" && git-whatchanged | $SED -n '1s/^commit
\(.\{8\}\).*/\1/p'`
+ git_shaid=`git-whatchanged | $SED -n '1s/^commit \(.\{8\}\).*/\1/p'`
echo "/* Git SHA ID of last commit */"
echo "#define GIT_SHAID \"${git_shaid}..\""
echo ""

# Branch -- use git-status instead of git-branch
- git_branch=`cd "$srcdir" && git-status | $SED -n 's/^#\ On\ branch\
\(.*\)/\1/p'`
+ git_branch=`git-status | $SED -n 's/^#\ On\ branch\ \(.*\)/\1/p'`
if [ "x$git_branch" = "x" ]; then
- git_branch=`cd "$srcdir" && git-branch | $SED -n 's/^* //p'`
+ git_branch=`git-branch | $SED -n 's/^* //p'`
fi
if [ "x$git_branch" = "x" ]; then
git_branch="<<unknown/master>>"
@@ -120,7 +125,7 @@ if [ "x$git_tools" != "x" ]; then
echo ""

# Any uncommitted changes we should know about?
- git_uncommitted=`cd "$srcdir" && git-status | $EGREP "(Changed but not
updated|Updated but not checked in|Changes to be committed)"`
+ git_uncommitted=`git-status | $EGREP "(Changed but not updated|Updated
but not checked in|Changes to be committed)"`
if [ "x$git_uncommitted" != "x" ]; then
echo "/* Local changes might be breaking things */"
echo "#define GIT_UNCOMMITTED 1"
@@ -187,6 +192,9 @@ int main(int argc, char *argv[])
EOF
fi

+# Change back to working dir for the remaining output file manipulations.
+cd "$working_dir"
+
# If necessary, overwrite outdated output file with new one
if [ "x$outfile" != "x-" ]
then
--
1.5.3.4

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

< Previous Next >