git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] gitweb: respect $GITPERLLIB
@ 2008-06-20  2:31 Lea Wiemann
  2008-06-20 19:35 ` [RFC/PATCH v2] " Lea Wiemann
  0 siblings, 1 reply; 5+ messages in thread
From: Lea Wiemann @ 2008-06-20  2:31 UTC (permalink / raw
  To: git; +Cc: Lea Wiemann

gitweb/gitweb.cgi now respects $GITPERLLIB, like the Perl-based Git
commands.

Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
---
Junio C Hamano wrote in <http://mid.gmane.org/7vfxrwa008.fsf@gitster.siamese.dyndns.org>:
> The real fix to the issue [is] to fix the build
> procedure of gitweb/gitweb.perl so that the above script rewriting is also
> applied to it.

I've now implemented this, since it's becoming necessary for the
Mechanize tests.  However, I'm not totally confident that what I wrote
is (a) correct and (b) a good idea -- I simply copy-and-pasted from
the previous Makefile entry, since I'm not very proficient with sed.

Comments appreciated!

-- Lea

 Makefile |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index b003e3e..c5c6ac7 100644
--- a/Makefile
+++ b/Makefile
@@ -1081,7 +1081,14 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
 
 gitweb/gitweb.cgi: gitweb/gitweb.perl
 	$(QUIET_GEN)$(RM) $@ $@+ && \
-	sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	sed -e '1{' \
+	    -e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	    -e '	h' \
+	    -e '	s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
+	    -e '	H' \
+	    -e '	x' \
+	    -e '}' \
+	    -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
 	    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
 	    -e 's|++GIT_BINDIR++|$(bindir)|g' \
 	    -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
-- 
1.5.6.31.gcbcff.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [RFC/PATCH v2] gitweb: respect $GITPERLLIB
  2008-06-20  2:31 [PATCH] gitweb: respect $GITPERLLIB Lea Wiemann
@ 2008-06-20 19:35 ` Lea Wiemann
  2008-06-20 19:35   ` Lea Wiemann
  0 siblings, 1 reply; 5+ messages in thread
From: Lea Wiemann @ 2008-06-20 19:35 UTC (permalink / raw
  To: git; +Cc: Lea Wiemann

gitweb/gitweb.cgi now respects $GITPERLLIB, like the Perl-based Git
commands.

Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
---
Changed since v1: Added missing INSTLIBDIR initialization.

I just noticed that as of now Gitweb isn't using any Perl modules, so
this change is actually not necessary yet; hence I'm making it an RFC
patch.  I'll probably squash this into a larger "gitweb: use new
Git::Repo API" patch (which I'll publish in a few days).

Comments on this change to the Makefile are still appreciated, of
course. :)

-- Lea

 Makefile |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 85c0846..64eeac1 100644
--- a/Makefile
+++ b/Makefile
@@ -1083,7 +1083,15 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
 
 gitweb/gitweb.cgi: gitweb/gitweb.perl
 	$(QUIET_GEN)$(RM) $@ $@+ && \
-	sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
+	sed -e '1{' \
+	    -e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	    -e '	h' \
+	    -e '	s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
+	    -e '	H' \
+	    -e '	x' \
+	    -e '}' \
+	    -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
 	    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
 	    -e 's|++GIT_BINDIR++|$(bindir)|g' \
 	    -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
-- 
1.5.6.79.g01e9.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [RFC/PATCH v2] gitweb: respect $GITPERLLIB
  2008-06-20 19:35 ` [RFC/PATCH v2] " Lea Wiemann
@ 2008-06-20 19:35   ` Lea Wiemann
  2008-06-21  9:46     ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Lea Wiemann @ 2008-06-20 19:35 UTC (permalink / raw
  To: git; +Cc: Lea Wiemann

gitweb/gitweb.cgi now respects $GITPERLLIB, like the Perl-based Git
commands.

Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
---
Changed since v1: Added missing INSTLIBDIR initialization.

I just noticed that as of now Gitweb isn't using any Perl modules, so
this change is actually not necessary yet; hence I'm making it an RFC
patch.  I'll probably squash this into a larger "gitweb: use new
Git::Repo API" patch (which I'll publish in a few days).

Comments on this change to the Makefile are still appreciated, of
course. :)

-- Lea

 Makefile |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 85c0846..64eeac1 100644
--- a/Makefile
+++ b/Makefile
@@ -1083,7 +1083,15 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
 
 gitweb/gitweb.cgi: gitweb/gitweb.perl
 	$(QUIET_GEN)$(RM) $@ $@+ && \
-	sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
+	sed -e '1{' \
+	    -e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	    -e '	h' \
+	    -e '	s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
+	    -e '	H' \
+	    -e '	x' \
+	    -e '}' \
+	    -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
 	    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
 	    -e 's|++GIT_BINDIR++|$(bindir)|g' \
 	    -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
-- 
1.5.6.79.g01e9.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RFC/PATCH v2] gitweb: respect $GITPERLLIB
  2008-06-20 19:35   ` Lea Wiemann
