From 3176c59290de8921cd6649dfb59f4d1f1f2c31bf Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Fri, 8 Nov 2013 18:22:39 -0800 Subject: [PATCH 1/4] git-remote-mediawiki: do not remove installed files in "clean" target Running "make clean" after a successful "make install" should not result in a broken mediawiki remote helper. Reported-by: Thorsten Glaser Signed-off-by: Jonathan Nieder Acked-by: Matthieu Moy Signed-off-by: Junio C Hamano --- contrib/mw-to-git/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile index a6f8b24887..c9acc843c5 100644 --- a/contrib/mw-to-git/Makefile +++ b/contrib/mw-to-git/Makefile @@ -31,7 +31,6 @@ install: install_pm clean: $(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \ clean-perl-script - rm $(INSTLIBDIR)/$(GIT_MEDIAWIKI_PM) perlcritic: perlcritic -2 *.perl From c311741331058f4a3005569fb3f937b92e4521fb Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 11 Nov 2013 12:45:29 -0800 Subject: [PATCH 2/4] git-remote-mediawiki: honor DESTDIR in "make install" So now you can run DESTDIR=$(pwd)/tmp make -Ccontrib/mw-to-git install to install the mediawiki remote helper, git-mw tool, and Git::Mediawiki perl module under tmp/ as preparation for zipping it up and extracting on another machine. While at it, make sure the directory that should contain Git::Mediawiki exists before putting a file there. Without this patch, the makefile uses DESTDIR when installing git-mw and git-remote-mediawiki but not the perl module, resulting in errors from "make install" if the $(INSTLIBDIR)/Git directory does not exist: install: cannot create regular file \ '/usr/share/perl/5.18.1/Git/Mediawiki.pm': No such file or directory Signed-off-by: Jonathan Nieder Acked-by: Matthieu Moy Signed-off-by: Junio C Hamano --- contrib/mw-to-git/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile index c9acc843c5..389a87eab1 100644 --- a/contrib/mw-to-git/Makefile +++ b/contrib/mw-to-git/Makefile @@ -18,7 +18,9 @@ INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/perl \ all: build install_pm: - install $(GIT_MEDIAWIKI_PM) $(INSTLIBDIR)/$(GIT_MEDIAWIKI_PM) + install -d -m 755 $(DESTDIR)$(INSTLIBDIR)/Git + install -m 644 $(GIT_MEDIAWIKI_PM) \ + $(DESTDIR)$(INSTLIBDIR)/$(GIT_MEDIAWIKI_PM) build: $(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \ From 33f918c6752d543e00cbb0c554a13532b5d97366 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 11 Nov 2013 12:45:50 -0800 Subject: [PATCH 3/4] git-remote-mediawiki build: make 'install' command configurable On some machines, the most usable 'install' tool is named 'ginstall'. Signed-off-by: Jonathan Nieder Acked-by: Matthieu Moy Signed-off-by: Junio C Hamano --- contrib/mw-to-git/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile index 389a87eab1..36fa14c2b5 100644 --- a/contrib/mw-to-git/Makefile +++ b/contrib/mw-to-git/Makefile @@ -11,6 +11,8 @@ SCRIPT_PERL=git-remote-mediawiki.perl GIT_ROOT_DIR=../.. HERE=contrib/mw-to-git/ +INSTALL = install + SCRIPT_PERL_FULL=$(patsubst %,$(HERE)/%,$(SCRIPT_PERL)) INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/perl \ -s --no-print-directory instlibdir) @@ -18,8 +20,8 @@ INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/perl \ all: build install_pm: - install -d -m 755 $(DESTDIR)$(INSTLIBDIR)/Git - install -m 644 $(GIT_MEDIAWIKI_PM) \ + $(INSTALL) -d -m 755 $(DESTDIR)$(INSTLIBDIR)/Git + $(INSTALL) -m 644 $(GIT_MEDIAWIKI_PM) \ $(DESTDIR)$(INSTLIBDIR)/$(GIT_MEDIAWIKI_PM) build: From c635b050e7a8873f02d739b7a739a03ba4dd8606 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 11 Nov 2013 12:46:12 -0800 Subject: [PATCH 4/4] git-remote-mediawiki build: handle DESTDIR/INSTLIBDIR with whitespace Quote DESTDIR and INSTLIBDIR for the shell in the same way as is done in the toplevel Makefile to avoid confusion in case they contain shell metacharacters. Signed-off-by: Jonathan Nieder Acked-by: Matthieu Moy Signed-off-by: Junio C Hamano --- contrib/mw-to-git/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile index 36fa14c2b5..37b68e2571 100644 --- a/contrib/mw-to-git/Makefile +++ b/contrib/mw-to-git/Makefile @@ -16,13 +16,15 @@ INSTALL = install SCRIPT_PERL_FULL=$(patsubst %,$(HERE)/%,$(SCRIPT_PERL)) INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/perl \ -s --no-print-directory instlibdir) +DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) +INSTLIBDIR_SQ = $(subst ','\'',$(INSTLIBDIR)) all: build install_pm: - $(INSTALL) -d -m 755 $(DESTDIR)$(INSTLIBDIR)/Git + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(INSTLIBDIR_SQ)/Git' $(INSTALL) -m 644 $(GIT_MEDIAWIKI_PM) \ - $(DESTDIR)$(INSTLIBDIR)/$(GIT_MEDIAWIKI_PM) + '$(DESTDIR_SQ)$(INSTLIBDIR_SQ)/$(GIT_MEDIAWIKI_PM)' build: $(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \