All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Makefile: create an install-symlinks target
@ 2007-07-29 21:26 David Kastrup
  2007-07-29 21:27 ` [PATCH] Makefile: use $(FIND) instead of find David Kastrup
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: David Kastrup @ 2007-07-29 21:26 UTC (permalink / raw)
  To: git

[commit text mostly pinched from INSTALL]

An alternative global installation method making it much easier to
uninstall is to use a package-specific prefix like /opt/git, then
create symlinks from /usr/local into that hierarchy.  Uninstalling can
then be achieved by

	# rm -rf /opt/git; find /usr/local -xtype l -delete

You can create a setup like that after having used one of the above
install recipes with prefix=/opt/git by writing

	# make prefix=/opt/git symlinkprefix=/usr/local install-symlinks

This works by copying the directory hierarchy of $prefix to
$symlinkprefix (not copying or descending to any directories of the
name git* matched case-insensitively), then linking all the rest.

Signed-off-by: David Kastrup <dak@gnu.org>
---
 INSTALL  |   12 ++++++++++++
 Makefile |   10 +++++++++-
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/INSTALL b/INSTALL
index 79e71b6..22df145 100644
--- a/INSTALL
+++ b/INSTALL
@@ -21,6 +21,18 @@ set up install paths (via config.mak.autogen), so you can write instead
 	$ make all doc ;# as yourself
 	# make install install-doc ;# as root
 
+An alternative global installation method making it much easier to
+uninstall is to use a package-specific prefix like /opt/git, then
+create symlinks from /usr/local into that hierarchy.  Uninstalling can
+then be achieved by
+
+	# rm -rf /opt/git; find /usr/local -xtype l -delete
+
+You can create a setup like that after having used one of the above
+install recipes with prefix=/opt/git by writing
+
+	# make prefix=/opt/git symlinkprefix=/usr/local install-symlinks
+
 
 Issues of note:
 
diff --git a/Makefile b/Makefile
index 73b487f..87b317f 100644
--- a/Makefile
+++ b/Makefile
@@ -142,6 +142,7 @@ ALL_LDFLAGS = $(LDFLAGS)
 STRIP ?= strip
 
 prefix = $(HOME)
+symlinkprefix = /usr/local
 bindir = $(prefix)/bin
 gitexecdir = $(bindir)
 sharedir = $(prefix)/share
@@ -692,6 +693,7 @@ bindir_SQ = $(subst ','\'',$(bindir))
 gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
 template_dir_SQ = $(subst ','\'',$(template_dir))
 prefix_SQ = $(subst ','\'',$(prefix))
+symlinkprefix_SQ = $(subst ','\'',$(symlinkprefix))
 
 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
@@ -996,7 +998,13 @@ install-doc:
 quick-install-doc:
 	$(MAKE) -C Documentation quick-install
 
-
+# The somewhat strange looking lines start with an ignored $(MAKE) in
+# order to be executed also in make -n calls.
+install-symlinks:
+	@: $(MAKE) && echo cd '$(prefix_SQ)' && cd '$(prefix_SQ)' && find . -type d ! \( -iname 'git*' -prune \) -exec echo $(INSTALL) -m 755 -d '$(symlinkprefix_SQ)/{}' \;
+	@cd '$(prefix_SQ)' && find . -type d ! \( -iname 'git*' -prune \) -exec $(INSTALL) -m 755 -d '$(symlinkprefix_SQ)/{}' \;
+	@: $(MAKE) && echo cd '$(prefix_SQ)' && cd '$(prefix_SQ)' && find . \( -type d -iname 'git*' -prune -o ! -type d \) -exec echo $(RM) -r '$(symlinkprefix_SQ)/{}' \; -exec echo ln -s '$(prefix_SQ)/{}' '$(symlinkprefix_SQ)/{}' \;
+	@cd '$(prefix_SQ)' && find . \( -type d -iname 'git*' -prune -o ! -type d \) -exec $(RM) -r '$(symlinkprefix_SQ)/{}' \; -exec ln -s '$(prefix_SQ)/{}' '$(symlinkprefix_SQ)/{}' \;
 
 ### Maintainer's dist rules
 
-- 
1.5.3.rc2.84.g6497

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] Makefile: use $(FIND) instead of find
  2007-07-29 21:26 [PATCH] Makefile: create an install-symlinks target David Kastrup
@ 2007-07-29 21:27 ` David Kastrup
  2007-07-29 22:22   ` Junio C Hamano
  2007-07-29 22:15 ` [PATCH] Makefile: create an install-symlinks target Junio C Hamano
  2007-07-29 22:26 ` Peter Baumann
  2 siblings, 1 reply; 7+ messages in thread
From: David Kastrup @ 2007-07-29 21:27 UTC (permalink / raw)
  To: git

Some people might prefer to be able to specify the find utility to
use, in particular for the more complicated usage in the
install-symlinks target.

Signed-off-by: David Kastrup <dak@gnu.org>
---
 Makefile |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 87b317f..29dfdeb 100644
--- a/Makefile
+++ b/Makefile
@@ -178,6 +178,7 @@ AR = ar
 RM = rm -f
 TAR = tar
 INSTALL = install
+FIND = find
 RPMBUILD = rpmbuild
 TCL_PATH = tclsh
 TCLTK_PATH = wish
@@ -905,11 +906,11 @@ doc:
 
 TAGS:
 	$(RM) TAGS
-	find . -name '*.[hcS]' -print | xargs etags -a
+	$(FIND) . -name '*.[hcS]' -print | xargs etags -a
 
 tags:
 	$(RM) tags
-	find . -name '*.[hcS]' -print | xargs ctags -a
+	$(FIND) . -name '*.[hcS]' -print | xargs ctags -a
 
 ### Detect prefix changes
 TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
@@ -1001,10 +1002,10 @@ quick-install-doc:
 # The somewhat strange looking lines start with an ignored $(MAKE) in
 # order to be executed also in make -n calls.
 install-symlinks:
-	@: $(MAKE) && echo cd '$(prefix_SQ)' && cd '$(prefix_SQ)' && find . -type d ! \( -iname 'git*' -prune \) -exec echo $(INSTALL) -m 755 -d '$(symlinkprefix_SQ)/{}' \;
-	@cd '$(prefix_SQ)' && find . -type d ! \( -iname 'git*' -prune \) -exec $(INSTALL) -m 755 -d '$(symlinkprefix_SQ)/{}' \;
-	@: $(MAKE) && echo cd '$(prefix_SQ)' && cd '$(prefix_SQ)' && find . \( -type d -iname 'git*' -prune -o ! -type d \) -exec echo $(RM) -r '$(symlinkprefix_SQ)/{}' \; -exec echo ln -s '$(prefix_SQ)/{}' '$(symlinkprefix_SQ)/{}' \;
-	@cd '$(prefix_SQ)' && find . \( -type d -iname 'git*' -prune -o ! -type d \) -exec $(RM) -r '$(symlinkprefix_SQ)/{}' \; -exec ln -s '$(prefix_SQ)/{}' '$(symlinkprefix_SQ)/{}' \;
+	@: $(MAKE) && echo cd '$(prefix_SQ)' && cd '$(prefix_SQ)' && $(FIND) . -type d ! \( -iname 'git*' -prune \) -exec echo $(INSTALL) -m 755 -d '$(symlinkprefix_SQ)/{}' \;
+	@cd '$(prefix_SQ)' && $(FIND) . -type d ! \( -iname 'git*' -prune \) -exec $(INSTALL) -m 755 -d '$(symlinkprefix_SQ)/{}' \;
+	@: $(MAKE) && echo cd '$(prefix_SQ)' && cd '$(prefix_SQ)' && $(FIND) . \( -type d -iname 'git*' -prune -o ! -type d \) -exec echo $(RM) -r '$(symlinkprefix_SQ)/{}' \; -exec echo ln -s '$(prefix_SQ)/{}' '$(symlinkprefix_SQ)/{}' \;
+	@cd '$(prefix_SQ)' && $(FIND) . \( -type d -iname 'git*' -prune -o ! -type d \) -exec $(RM) -r '$(symlinkprefix_SQ)/{}' \; -exec ln -s '$(prefix_SQ)/{}' '$(symlinkprefix_SQ)/{}' \;
 
 ### Maintainer's dist rules
 
-- 
1.5.3.rc2.84.g6497

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Makefile: create an install-symlinks target
  2007-07-29 21:26 [PATCH] Makefile: create an install-symlinks target David Kastrup
  2007-07-29 21:27 ` [PATCH] Makefile: use $(FIND) instead of find David Kastrup
