git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Lea Wiemann <lewiemann@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC/PATCH v2] gitweb: respect $GITPERLLIB
Date: Sat, 21 Jun 2008 02:46:03 -0700	[thread overview]
Message-ID: <7vabhfazok.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 1213990547-7585-2-git-send-email-LeWiemann@gmail.com

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' \

  reply	other threads:[~2008-06-21  9:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2008-06-21 22:40       ` [RFC/PATCH v3] " Lea Wiemann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vabhfazok.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=lewiemann@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).