Skip to contentSkip to conversation

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

PATCH In review Jonathan Nieder 2 participants 7 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
Thanks for the very pleasant mediawiki remote helper.

 contrib/mw-to-git/Makefile | 1 -
 1 file changed, 1 deletion(-)
contrib/mw-to-git/Makefile +0 -1
index f206f96..c5547f9 100644
@@ -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)
Signature · 1 line
1.8.4.1
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Jonathan Nieder

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

Ideally, there could be a "make uninstall" removing the installed file.

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/
#2 lore raw
Quoted 6 lines · Matthieu Moy
Quoted 2 lines · Jonathan Nieder

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

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(-)
#3 lore raw

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

---
 contrib/mw-to-git/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
contrib/mw-to-git/Makefile +3 -1
index c5547f9..ee78fda 100644
@@ -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)" \
Signature · 1 line
1.8.4.1
#4 lore raw

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

In reply to Jonathan Nieder

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

---
 contrib/mw-to-git/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
contrib/mw-to-git/Makefile +4 -2
index ee78fda..e685dad 100644
@@ -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:
Signature · 1 line
1.8.4.1
#5 lore raw

PATCH 3/3 git-remote-mediawiki build: handle DESTDIR/INSTLIBDIR with whitespace

In reply to Jonathan Nieder

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.

---
 contrib/mw-to-git/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
contrib/mw-to-git/Makefile +4 -2
index e685dad..a4b6f7a 100644
@@ -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)" \
Signature · 1 line
1.8.4.1
#6 lore raw
In reply to Jonathan Nieder
Quoted 10 lines · Jonathan Nieder
Quoted 6 lines · Matthieu Moy
Quoted 2 lines · Jonathan Nieder

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

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?

Signature · 2 lines
Matthieu Moy
http://www-verimag.imag.fr/~moy/