From: Junio C Hamano Date: Sun, 26 Apr 2009 05:05:45 +0000 (-0700) Subject: Allow multi-arch installation X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=936a95a091236c64063510d2b58837e544e4506c;p=thirdparty%2Fgit.git Allow multi-arch installation --- diff --git a/Dothem b/Dothem index d05aefa62c..2a0ec01347 100755 --- a/Dothem +++ b/Dothem @@ -2,6 +2,20 @@ NWD=contrib/workdir/git-new-workdir +inst_prefix=$( + IFS=: + for p in $PATH + do + probed=${p%/git-active/bin} + if test "$probed" != "$p" + then + echo "$probed" + exit + fi + done + echo $HOME +) + force= with_dash= M= install= nodoc= bootstrap= branches= jobs= while case "$1" in --pedantic) M="$M $1" ;; @@ -21,7 +35,7 @@ do shift done test -f /bin/dash || with_dash= -test -n "$BUILDBASE" || BUILDBASE=../buildfarm +test -n "$BUILDBASE" || BUILDBASE=$inst_prefix/buildfarm test -n "$branches" || branches='next master maint pu jch' test -n "$jobs" || jobs=-j2 @@ -50,8 +64,8 @@ do private=$(git rev-parse -q --verify private-$branch 2>/dev/null) case $? in 0|1) ;; *) exit $? ;; esac - if test -f "$HOME/git-$branch/bin/git" && - installed=$($HOME/git-$branch/bin/git version) && + if test -f "$inst_prefix/git-$branch/bin/git" && + installed=$($inst_prefix/git-$branch/bin/git version) && if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$') then : diff --git a/Make b/Make index afef94ae26..98bc272c8c 100755 --- a/Make +++ b/Make @@ -1,45 +1,33 @@ #!/bin/sh -# DDD=' -DUSE_SYMLINK_HEAD=0' -# PATH=/usr/bin:/bin - G=/opt/packrat/playpen/public/in-place/git/index/gitweb_config.perl -for i in active maint master next -do - GIT="$HOME/git-$i/bin/git" - test -f "$GIT" && break -done -test -f "$GIT" || { + +case "$(git version 2>/dev/null)" in +"git version"*) + GIT=git ;; +*) echo >&2 "No git to bootstrap" -} -PATH=/usr/bin:/bin -export PATH + exit 1 ;; +esac + +inst_prefix=$( + IFS=: + for p in $PATH + do + probed=${p%/git-active/bin} + if test "$probed" != "$p" + then + echo "$probed" + exit + fi + done + echo $HOME +) LANG=C old_style_def_fix=b79d18c92d9f4841a6a1a29b7b2373a8ff9871e1 -head=`$GIT symbolic-ref HEAD 2>/dev/null` && -branch=`expr "$head" : 'refs/heads/\(.*\)'` || branch=detached - -case "$branch" in -next | maint | master | pu | jch) - prefix="$HOME/git-$branch" - ;; -snap) - v=`$GIT describe HEAD` - expr "$v" : '.*-g[0-9a-f]*$' >/dev/null && { - echo >&2 "You are on 'snap' but $v is not an official version." - exit 1 - } - prefix="$HOME/git-snap-$v" - ;; -*) - prefix="$HOME/git-test" ;; -esac -d="prefix=$prefix" - : ${O=-O2} - Wall=-Wall tests= while case $# in 0) break ;; esac do @@ -87,6 +75,26 @@ done LC_ALL=$LANG export LANG LC_ALL +head=`$GIT symbolic-ref HEAD 2>/dev/null` && +branch=`expr "$head" : 'refs/heads/\(.*\)'` || branch=detached + +case "$branch" in +next | maint | master | pu | jch) + prefix="$inst_prefix/git-$branch" + ;; +snap) + v=`$GIT describe HEAD` + expr "$v" : '.*-g[0-9a-f]*$' >/dev/null && { + echo >&2 "You are on 'snap' but $v is not an official version." + exit 1 + } + prefix="$inst_prefix/git-snap-$v" + ;; +*) + prefix="$inst_prefix/git-test" ;; +esac +d="prefix=$prefix" + sh -c 'git describe --abbrev=4 HEAD' >/dev/null 2>&1 || { $GIT describe --abbrev=4 HEAD | sed -e 's/-/./g' >version } diff --git a/V b/V index 866ddc251b..e4d15c9a2e 100755 --- a/V +++ b/V @@ -1,8 +1,25 @@ #!/bin/sh +inst_prefix=$( + IFS=: + for p in $PATH + do + probed=${p%/git-active/bin} + if test "$probed" != "$p" + then + echo "$probed" + exit + fi + done + echo $HOME +) + for v in maint master next pu jch do - installed=$($HOME/git-$v/bin/git version) + installed=$( + test -f "$inst_prefix/git-$v/bin/git" && + "$inst_prefix/git-$v/bin/git" version + ) dirty= if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$') then