@ 2007-07-29 22:15 ` Junio C Hamano
  2007-07-29 22:30   ` David Kastrup
  2007-07-29 22:26 ` Peter Baumann
  2 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2007-07-29 22:15 UTC (permalink / raw)
  To: David Kastrup; +Cc: git

I thought we already rejected the "install symlink" in the
earlier round.  Am I mistaken, or are there any compelling new
reasons to revisit it?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Makefile: use $(FIND) instead of find
  2007-07-29 21:27 ` [PATCH] Makefile: use $(FIND) instead of find David Kastrup
@ 2007-07-29 22:22   ` Junio C Hamano
  0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2007-07-29 22:22 UTC (permalink / raw)
  To: David Kastrup; +Cc: git

Will apply excluding the install-symlinks bit.  The $(FIND)
thing is a good idea independently.  Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Makefile: create an install-symlinks target
  2007-07-29 21:26 [PATCH] Makefile: create an install-symlinks target David Kastrup
  2007-07-29 21:27 ` [PATCH] Makefile: use $(FIND) instead of find David Kastrup
  2007-07-29 22:15 ` [PATCH] Makefile: create an install-symlinks target Junio C Hamano
@ 2007-07-29 22:26 ` Peter Baumann
  2 siblings, 0 replies; 7+ messages in thread
