git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Jeff King <peff@peff.net>, Dan Jacques <dnj@google.com>,
	Alex Riesen <alexander.riesen@cetitec.com>,
	Brandon Casey <drafnel@gmail.com>, Petr Baudis <pasky@ucw.cz>,
	Gerrit Pape <pape@smarden.org>,
	"martin f . krafft" <madduck@madduck.net>,
	Eric Wong <e@80x24.org>,
	Ramsay Jones <ramsay@ramsayjones.plus.com>,
	"Randall S . Becker" <rsbecker@nexbridge.com>,
	Michael J Gruber <git@grubix.eu>, Todd Zullinger <tmz@pobox.com>,
	Brandon Williams <bmwill@google.com>
Subject: Re: [PATCH ab/simplify-perl-makefile] perl: treat PERLLIB_EXTRA as an extra path again (Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules)
Date: Tue, 02 Jan 2018 21:39:28 +0100	[thread overview]
Message-ID: <87lghgc7wf.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <20180102200140.GC131371@aiede.mtv.corp.google.com>


On Tue, Jan 02 2018, Jonathan Nieder jotted:

> Subject: perl: treat PERLLIB_EXTRA as an extra path again
>
> PERLLIB_EXTRA was introduced in v1.9-rc0~88^2 (2013-11-15) as a way
> for packagers to add additional directories such as the location of
> Subversion's perl bindings to Git's perl path.  Since 20d2a30f
> (Makefile: replace perl/Makefile.PL with simple make rules,
> 2012-12-10) setting that variable breaks perl-based commands instead:
>
>  $ PATH=$HOME/opt/git/bin:$PATH
>  $ make install prefix=$HOME/opt/git PERLLIB_EXTRA=anextralibdir
> [...]
>  $ head -2 $HOME/opt/git/libexec/git-core/git-add--interactive
>  #!/usr/bin/perl
>  use lib (split(/:/, $ENV{GITPERLLIB} || ":helloiamanextrainstlibdir" || "/usr/local/google/home/jrn/opt/git/share/perl5"));
>  $ git add -p
>  Empty compile time value given to use lib at /home/jrn/opt/git/libexec/git-core/git-add--interactive line 2.
>
> Removing the spurious ":" at the beginning of ":$PERLLIB_EXTRA" avoids
> the "Empty compile time value" error but with that tweak the problem
> still remains: PERLLIB_EXTRA ends up replacing instead of
> supplementing the perllibdir that would be passed to 'use lib' if
> PERLLIB_EXTRA were not set.
>
> The intent was to simplify, as the commit message to 20d2a30f
> explains:
>
> | The scripts themselves will 'use lib' the target directory, but if
> | INSTLIBDIR is set it overrides it. It doesn't have to be this way,
> | it could be set in addition to INSTLIBDIR, but my reading of
> | [v1.9-rc0~88^2] is that this is the desired behavior.
>
> Restore the previous code structure to make PERLLIB_EXTRA work again.
>
> Reproducing this problem requires an invocation of "make install"
> instead of running bin-wrappers/git in place, since the latter sets
> the GITPERLLIB environment variable, avoiding trouble.
>
> Reported-by: Jonathan Koren <jdkoren@google.com>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
> ---
> Jonathan Nieder wrote:
>> Hi,
>>
>> Ævar Arnfjörð Bjarmason wrote:
>>
>> > +++ b/Makefile
>> [...]
>> > -PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ)
>> > -$(SCRIPT_PERL_GEN): % : %.perl perl/perl.mak GIT-PERL-DEFINES GIT-VERSION-FILE
>> > +PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)
>> > +$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE
>> >  	$(QUIET_GEN)$(RM) $@ $@+ && \
>> > -	INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \
>> >  	INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
>> >  	INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
>> >  	sed -e '1{' \
>> >  	    -e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
>> >  	    -e '	h' \
>> > -	    -e '	s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'"));=' \
>> > +	    -e '	s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'" || "'"$(perllibdir_SQ)"'"));=' \
>>
>> This appears to have broken a build with INSTLIBDIR set.
>
> Here it is in patch form.
>
>  Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 5c73cd208a..409e8f6ec9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1951,12 +1951,13 @@ $(SCRIPT_PERL_GEN):
>  PERL_DEFINES = $(PERL_PATH_SQ):$(PERLLIB_EXTRA_SQ):$(perllibdir_SQ)
>  $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-VERSION-FILE
>  	$(QUIET_GEN)$(RM) $@ $@+ && \
> +	INSTLIBDIR='$(perllibdir_SQ)' && \
>  	INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
>  	INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
>  	sed -e '1{' \
>  	    -e '	s|#!.*perl|#!$(PERL_PATH_SQ)|' \
>  	    -e '	h' \
> -	    -e '	s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'" || "'"$(perllibdir_SQ)"'"));=' \
> +	    -e '	s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "'"$$INSTLIBDIR"'"));=' \
>  	    -e '	H' \
>  	    -e '	x' \
>  	    -e '}' \

