threads / patch / 35312

patchgit-remote-mediawiki: do not remove installed files in "clean" target

Subject: [PATCH] git-remote-mediawiki: do not remove installed files in "clean" target

## tl;dr

7 messages between Nov 9, 2013 and Nov 11, 2013. Diffs are folded; open one to read it.

replies: 6people: 2as markdown or json

Jonathan Nieder· Nov 9, 2013, 02:22 UTC · lore

Running "make clean" after a successful "make install" should not result in a broken mediawiki remote helper.

Reported-by: Thorsten Glaser <t.glaser@tarent.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Thanks for the very pleasant mediawiki remote helper.
 contrib/mw-to-git/Makefile | 1 -
 1 file changed, 1 deletion(-)
Show changes to contrib/mw-to-git/Makefile +0 −1
diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile
index f206f96..c5547f9 100644
--- a/contrib/mw-to-git/Makefile
+++ b/contrib/mw-to-git/Makefile
@@ -43,7 +43,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 -5 $(SCRIPT_PERL)
-- 
1.8.4.1
Matthieu Moy· Nov 9, 2013, 11:32 UTC · re: Jonathan Nieder · lore

Re: [PATCH] git-remote-mediawiki: do not remove installed files in "clean" target

Jonathan Nieder <jrnieder@gmail.com> writes:
> Running "make clean" after a successful "make install" should not
> result in a broken mediawiki remote helper.
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Ideally, there could be a "make uninstall" removing the installed file.
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Jonathan Nieder· Nov 11, 2013, 20:45 UTC · re: Matthieu Moy · lore

Re: [PATCH] git-remote-mediawiki: do not remove installed files in "clean" target

Matthieu Moy wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
>> Running "make clean" after a successful "make install" should not
>> result in a broken mediawiki remote helper.
>
> Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>

Thanks for looking it over. Here are a few more makefile tweaks on top of that one.

Jonathan Nieder (3):
  git-remote-mediawiki: honor DESTDIR in "make install"
  git-remote-mediawiki build: make 'install' command configurable
  git-remote-mediawiki build: handle DESTDIR/INSTLIBDIR with whitespace
 contrib/mw-to-git/Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Jonathan Nieder· Nov 11, 2013, 20:45 UTC · re: Jonathan Nieder · lore

[PATCH 1/3] 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 <jrnieder@gmail.com>
---
 contrib/mw-to-git/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Show changes to contrib/mw-to-git/Makefile +3 −1
diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile
index c5547f9..ee78fda 100644
--- a/contrib/mw-to-git/Makefile
+++ b/contrib/mw-to-git/Makefile
@@ -30,7 +30,9 @@ test: all
 check: perlcritic test
 
 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)" \
-- 
1.8.4.1
Jonathan Nieder· Nov 11, 2013, 20:45 UTC · re: Jonathan Nieder · lore

[PATCH 2/3] git-remote-mediawiki build: make 'install' command configurable

On some machines, the most usable 'install' tool is named 'ginstall'.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 contrib/mw-to-git/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Show changes to contrib/mw-to-git/Makefile +4 −2
diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile
index ee78fda..e685dad 100644
--- a/contrib/mw-to-git/Makefile
+++ b/contrib/mw-to-git/Makefile
@@ -18,6 +18,8 @@ SCRIPT_PERL+=git-mw.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)
@@ -30,8 +32,8 @@ test: all
 check: perlcritic test
 
 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:
-- 
1.8.4.1
Jonathan Nieder· Nov 11, 2013, 20:46 UTC · re: Jonathan Nieder · lore

[PATCH 3/3] 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 <jrnieder@gmail.com>
---
 contrib/mw-to-git/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Show changes to contrib/mw-to-git/Makefile +4 −2
diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile
index e685dad..a4b6f7a 100644
--- a/contrib/mw-to-git/Makefile
+++ b/contrib/mw-to-git/Makefile
@@ -23,6 +23,8 @@ 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
 
@@ -32,9 +34,9 @@ test: all
 check: perlcritic test
 
 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)" \
-- 
1.8.4.1
Matthieu Moy· Nov 11, 2013, 21:26 UTC · re: Jonathan Nieder · lore

Re: [PATCH] git-remote-mediawiki: do not remove installed files in "clean" target

Jonathan Nieder <jrnieder@gmail.com> writes:
Show 10 quoted lines
> Matthieu Moy wrote:
>> Jonathan Nieder <jrnieder@gmail.com> writes:
>
>>> Running "make clean" after a successful "make install" should not
>>> result in a broken mediawiki remote helper.
>>
>> Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
>
> Thanks for looking it over.  Here are a few more makefile tweaks on
> top of that one.
All look good to me. Is it intentional that you didn't Cc Junio?
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

← back to recent threads