* [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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ 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; 13+ 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] 13+ messages in thread
* [PATCH] Makefile: create an install-symlinks target
@ 2007-07-18 10:41 David Kastrup
2007-07-18 12:41 ` David Kastrup
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: David Kastrup @ 2007-07-18 10:41 UTC (permalink / raw)
To: git
Use this, for example, to do
rm -rf /opt/git
make prefix=/opt/git install
make symlinkprefix=/usr/local prefix=/opt/git install-symlinks
---
Makefile | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 73b487f..df2fe8d 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
@@ -996,7 +997,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) && cd '$(prefix_SQ)' && find . -mindepth 1 -type d ! \( -iname 'git*' -prune -exec echo rm -rf '$(symlinkprefix)/{}' \; \) -exec echo $(INSTALL) -m 755 -d '$(symlinkprefix)/{}' \;
+ @cd '$(prefix_SQ)' && find . -mindepth 1 -type d ! \( -iname 'git*' -prune -exec rm -rf '$(symlinkprefix)/{}' \; \) -exec $(INSTALL) -m 755 -d '$(symlinkprefix)/{}' \;
+ @: $(MAKE) && cd '$(prefix_SQ)' && find . -mindepth 1 \( -type d -iname 'git*' -prune -o ! -type d \) -exec echo ln -snf '$(prefix_SQ)/{}' '$(symlinkprefix)/{}' \;
+ @cd '$(prefix_SQ)' && find . -mindepth 1 \( -type d -iname 'git*' -prune -o ! -type d \) -exec ln -snf '$(prefix_SQ)/{}' '$(symlinkprefix)/{}' \;
### Maintainer's dist rules
--
1.5.3.rc2.41.gb47b1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] Makefile: create an install-symlinks target
2007-07-18 10:41 David Kastrup
@ 2007-07-18 12:41 ` David Kastrup
2007-07-18 12:48 ` Johannes Schindelin
2007-07-18 13:08 ` Alex Riesen
2 siblings, 0 replies; 13+ messages in thread
From: David Kastrup @ 2007-07-18 12:41 UTC (permalink / raw)
To: git
David Kastrup <dak@gnu.org> writes:
> Use this, for example, to do
> rm -rf /opt/git
> make prefix=/opt/git install
> make symlinkprefix=/usr/local prefix=/opt/git install-symlinks
> ---
> Makefile | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
Oh, by the way: I got _crazy_ when I first committed this, then found
a mistake and corrected it, and then repeatedly did
git add config/emacs/Makefile
git-commit --amend
and got the
> Makefile | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
message again and again, while nothing at all changed. Of course,
this was because I added the wrong Makefile.
I am not sure how git could be more helpful here. Just wanted to
report it. Maybe it could have noticed that my "amendment" was empty?
On the other hand, I might have wanted to amend the commit message.
Sigh.
--
David Kastrup
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Makefile: create an install-symlinks target
2007-07-18 10:41 David Kastrup
2007-07-18 12:41 ` David Kastrup
@ 2007-07-18 12:48 ` Johannes Schindelin
2007-07-18 14:33 ` Peter Baumann
2007-07-18 13:08 ` Alex Riesen
2 siblings, 1 reply; 13+ messages in thread
From: Johannes Schindelin @ 2007-07-18 12:48 UTC (permalink / raw)
To: David Kastrup; +Cc: git
Hi,
On Wed, 18 Jul 2007, David Kastrup wrote:
> Use this, for example, to do
> rm -rf /opt/git
> make prefix=/opt/git install
> make symlinkprefix=/usr/local prefix=/opt/git install-symlinks
You mean
This target allows you to have git installed in one location,
and have symbolic links to all of the programs installed in
another location. For example, if git was installed to /opt/git
with
make prefix=/opt/git install
you can install symbolic links in /usr/local/bin with
make symlinkprefix=/usr/local prefix=/opt/git \
install-symlinks
Hmm. Why not install it with a proper package manager in the correct
place to begin with? Somehow I find so many symbolic links ugly.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Makefile: create an install-symlinks target
2007-07-18 12:48 ` Johannes Schindelin
@ 2007-07-18 14:33 ` Peter Baumann
0 siblings, 0 replies; 13+ messages in thread
From: Peter Baumann @ 2007-07-18 14:33 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: David Kastrup, git
On Wed, Jul 18, 2007 at 01:48:21PM +0100, Johannes Schindelin wrote:
> Hi,
>
> On Wed, 18 Jul 2007, David Kastrup wrote:
>
> > Use this, for example, to do
> > rm -rf /opt/git
> > make prefix=/opt/git install
> > make symlinkprefix=/usr/local prefix=/opt/git install-symlinks
>
> You mean
>
> This target allows you to have git installed in one location,
> and have symbolic links to all of the programs installed in
> another location. For example, if git was installed to /opt/git
> with
>
> make prefix=/opt/git install
>
> you can install symbolic links in /usr/local/bin with
>
> make symlinkprefix=/usr/local prefix=/opt/git \
> install-symlinks
>
> Hmm. Why not install it with a proper package manager in the correct
> place to begin with? Somehow I find so many symbolic links ugly.
>
Seeing this excellent explantion from Dscho, this sound exactly like a
perfect use case for xstow [1].
It allows you to install your application into e.g. /usr/local/stow/git
and by running 'xstow git' in /usr/local/stow it would create all the
necessary links in /usr/local/{bin,share,doc} or any other place you
want.
-Peter
[1]: http://xstow.sourceforge.net/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Makefile: create an install-symlinks target
2007-07-18 10:41 David Kastrup
2007-07-18 12:41 ` David Kastrup
2007-07-18 12:48 ` Johannes Schindelin
@ 2007-07-18 13:08 ` Alex Riesen
2007-07-18 14:06 ` David Kastrup
2 siblings, 1 reply; 13+ messages in thread
From: Alex Riesen @ 2007-07-18 13:08 UTC (permalink / raw)
To: David Kastrup; +Cc: git
On 7/18/07, David Kastrup <dak@gnu.org> wrote:
> + @: $(MAKE) && cd '$(prefix_SQ)' && find . -mindepth 1 ...
Sometime about now you'll need to define $(FIND) or even $(GNUFIND)
for find. There are proprietary systems where find is not available or
does not do what you want it to. There is often a gfind installed somewhere
on these systems.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Makefile: create an install-symlinks target
2007-07-18 13:08 ` Alex Riesen
@ 2007-07-18 14:06 ` David Kastrup
0 siblings, 0 replies; 13+ messages in thread
From: David Kastrup @ 2007-07-18 14:06 UTC (permalink / raw)
To: git
"Alex Riesen" <raa.lkml@gmail.com> writes:
> On 7/18/07, David Kastrup <dak@gnu.org> wrote:
>> + @: $(MAKE) && cd '$(prefix_SQ)' && find . -mindepth 1 ...
>
> Sometime about now you'll need to define $(FIND) or even $(GNUFIND)
> for find. There are proprietary systems where find is not available or
> does not do what you want it to. There is often a gfind installed somewhere
> on these systems.
I think that the install-symlinks target is rather more specialized
than the tags and TAGS targets, yet those use just "find". I think
I'll be able to throw out the -mindepth, however. It was necessary in
a version that used find $(prefix), since /opt/git matched
-type d -name git*
but with find . this should not be relevant.
I'll amend that patch and prepare a separate one that uses $(FIND)
everywhere.
--
David Kastrup
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2007-07-29 23:44 UTC | newest]
Thread overview: 13+ 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
-- strict thread matches above, loose matches on Subject: below --
2007-07-18 10:41 David Kastrup
2007-07-18 12:41 ` David Kastrup
2007-07-18 12:48 ` Johannes Schindelin
2007-07-18 14:33 ` Peter Baumann
2007-07-18 13:08 ` Alex Riesen
2007-07-18 14:06 ` David Kastrup
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).