# these bugs' fates are intertwined. I hope it's all right to merge them.
severity 521724 important
merge 521724 520116
thanks

Perhaps the attached patch (plus adding NO_BINDIR_EXECDIR_LINK=1 to
OPTS in debian/rules) could help.

Regards,
Jonathan
From d96ca582723d3709f29e0ff04766d5b0e1ad1194 Mon Sep 17 00:00:00 2001
From: Jonathan Nieder <jrnie...@gmail.com>
Date: Thu, 2 Apr 2009 20:37:13 -0500
Subject: [PATCH] Makefile: Add option to avoid installing cross-directory links

Currently we decide whether to hardlink /usr/bin/git to
/usr/libexec/git-core/git-add by just trying and seeing whether
it works.  Thus the hard link is created only if bindir and
gitexecdir are on the same device on the installer's system.
Unfortunately, the heuristic fails when distributors install git
with DESTDIR set to a temporary directory.  The hardlink is
created in the distributor's package regardless of whether it can
be created on the eventual user's system.

This patch adds a new makefile variable NO_BINDIR_EXECDIR_LINK
for distributors to use to avoid hardlinking files in different
directories.

Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
---
 Makefile |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 7867eac..2d886d9 100644
--- a/Makefile
+++ b/Makefile
@@ -197,6 +197,9 @@ STRIP ?= strip
 # runtime figures out where they are based on the path to the executable.
 # This can help installing the suite in a relocatable way.
 
+# Define NO_BINDIR_EXECDIR_LINK if you might be relocating the installation
+# to a system with /usr/bin and /usr/lib on different devices.
+
 prefix = $(HOME)
 bindir_relative = bin
 bindir = $(prefix)/$(bindir_relative)
@@ -215,6 +218,7 @@ ETC_GITCONFIG = etc/gitconfig
 endif
 lib = lib
 # DESTDIR=
+# NO_BINDIR_EXECDIR_LINK = YesPlease
 
 # default configuration for gitweb
 GITWEB_CONFIG = gitweb_config.perl
@@ -1502,11 +1506,15 @@ endif
 ifneq (,$X)
        $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) 
git$X)), $(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)
 endif
+ifndef NO_BINDIR_EXECDIR_LINK
        bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
        execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
        { $(RM) "$$execdir/git-add$X" && \
                ln "$$bindir/git$X" "$$execdir/git-add$X" 2>/dev/null || \
-               cp "$$bindir/git$X" "$$execdir/git-add$X"; } && \
+               cp "$$bindir/git$X" "$$execdir/git-add$X"; }
+endif
+       bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
+       execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
        { for p in $(filter-out git-add$X,$(BUILT_INS)); do \
                $(RM) "$$execdir/$$p" && \
                ln "$$execdir/git-add$X" "$$execdir/$$p" 2>/dev/null || \
-- 
1.6.2.96.gc65e7

Reply via email to