threads / patch / 48207

patchperl: fix installing modules from contrib

Subject: [PATCH 1/1] perl: fix installing modules from contrib

## tl;dr

8 messages between Apr 3, 2018 and Apr 19, 2018. Diffs are folded; open one to read it.

replies: 7people: 3as markdown or json

Christian Hesse· Apr 3, 2018, 09:20 UTC · lore

Commit 20d2a30f (Makefile: replace perl/Makefile.PL with simple make rules) removed a target that allowed Makefiles from contrib/ to get the correct install path. This introduces a new target for main Makefile and fixes installation for Mediawiki module.

Signed-off-by: Christian Hesse <mail@eworm.de>
---
 Makefile                   | 2 ++
 contrib/mw-to-git/Makefile | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
Show changes to 2 files +4 −2

Makefile, contrib/mw-to-git/Makefile

diff --git a/Makefile b/Makefile
index a1d8775ad..bcaf50495 100644
--- a/Makefile
+++ b/Makefile
@@ -2002,6 +2002,8 @@ GIT-PERL-DEFINES: FORCE
 		echo "$$FLAGS" >$@; \
 	    fi
 
+perllibdir:
+	@echo $(perllibdir_SQ)
 
 .PHONY: gitweb
 gitweb:
diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile
index a4b6f7a2c..0a6e59579 100644
--- a/contrib/mw-to-git/Makefile
+++ b/contrib/mw-to-git/Makefile
@@ -21,8 +21,8 @@ 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)
+INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/ \
+                -s --no-print-directory perllibdir=$(perllibdir) perllibdir)
 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
 INSTLIBDIR_SQ = $(subst ','\'',$(INSTLIBDIR))
 
Ævar Arnfjörð Bjarmason· Apr 3, 2018, 10:49 UTC · re: Christian Hesse · lore

Re: [PATCH 1/1] perl: fix installing modules from contrib

On Tue, Apr 03 2018, Christian Hesse wrote:
Show 38 quoted lines
> Commit 20d2a30f (Makefile: replace perl/Makefile.PL with simple make rules)
> removed a target that allowed Makefiles from contrib/ to get the correct
> install path. This introduces a new target for main Makefile and fixes
> installation for Mediawiki module.
>
> Signed-off-by: Christian Hesse <mail@eworm.de>
> ---
>  Makefile                   | 2 ++
>  contrib/mw-to-git/Makefile | 4 ++--
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index a1d8775ad..bcaf50495 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2002,6 +2002,8 @@ GIT-PERL-DEFINES: FORCE
>  		echo "$$FLAGS" >$@; \
>  	    fi
>
> +perllibdir:
> +	@echo $(perllibdir_SQ)
>
>  .PHONY: gitweb
>  gitweb:
> diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile
> index a4b6f7a2c..0a6e59579 100644
> --- a/contrib/mw-to-git/Makefile
> +++ b/contrib/mw-to-git/Makefile
> @@ -21,8 +21,8 @@ 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)
> +INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/ \
> +                -s --no-print-directory perllibdir=$(perllibdir) perllibdir)
>  DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
>  INSTLIBDIR_SQ = $(subst ','\'',$(INSTLIBDIR))
Thanks, I (obviously) missed that when getting rid of the perl/Makefile.

This fixes it up for now, but it seems we're going to need some solution to make this work with the in-flight RUNTIME_PREFIX Dan's been working on.

I think the best solution for that, not just for this but for most of contrib/ in general, is to simply move it into our main tree out of contrib/, and introduce some Makefile flags for whether or not you'd want to install such-and-such from contrib.

That would probably be easier than the current arrangement, and we could do things like say we always want to run tests for contrib/ stuff, even though we're not installing it.

Junio C Hamano· Apr 9, 2018, 04:54 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: [PATCH 1/1] perl: fix installing modules from contrib

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>>
>> +perllibdir:
>> +	@echo $(perllibdir_SQ)

This use of _SQ variant is fishy, isn't it? Judging from the output of

    $ git grep _SQ Makefile