@ 2008-06-21  9:46     ` Junio C Hamano
  2008-06-21 22:40       ` [RFC/PATCH v3] " Lea Wiemann
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2008-06-21  9:46 UTC (permalink / raw
  To: Lea Wiemann; +Cc: git

Lea Wiemann <lewiemann@gmail.com> writes:

> gitweb/gitweb.cgi now respects $GITPERLLIB, like the Perl-based Git
> commands.
>
> Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
> ---
> Changed since v1: Added missing INSTLIBDIR initialization.
>
> I just noticed that as of now Gitweb isn't using any Perl modules, so
> this change is actually not necessary yet; hence I'm making it an RFC
> patch.  I'll probably squash this into a larger "gitweb: use new
> Git::Repo API" patch (which I'll publish in a few days).
>
> Comments on this change to the Makefile are still appreciated, of
> course. :)
>
> -- Lea
>
>  Makefile |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 85c0846..64eeac1 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1083,7 +1083,15 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
>  
>  gitweb/gitweb.cgi: gitweb/gitweb.perl
>  	$(QUIET_GEN)$(RM) $@ $@+ && \
> -	sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
> +	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
> +	sed -e '1{' \
> +	    -e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
> +	    -e '	h' \
> +	    -e '	s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
> +	    -e '	H' \
> +	    -e '	x' \
> +	    -e '}' \
> +	    -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
>  	    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
>  	    -e 's|++GIT_BINDIR++|$(bindir)|g' \
>  	    -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \

This part seems to duplicate quite a bit of sed insn used elsewhere, and
we may want to factor the common part out, perhaps like this...

 Makefile |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 6a31c9f..d3f1bde 100644
--- a/Makefile
+++ b/Makefile
@@ -1063,25 +1063,28 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
 perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL
 	$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
 
+PERL_USE_LIB_REWRITE = \
+	-e '1{' \
+	-e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	-e '	h' \
+	-e '	s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
+	-e '	H' \
+	-e '	x' \
+	-e '}' \
+	-e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
+	-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g'
+
 $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
-	sed -e '1{' \
-	    -e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
-	    -e '	h' \
-	    -e '	s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
-	    -e '	H' \
-	    -e '	x' \
-	    -e '}' \
-	    -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
-	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-	    $@.perl >$@+ && \
+	sed $(PERL_USE_LIB_REWRITE) $@.perl >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
 
 gitweb/gitweb.cgi: gitweb/gitweb.perl
 	$(QUIET_GEN)$(RM) $@ $@+ && \
-	sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
+	sed $(PERL_USE_LIB_REWRITE) \
 	    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
 	    -e 's|++GIT_BINDIR++|$(bindir)|g' \
 	    -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [RFC/PATCH v3] gitweb: respect $GITPERLLIB
  2008-06-21  9:46     ` Junio C Hamano
@ 2008-06-21 22:40       ` Lea Wiemann
  0 siblings, 0 replies; 5+ messages in thread
From: Lea Wiemann @ 2008-06-21 22:40 UTC (permalink / raw
  To: git; +Cc: Lea Wiemann

gitweb/gitweb.cgi now respects $GITPERLLIB, like the Perl-based Git
commands.

This patch is not for inclusion, it'll be squashed with a larger
commit.
---
Junio C Hamano wrote:
> This part seems to duplicate quite a bit of sed insn used elsewhere, and
> we may want to factor the common part out, perhaps like this...

Thanks!  This needs some tender loving quoting though; diff to your
version:

   diff --git a/Makefile b/Makefile
   index e6fd8ac..92a802f 100644
   --- a/Makefile
   +++ b/Makefile
   @@ -1065,13 +1065,13 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
    perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL
    	$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
 
    PERL_USE_LIB_REWRITE = \
    	-e '1{' \
   -	-e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
   +	-e '	s|\#!.*perl|\#!$(PERL_PATH_SQ)|' \
    	-e '	h' \
   -	-e '	s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
   +	-e '	s=.*=use lib (split(/:/, \$$ENV{GITPERLLIB} || \"@@INSTLIBDIR@@\"));=' \
    	-e '	H' \
    	-e '	x' \
    	-e '}' \
    	-e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
    	-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g'

I wonder though if that's too brittle or unmaintainable and we should
rather use the explicit version in v2 (even if it duplicated code);
I'd prefer v2 off the top of my head.

Also, note that I really only did trial-and-error quoting here. ;-)

-- Lea

 Makefile |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index fda9133..92a802f 100644
--- a/Makefile
+++ b/Makefile
@@ -1065,25 +1065,28 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
 perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL
 	$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
 
+PERL_USE_LIB_REWRITE = \
+	-e '1{' \
+	-e '	s|\#!.*perl|\#!$(PERL_PATH_SQ)|' \
+	-e '	h' \
+	-e '	s=.*=use lib (split(/:/, \$$ENV{GITPERLLIB} || \"@@INSTLIBDIR@@\"));=' \
+	-e '	H' \
+	-e '	x' \
+	-e '}' \
+	-e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
+	-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g'
+
 $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
-	sed -e '1{' \
-	    -e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
-	    -e '	h' \
-	    -e '	s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
-	    -e '	H' \
-	    -e '	x' \
-	    -e '}' \
-	    -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
-	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-	    $@.perl >$@+ && \
+	sed $(PERL_USE_LIB_REWRITE) $@.perl >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
 
 gitweb/gitweb.cgi: gitweb/gitweb.perl
 	$(QUIET_GEN)$(RM) $@ $@+ && \
-	sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
+	sed $(PERL_USE_LIB_REWRITE) \
 	    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
 	    -e 's|++GIT_BINDIR++|$(bindir)|g' \
 	    -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
-- 
1.5.6.85.g0a2e.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-06-21 22:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-20  2:31 [PATCH] gitweb: respect $GITPERLLIB Lea Wiemann
2008-06-20 19:35 ` [RFC/PATCH v2] " Lea Wiemann
2008-06-20 19:35   ` Lea Wiemann
2008-06-21  9:46     ` Junio C Hamano
2008-06-21 22:40       ` [RFC/PATCH v3] " Lea Wiemann

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).