This obviously makes perfect sense if the intent is to add this lib dir
instead of it being a replacement (as is clear from this being an issue
you're noting).

With the benefit of hindsight in re-reading the commit + this report I
can see that it *should* be that way, but I assumed it was the other way
around when I wrote this up.

Thanks!

      reply	other threads:[~2018-01-02 20:39 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-29 15:34 [RFC/PATCH] Makefile: replace the overly complex perl build system with something simple Ævar Arnfjörð Bjarmason
2017-11-29 19:54 ` [PATCH] Makefile: replace perl/Makefile.PL with simple make rules Ævar Arnfjörð Bjarmason
2017-11-30  2:11   ` Jonathan Nieder
2017-11-30  9:37     ` Ævar Arnfjörð Bjarmason
2017-11-30 20:59       ` Jonathan Nieder
2017-11-30 21:16         ` Eric Wong
2017-11-30 21:31   ` Jeff King
2017-11-30 22:30     ` Ævar Arnfjörð Bjarmason
2017-12-21 19:29     ` Alex Vandiver
2017-12-03 11:59   ` [PATCH v2] " Ævar Arnfjörð Bjarmason
2017-12-04 16:22     ` Junio C Hamano
2017-12-04 18:08       ` Ævar Arnfjörð Bjarmason
2017-12-04 19:42         ` Junio C Hamano
2017-12-04 19:51           ` Dan Jacques
2017-12-10 21:13   ` [PATCH v3] " Ævar Arnfjörð Bjarmason
2017-12-11 23:29     ` Junio C Hamano
2017-12-12 21:33     ` Randall S. Becker
2017-12-12 22:26       ` Ævar Arnfjörð Bjarmason
2017-12-15 10:35         ` Michael J Gruber
2017-12-15 15:09           ` Todd Zullinger
2017-12-15 17:31           ` Ævar Arnfjörð Bjarmason
2017-12-19 15:53             ` Junio C Hamano
2017-12-19 23:57               ` [PATCH v4] " Ævar Arnfjörð Bjarmason
2017-12-20  6:15                 ` Todd Zullinger
2017-12-20 11:52                   ` [PATCH v5] " Ævar Arnfjörð Bjarmason
2017-12-20 17:41                     ` Todd Zullinger
2017-12-20 18:24                       ` [PATCH v6] " Ævar Arnfjörð Bjarmason
2017-12-20 20:17                         ` Todd Zullinger
2017-12-21  7:22                         ` Alex Riesen
2017-12-22 19:07                         ` Junio C Hamano
2017-12-27 22:24                           ` Ævar Arnfjörð Bjarmason
2017-12-28 18:36                             ` Junio C Hamano
2018-01-02 19:17                         ` Jonathan Nieder
2018-01-02 20:01                           ` [PATCH ab/simplify-perl-makefile] perl: treat PERLLIB_EXTRA as an extra path again (Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules) Jonathan Nieder
2018-01-02 20:39                             ` Ævar Arnfjörð Bjarmason [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=87lghgc7wf.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=alexander.riesen@cetitec.com \
    --cc=bmwill@google.com \
    --cc=dnj@google.com \
    --cc=drafnel@gmail.com \
    --cc=e@80x24.org \
    --cc=git@grubix.eu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=madduck@madduck.net \
    --cc=pape@smarden.org \
    --cc=pasky@ucw.cz \
    --cc=peff@peff.net \
    --cc=ramsay@ramsayjones.plus.com \
    --cc=rsbecker@nexbridge.com \
    --cc=tmz@pobox.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.
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).