e.g.
    Makefile:	$(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
    Makefile:	$(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
    Makefile:	$(INSTALL) $^ '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'

I'd expect that any _SQ variant must be referenced inside a single quote pair. In fact, that is why a single quote (and nothing else) in the base variable is replaced with the magic "'\''" sequence, first stepping out of the current sq context, append a single sq (escaped with a backslash from the shell), and then stepping back into another sq context.

I think nobody saw breakage only because they do not have two consecutive SPs (or any single quote) in their path to $perllibdir. If we depend on such limitation, there is no point using _SQ variant, but we already have _SQ variant, let's use it correctly.

Christian Hesse· Apr 10, 2018, 13:36 UTC · re: Junio C Hamano · lore

[PATCH v2 1/1] perl: fix installing modules from contrib

Commit 20d2a30f (Makefile: replace perl/Makefile.PL with simple make rules) removed a target that allowed Makefiles from contrib/ to get the correct install path. This introduces a new target for main Makefile and fixes installation for Mediawiki module.

v2: Pass prefix as that can have influence as well, add single quotes
    for _SQ variant.
Signed-off-by: Christian Hesse <mail@eworm.de>
---
 Makefile                   | 2 ++
 contrib/mw-to-git/Makefile | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)
Show changes to 2 files +5 −2

Makefile, contrib/mw-to-git/Makefile

diff --git a/Makefile b/Makefile
index 96f6138f6..19ca5e8de 100644
--- a/Makefile
+++ b/Makefile
@@ -2011,6 +2011,8 @@ GIT-PERL-DEFINES: FORCE
 		echo "$$FLAGS" >$@; \
 	    fi
 
+perllibdir:
+	@echo '$(perllibdir_SQ)'
 
 .PHONY: gitweb
 gitweb:
diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile
index a4b6f7a2c..4e603512a 100644
--- a/contrib/mw-to-git/Makefile
+++ b/contrib/mw-to-git/Makefile
@@ -21,8 +21,9 @@ 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)
+INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/ \
+                -s --no-print-directory prefix=$(prefix) \
+                perllibdir=$(perllibdir) perllibdir)
 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
 INSTLIBDIR_SQ = $(subst ','\'',$(INSTLIBDIR))
 
Junio C Hamano· Apr 10, 2018, 21:44 UTC · re: Christian Hesse · lore

Re: [PATCH v2 1/1] perl: fix installing modules from contrib

Christian Hesse <mail@eworm.de> writes:
Show 24 quoted lines
> Commit 20d2a30f (Makefile: replace perl/Makefile.PL with simple make rules)
> removed a target that allowed Makefiles from contrib/ to get the correct
> install path. This introduces a new target for main Makefile and fixes
> installation for Mediawiki module.
>
> v2: Pass prefix as that can have influence as well, add single quotes
>     for _SQ variant.
>
> Signed-off-by: Christian Hesse <mail@eworm.de>
> ---
>  Makefile                   | 2 ++
>  contrib/mw-to-git/Makefile | 5 +++--
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 96f6138f6..19ca5e8de 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2011,6 +2011,8 @@ GIT-PERL-DEFINES: FORCE
>  		echo "$$FLAGS" >$@; \
>  	    fi
>  
> +perllibdir:
> +	@echo '$(perllibdir_SQ)'

Sorry for not noticing it before, but as this rule will not create and update timestamp of a filesystem entity 'perllibdir', shouldn't we mark it with .PHONY? I'd call the target 'say-perllibdir' if I were doing this patch but that is merely a personal preference.

Show 18 quoted lines
>  .PHONY: gitweb
>  gitweb:
> diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile
> index a4b6f7a2c..4e603512a 100644
> --- a/contrib/mw-to-git/Makefile
> +++ b/contrib/mw-to-git/Makefile
> @@ -21,8 +21,9 @@ 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)
> +INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/ \
> +                -s --no-print-directory prefix=$(prefix) \
> +                perllibdir=$(perllibdir) perllibdir)
>  DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
>  INSTLIBDIR_SQ = $(subst ','\'',$(INSTLIBDIR))
>  
Christian Hesse· Apr 11, 2018, 06:51 UTC · re: Junio C Hamano · lore

[PATCH v3 1/1] perl: fix installing modules from contrib

Commit 20d2a30f (Makefile: replace perl/Makefile.PL with simple make rules) removed a target that allowed Makefiles from contrib/ to get the correct install path. This introduces a new target for main Makefile and fixes installation for Mediawiki module.

v2: Pass prefix as that can have influence as well, add single quotes
    for _SQ variant.
v3: Rename target, add to .PHONY.
Signed-off-by: Christian Hesse <mail@eworm.de>
---
 Makefile                   | 3 +++
 contrib/mw-to-git/Makefile | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)
