{"thread":{"id":"9298","subject":"[PATCH] Makefile: create an install-symlinks target","startedAt":"2007-07-29T21:26:08Z","lastAt":"2007-07-29T23:44:28Z","messageCount":7,"participants":["David Kastrup","Junio C Hamano","Peter Baumann","Brian Gernhardt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"49010","messageId":"85lkcyvr4f.fsf@lola.goethe.zz","threadId":"9298","inReplyTo":null,"subject":"[PATCH] Makefile: create an install-symlinks target","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-07-29T21:26:08Z","receivedAt":"2007-07-29T21:26:08Z","isPatch":true,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"[commit text mostly pinched from INSTALL]\n\nAn alternative global installation method making it much easier to\nuninstall is to use a package-specific prefix like /opt/git, then\ncreate symlinks from /usr/local into that hierarchy.  Uninstalling can\nthen be achieved by\n\n\t# rm -rf /opt/git; find /usr/local -xtype l -delete\n\nYou can create a setup like that after having used one of the above\ninstall recipes with prefix=/opt/git by writing\n\n\t# make prefix=/opt/git symlinkprefix=/usr/local install-symlinks\n\nThis works by copying the directory hierarchy of $prefix to\n$symlinkprefix (not copying or descending to any directories of the\nname git* matched case-insensitively), then linking all the rest.\n\nSigned-off-by: David Kastrup <dak@gnu.org>\n---\n INSTALL  |   12 ++++++++++++\n Makefile |   10 +++++++++-\n 2 files changed, 21 insertions(+), 1 deletions(-)\n\ndiff --git a/INSTALL b/INSTALL\nindex 79e71b6..22df145 100644\n--- a/INSTALL\n+++ b/INSTALL\n@@ -21,6 +21,18 @@ set up install paths (via config.mak.autogen), so you can write instead\n \t$ make all doc ;# as yourself\n \t# make install install-doc ;# as root\n \n+An alternative global installation method making it much easier to\n+uninstall is to use a package-specific prefix like /opt/git, then\n+create symlinks from /usr/local into that hierarchy.  Uninstalling can\n+then be achieved by\n+\n+\t# rm -rf /opt/git; find /usr/local -xtype l -delete\n+\n+You can create a setup like that after having used one of the above\n+install recipes with prefix=/opt/git by writing\n+\n+\t# make prefix=/opt/git symlinkprefix=/usr/local install-symlinks\n+\n \n Issues of note:\n \ndiff --git a/Makefile b/Makefile\nindex 73b487f..87b317f 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -142,6 +142,7 @@ ALL_LDFLAGS = $(LDFLAGS)\n STRIP ?= strip\n \n prefix = $(HOME)\n+symlinkprefix = /usr/local\n bindir = $(prefix)/bin\n gitexecdir = $(bindir)\n sharedir = $(prefix)/share\n@@ -692,6 +693,7 @@ bindir_SQ = $(subst ','\\'',$(bindir))\n gitexecdir_SQ = $(subst ','\\'',$(gitexecdir))\n template_dir_SQ = $(subst ','\\'',$(template_dir))\n prefix_SQ = $(subst ','\\'',$(prefix))\n+symlinkprefix_SQ = $(subst ','\\'',$(symlinkprefix))\n \n SHELL_PATH_SQ = $(subst ','\\'',$(SHELL_PATH))\n PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n@@ -996,7 +998,13 @@ install-doc:\n quick-install-doc:\n \t$(MAKE) -C Documentation quick-install\n \n-\n+# The somewhat strange looking lines start with an ignored $(MAKE) in\n+# order to be executed also in make -n calls.\n+install-symlinks:\n+\t@: $(MAKE) && echo cd '$(prefix_SQ)' && cd '$(prefix_SQ)' && find . -type d ! \\( -iname 'git*' -prune \\) -exec echo $(INSTALL) -m 755 -d '$(symlinkprefix_SQ)/{}' \\;\n+\t@cd '$(prefix_SQ)' && find . -type d ! \\( -iname 'git*' -prune \\) -exec $(INSTALL) -m 755 -d '$(symlinkprefix_SQ)/{}' \\;\n+\t@: $(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)/{}' \\;\n+\t@cd '$(prefix_SQ)' && find . \\( -type d -iname 'git*' -prune -o ! -type d \\) -exec $(RM) -r '$(symlinkprefix_SQ)/{}' \\; -exec ln -s '$(prefix_SQ)/{}' '$(symlinkprefix_SQ)/{}' \\;\n \n ### Maintainer's dist rules\n \n-- \n1.5.3.rc2.84.g6497\n"},{"id":"49011","messageId":"85ir82vr1v.fsf@lola.goethe.zz","threadId":"9298","inReplyTo":"85lkcyvr4f.fsf@lola.goethe.zz","subject":"[PATCH] Makefile: use $(FIND) instead of find","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-07-29T21:27:40Z","receivedAt":"2007-07-29T21:27:40Z","isPatch":true,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Some people might prefer to be able to specify the find utility to\nuse, in particular for the more complicated usage in the\ninstall-symlinks target.\n\nSigned-off-by: David Kastrup <dak@gnu.org>\n---\n Makefile |   13 +++++++------\n 1 files changed, 7 insertions(+), 6 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 87b317f..29dfdeb 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -178,6 +178,7 @@ AR = ar\n RM = rm -f\n TAR = tar\n INSTALL = install\n+FIND = find\n RPMBUILD = rpmbuild\n TCL_PATH = tclsh\n TCLTK_PATH = wish\n@@ -905,11 +906,11 @@ doc:\n \n TAGS:\n \t$(RM) TAGS\n-\tfind . -name '*.[hcS]' -print | xargs etags -a\n+\t$(FIND) . -name '*.[hcS]' -print | xargs etags -a\n \n tags:\n \t$(RM) tags\n-\tfind . -name '*.[hcS]' -print | xargs ctags -a\n+\t$(FIND) . -name '*.[hcS]' -print | xargs ctags -a\n \n ### Detect prefix changes\n TRACK_CFLAGS = $(subst ','\\'',$(ALL_CFLAGS)):\\\n@@ -1001,10 +1002,10 @@ quick-install-doc:\n # The somewhat strange looking lines start with an ignored $(MAKE) in\n # order to be executed also in make -n calls.\n install-symlinks:\n-\t@: $(MAKE) && echo cd '$(prefix_SQ)' && cd '$(prefix_SQ)' && find . -type d ! \\( -iname 'git*' -prune \\) -exec echo $(INSTALL) -m 755 -d '$(symlinkprefix_SQ)/{}' \\;\n-\t@cd '$(prefix_SQ)' && find . -type d ! \\( -iname 'git*' -prune \\) -exec $(INSTALL) -m 755 -d '$(symlinkprefix_SQ)/{}' \\;\n-\t@: $(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)/{}' \\;\n-\t@cd '$(prefix_SQ)' && find . \\( -type d -iname 'git*' -prune -o ! -type d \\) -exec $(RM) -r '$(symlinkprefix_SQ)/{}' \\; -exec ln -s '$(prefix_SQ)/{}' '$(symlinkprefix_SQ)/{}' \\;\n+\t@: $(MAKE) && echo cd '$(prefix_SQ)' && cd '$(prefix_SQ)' && $(FIND) . -type d ! \\( -iname 'git*' -prune \\) -exec echo $(INSTALL) -m 755 -d '$(symlinkprefix_SQ)/{}' \\;\n+\t@cd '$(prefix_SQ)' && $(FIND) . -type d ! \\( -iname 'git*' -prune \\) -exec $(INSTALL) -m 755 -d '$(symlinkprefix_SQ)/{}' \\;\n+\t@: $(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)/{}' \\;\n+\t@cd '$(prefix_SQ)' && $(FIND) . \\( -type d -iname 'git*' -prune -o ! -type d \\) -exec $(RM) -r '$(symlinkprefix_SQ)/{}' \\; -exec ln -s '$(prefix_SQ)/{}' '$(symlinkprefix_SQ)/{}' \\;\n \n ### Maintainer's dist rules\n \n-- \n1.5.3.rc2.84.g6497\n"},{"id":"49012","messageId":"7vk5sin9g0.fsf@assigned-by-dhcp.cox.net","threadId":"9298","inReplyTo":"85lkcyvr4f.fsf@lola.goethe.zz","subject":"Re: [PATCH] Makefile: create an install-symlinks target","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-29T22:15:11Z","receivedAt":"2007-07-29T22:15:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I thought we already rejected the \"install symlink\" in the\nearlier round.  Am I mistaken, or are there any compelling new\nreasons to revisit it?\n"},{"id":"49013","messageId":"7vfy36n93w.fsf@assigned-by-dhcp.cox.net","threadId":"9298","inReplyTo":"85ir82vr1v.fsf@lola.goethe.zz","subject":"Re: [PATCH] Makefile: use $(FIND) instead of find","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-29T22:22:27Z","receivedAt":"2007-07-29T22:22:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Will apply excluding the install-symlinks bit.  The $(FIND)\nthing is a good idea independently.  Thanks.\n"},{"id":"49014","messageId":"20070729222604.GB5753@xp.machine.xx","threadId":"9298","inReplyTo":"85lkcyvr4f.fsf@lola.goethe.zz","subject":"Re: [PATCH] Makefile: create an install-symlinks target","fromName":"Peter Baumann","fromEmail":"waste.manager@gmx.de","sentAt":"2007-07-29T22:26:04Z","receivedAt":"2007-07-29T22:26:04Z","isPatch":true,"sender":{"key":"waste.manager@gmx.de","avatar":null},"body":"On Sun, Jul 29, 2007 at 11:26:08PM +0200, David Kastrup wrote:\n> [commit text mostly pinched from INSTALL]\n> \n> An alternative global installation method making it much easier to\n> uninstall is to use a package-specific prefix like /opt/git, then\n> create symlinks from /usr/local into that hierarchy.  Uninstalling can\n> then be achieved by\n> \n> \t# rm -rf /opt/git; find /usr/local -xtype l -delete\n> \n> You can create a setup like that after having used one of the above\n> install recipes with prefix=/opt/git by writing\n> \n> \t# make prefix=/opt/git symlinkprefix=/usr/local install-symlinks\n> \n> This works by copying the directory hierarchy of $prefix to\n> $symlinkprefix (not copying or descending to any directories of the\n> name git* matched case-insensitively), then linking all the rest.\n> \n> Signed-off-by: David Kastrup <dak@gnu.org>\n\nAFAIR I suggested this the last time this came up, but in case you\nmissed it:\n\nUse (x)stow for this. It does exactly what you want. No need to hack the\nMakefile.\n\n-Peter\n"},{"id":"49015","messageId":"85bqduvo5r.fsf@lola.goethe.zz","threadId":"9298","inReplyTo":"7vk5sin9g0.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Makefile: create an install-symlinks target","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-07-29T22:30:08Z","receivedAt":"2007-07-29T22:30:08Z","isPatch":true,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> I thought we already rejected the \"install symlink\" in the\n> earlier round.  Am I mistaken, or are there any compelling new\n> reasons to revisit it?\n\nUh, perhaps I have a patchy recollection, but what I remember is that\nScho argued that one might use something like xstow or a package\nmanager instead, and I replied that\n\na) this required the installation of additional software for a simple\n   task.\n\nb) if the software worked using symbolic links, it would not know at\n   what level to make the links (namely create\n   /usr/local/share/man/man1 and link every file from\n   /opt/git/share/man/man1, but link the directory\n   /usr/local/share/git-core directly to /opt/git/share/git-core).\n\nI don't remember a conclusive reply to that.  Not seeing the patch\nappear either, I decided to clean it up, remove the objection of using\nthe GNU-specific -mindepth option, and properly document the usage.\n\nSince the stuff is strictly an additional convenience not impacting\nany of the existing targets, I would not have thought it terribly\ncontroversial.\n\nIf I have misinterpreted or misremembered part of the discussion, I\napologize.  No harm was intended.\n\nIn any case, some people might want to make use of the polished patch\nseries even if it is not applied to git.git.\n\nIs there a place other than the git list where one can provide patches\nthat are not likely to end up in git.git?\n\nThanks,\n\n-- \nDavid Kastrup, Kriemhildstr. 15, 44793 Bochum\n"},{"id":"49034","messageId":"ADE1034F-2454-4249-8DCF-872C52CD471F@silverinsanity.com","threadId":"9298","inReplyTo":"85bqduvo5r.fsf@lola.goethe.zz","subject":"Re: [PATCH] Makefile: create an install-symlinks target","fromName":"Brian Gernhardt","fromEmail":"benji@silverinsanity.com","sentAt":"2007-07-29T23:44:28Z","receivedAt":"2007-07-29T23:44:28Z","isPatch":true,"sender":{"key":"benji@silverinsanity.com","avatar":"https://gravatar.com/avatar/e06c101dbc25c68114d859b4a9ec7cf8a2c52fd2b0270ef0eac0e2e63ff22311?d=mp&s=160"},"body":"\nOn Jul 29, 2007, at 6:30 PM, David Kastrup wrote:\n\n> a) this required the installation of additional software for a simple\n>    task.\n\nI would think it's preferable to have a single piece of software to  \nmanage these links than attempt to craft a custom solution for every  \npackage you install.\n\n> b) if the software worked using symbolic links, it would not know at\n>    what level to make the links (namely create\n>    /usr/local/share/man/man1 and link every file from\n>    /opt/git/share/man/man1, but link the directory\n>    /usr/local/share/git-core directly to /opt/git/share/git-core).\n\nWhat stow does is to create a directory for every level where  \nmultiple packages have files or non-stow files exists.  It would  \ncreate a link at /usr/local/share/git-core because nobody else uses  \nthat directory.  If there are other /usr/local/share/man/man1/*  \nfiles, it would make a link for every file in the git version.\n\n> Since the stuff is strictly an additional convenience not impacting\n> any of the existing targets, I would not have thought it terribly\n> controversial.\n\nIt's additional maintenance, mostly.  I don't have an objection to  \nit, although I also don't see a reason to include it.\n\n> Is there a place other than the git list where one can provide patches\n> that are not likely to end up in git.git?\n\nYou could make a repo at repo.or.cz, I think.  Have different  \nbranches to maintain features and rebase them on top of master  \nperiodically.  Or just any random web-page to publish raw patches.\n\nMy $0.02,\n~~ Brian\n"}]}