From: Peter Baumann @ 2007-07-29 22:26 UTC (permalink / raw)
  To: David Kastrup; +Cc: git

On Sun, Jul 29, 2007 at 11:26:08PM +0200, David Kastrup wrote:
> [commit text mostly pinched from INSTALL]
> 
> An alternative global installation method making it much easier to
> uninstall is to use a package-specific prefix like /opt/git, then
> create symlinks from /usr/local into that hierarchy.  Uninstalling can
> then be achieved by
> 
> 	# rm -rf /opt/git; find /usr/local -xtype l -delete
> 
> You can create a setup like that after having used one of the above
> install recipes with prefix=/opt/git by writing
> 
> 	# make prefix=/opt/git symlinkprefix=/usr/local install-symlinks
> 
> This works by copying the directory hierarchy of $prefix to
> $symlinkprefix (not copying or descending to any directories of the
> name git* matched case-insensitively), then linking all the rest.
> 
> Signed-off-by: David Kastrup <dak@gnu.org>

AFAIR I suggested this the last time this came up, but in case you
missed it:

Use (x)stow for this. It does exactly what you want. No need to hack the
Makefile.

-Peter

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Makefile: create an install-symlinks target
  2007-07-29 22:15 ` [PATCH] Makefile: create an install-symlinks target Junio C Hamano
@ 2007-07-29 22:30   ` David Kastrup
  2007-07-29 23:44     ` Brian Gernhardt
  0 siblings, 1 reply; 7+ messages in thread
From: David Kastrup @ 2007-07-29 22:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano <gitster@pobox.com> writes:

> I thought we already rejected the "install symlink" in the
> earlier round.  Am I mistaken, or are there any compelling new
> reasons to revisit it?

Uh, perhaps I have a patchy recollection, but what I remember is that
Scho argued that one might use something like xstow or a package
manager instead, and I replied that

a) this required the installation of additional software for a simple
   task.

b) if the software worked using symbolic links, it would not know at
   what level to make the links (namely create
   /usr/local/share/man/man1 and link every file from
   /opt/git/share/man/man1, but link the directory
   /usr/local/share/git-core directly to /opt/git/share/git-core).

I don't remember a conclusive reply to that.  Not seeing the patch
appear either, I decided to clean it up, remove the objection of using
the GNU-specific -mindepth option, and properly document the usage.

Since the stuff is strictly an additional convenience not impacting
any of the existing targets, I would not have thought it terribly
controversial.

If I have misinterpreted or misremembered part of the discussion, I
apologize.  No harm was intended.

In any case, some people might want to make use of the polished patch
series even if it is not applied to git.git.

Is there a place other than the git list where one can provide patches
that are not likely to end up in git.git?

Thanks,

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Makefile: create an install-symlinks target
  2007-07-29 22:30   ` David Kastrup
@ 2007-07-29 23:44     ` Brian Gernhardt
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Gernhardt @ 2007-07-29 23:44 UTC (permalink / raw)
  To: David Kastrup; +Cc: Junio C Hamano, git


On Jul 29, 2007, at 6:30 PM, David Kastrup wrote:

> a) this required the installation of additional software for a simple
>    task.

I would think it's preferable to have a single piece of software to  
manage these links than attempt to craft a custom solution for every  
package you install.

> b) if the software worked using symbolic links, it would not know at
>    what level to make the links (namely create
>    /usr/local/share/man/man1 and link every file from
>    /opt/git/share/man/man1, but link the directory
>    /usr/local/share/git-core directly to /opt/git/share/git-core).

What stow does is to create a directory for every level where  
multiple packages have files or non-stow files exists.  It would  
create a link at /usr/local/share/git-core because nobody else uses  
that directory.  If there are other /usr/local/share/man/man1/*  
files, it would make a link for every file in the git version.

> Since the stuff is strictly an additional convenience not impacting
> any of the existing targets, I would not have thought it terribly
> controversial.

It's additional maintenance, mostly.  I don't have an objection to  
it, although I also don't see a reason to include it.

> Is there a place other than the git list where one can provide patches
> that are not likely to end up in git.git?

You could make a repo at repo.or.cz, I think.  Have different  
branches to maintain features and rebase them on top of master  
periodically.  Or just any random web-page to publish raw patches.

My $0.02,
~~ Brian

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-07-29 23:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-29 21:26 [PATCH] Makefile: create an install-symlinks target David Kastrup
2007-07-29 21:27 ` [PATCH] Makefile: use $(FIND) instead of find David Kastrup
2007-07-29 22:22   ` Junio C Hamano
2007-07-29 22:15 ` [PATCH] Makefile: create an install-symlinks target Junio C Hamano
2007-07-29 22:30   ` David Kastrup
2007-07-29 23:44     ` Brian Gernhardt
2007-07-29 22:26 ` Peter Baumann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.