Show changes to 2 files +6 −2

Makefile, contrib/mw-to-git/Makefile

diff --git a/Makefile b/Makefile
index f18168725..5a06eddf2 100644
--- a/Makefile
+++ b/Makefile
@@ -2014,6 +2014,9 @@ GIT-PERL-DEFINES: FORCE
 		echo "$$FLAGS" >$@; \
 	    fi
 
+.PHONY: say-perllibdir
+say-perllibdir:
+	@echo '$(perllibdir_SQ)'
 
 .PHONY: gitweb
 gitweb:
diff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile
index a4b6f7a2c..e301a5b4e 100644
--- a/contrib/mw-to-git/Makefile
+++ b/contrib/mw-to-git/Makefile
@@ -21,8 +21,9 @@ 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)
+INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/ \
+                -s --no-print-directory prefix=$(prefix) \
+                perllibdir=$(perllibdir) say-perllibdir)
 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
 INSTLIBDIR_SQ = $(subst ','\'',$(INSTLIBDIR))
 
Junio C Hamano· Apr 18, 2018, 21:44 UTC · re: Christian Hesse · lore

Re: [PATCH v3 1/1] perl: fix installing modules from contrib

Christian Hesse <mail@eworm.de> writes:
Show 11 quoted lines
> Commit 20d2a30f (Makefile: replace perl/Makefile.PL with simple make rules)
> removed a target that allowed Makefiles from contrib/ to get the correct
> install path. This introduces a new target for main Makefile and fixes
> installation for Mediawiki module.
>
> v2: Pass prefix as that can have influence as well, add single quotes
>     for _SQ variant.
> v3: Rename target, add to .PHONY.
>
> Signed-off-by: Christian Hesse <mail@eworm.de>
> ---

Thanks for rerolling. I should have made it a bit more clear that the say-* thing was merely a personal preference "I would be writing it that way if I were doing it", not a "You should write it this way when working on this project". I think .PHONY is still a good idea to have, even for only its documentation value (it is unlikely that anybody would create a file "perllibdir").

Let me queue this on top of the v2 queued in 'next' as an incremental update.

Thanks.
-- >8 --
From: Christian Hesse <mail@eworm.de>
SUbject: Makefile: mark perllibdir as a .PHONY target

This target should be marked as .PHONY, just like other targets that exist only for their side effects that do not create filesystem entities with the same name.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)
Show changes to Makefile +1 −0
diff --git a/Makefile b/Makefile
index 75b9ad3b48..b284eb20aa 100644
--- a/Makefile
+++ b/Makefile
@@ -1973,6 +1973,7 @@ GIT-PERL-DEFINES: FORCE
 		echo "$$FLAGS" >$@; \
 	    fi
 
+.PHONY: perllibdir
 perllibdir:
 	@echo '$(perllibdir_SQ)'
 
Christian Hesse· Apr 19, 2018, 21:44 UTC · re: Junio C Hamano · lore

Re: [PATCH v3 1/1] perl: fix installing modules from contrib

Junio C Hamano <gitster@pobox.com> on Thu, 2018/04/19 06:44:
Show 18 quoted lines
> Christian Hesse <mail@eworm.de> writes:
> 
> > Commit 20d2a30f (Makefile: replace perl/Makefile.PL with simple make
> > rules) removed a target that allowed Makefiles from contrib/ to get the
> > correct install path. This introduces a new target for main Makefile and
> > fixes installation for Mediawiki module.
> >
> > v2: Pass prefix as that can have influence as well, add single quotes
> >     for _SQ variant.
> > v3: Rename target, add to .PHONY.
> >
> > Signed-off-by: Christian Hesse <mail@eworm.de>
> > ---  
> 
> Thanks for rerolling.  I should have made it a bit more clear that
> the say-* thing was merely a personal preference "I would be writing
> it that way if I were doing it", not a "You should write it this way
> when working on this project". 

Well, it's you who maintains the code. So I am fine with whatever you prefer. ;)

Show 6 quoted lines
> I think .PHONY is still a good idea
> to have, even for only its documentation value (it is unlikely that
> anybody would create a file "perllibdir").
> 
> Let me queue this on top of the v2 queued in 'next' as an
> incremental update.
Thanks a lot!
-- 
Best regards,
Chris

← back to recent threads