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)

2018-01-02 Thread Ævar Arnfjörð Bjarmason

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 
> Signed-off-by: Jonathan Nieder 
> ---
> 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!


[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)

2018-01-02 Thread Jonathan Nieder
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 
Signed-off-by: Jonathan Nieder 
---
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 '}' \
-- 
2.16.0.rc0.224.g99853183ba



Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules

2018-01-02 Thread Jonathan Nieder
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.

 $ head -2 /usr/local/git/current/libexec/git-core/git-add--interactive
 #!/usr/bin/perl
 use lib (split(/:/, $ENV{GITPERLLIB} || 
":/Applications/Xcode.app/Contents/Developer/Library/Perl/5.@{[sub{use Config; 
$Config{api_version}}->()]}/darwin-thread-multi-2level" || 
"/usr/local/git/current/share/perl5"));

(forgive the hackiness there).

Is there a reason we don't do

INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA=... &&
INSTLIBDIR=...

and

use lib ... || "'"$$INSTLIBDIR"'"));=' \

?

Thanks,
Jonathan


Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules

2017-12-28 Thread Junio C Hamano
Ævar Arnfjörð Bjarmason  writes:

>> Here is the difference as I see between what we already have and
>> this update, and a proposed summary.
>> ...
>
> When I read this back on the 22nd I missed that you were waiting on my
> feedback on this. Just saw What's Cooking now. Yes, LGTM:

Thanks!


Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules

2017-12-27 Thread Ævar Arnfjörð Bjarmason

On Fri, Dec 22 2017, Junio C. Hamano jotted:

> Ævar Arnfjörð Bjarmason   writes:
>
>> Signed-off-by: Ævar Arnfjörð Bjarmason 
>> ---
>
> Thanks, but I thought the patch was already in 'next' for a week or
> more and it's time to refine incrementally.
>
> Here is the difference as I see between what we already have and
> this update, and a proposed summary.
>
> -- >8 --
> From: Ævar Arnfjörð Bjarmason 
> Subject: perl: avoid *.pmc and fix Error.pm further
>
> The previous round tried to use *.pmc files but it confused RPM
> dependency analysis on some distros.  Install them as plain
> vanilla *.pm files instead.
>
> Also "local @_" construct did not properly work when goto 
> is used until recent versions of Perl.  Avoid it (and we do not
> need to localize it here anyway).

When I read this back on the 22nd I missed that you were waiting on my
feedback on this. Just saw What's Cooking now. Yes, LGTM:

Acked-by: Ævar Arnfjörð Bjarmason 
(if needed)
Signed-off-by: Ævar Arnfjörð Bjarmason 

> ---
> diff --git a/Makefile b/Makefile
> index ba6607b7e7..5c73cd208a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2274,14 +2274,14 @@ endif
>  po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
>   $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
>
> -PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)
> -PMCFILES := $(patsubst perl/%.pm,perl/build/lib/%.pmc,$(PMFILES))
> +LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm 
> perl/Git/*/*/*.pm)
> +LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
>
>  ifndef NO_PERL
> -all:: $(PMCFILES)
> +all:: $(LIB_PERL_GEN)
>  endif
>
> -perl/build/lib/%.pmc: perl/%.pm
> +perl/build/lib/%.pm: perl/%.pm
>   $(QUIET_GEN)mkdir -p $(dir $@) && \
>   sed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@
>
> diff --git a/perl/Git/Error.pm b/perl/Git/Error.pm
> index 5874672150..09bbc97390 100644
> --- a/perl/Git/Error.pm
> +++ b/perl/Git/Error.pm
> @@ -39,7 +39,7 @@ sub import {
>   require Error;
>  };
>
> -local @_ = ($caller, @_);
> +unshift @_, $caller;
>  goto ::import;
>  }
>


Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules

2017-12-22 Thread Junio C Hamano
Ævar Arnfjörð Bjarmason   writes:

> Signed-off-by: Ævar Arnfjörð Bjarmason 
> ---

Thanks, but I thought the patch was already in 'next' for a week or
more and it's time to refine incrementally.

Here is the difference as I see between what we already have and
this update, and a proposed summary.

-- >8 --
From: Ævar Arnfjörð Bjarmason 
Subject: perl: avoid *.pmc and fix Error.pm further

The previous round tried to use *.pmc files but it confused RPM
dependency analysis on some distros.  Install them as plain
vanilla *.pm files instead.

Also "local @_" construct did not properly work when goto 
is used until recent versions of Perl.  Avoid it (and we do not
need to localize it here anyway).


---
diff --git a/Makefile b/Makefile
index ba6607b7e7..5c73cd208a 100644
--- a/Makefile
+++ b/Makefile
@@ -2274,14 +2274,14 @@ endif
 po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
 
-PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)
-PMCFILES := $(patsubst perl/%.pm,perl/build/lib/%.pmc,$(PMFILES))
+LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm 
perl/Git/*/*/*.pm)
+LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
 
 ifndef NO_PERL
-all:: $(PMCFILES)
+all:: $(LIB_PERL_GEN)
 endif
 
-perl/build/lib/%.pmc: perl/%.pm
+perl/build/lib/%.pm: perl/%.pm
$(QUIET_GEN)mkdir -p $(dir $@) && \
sed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@
 
diff --git a/perl/Git/Error.pm b/perl/Git/Error.pm
index 5874672150..09bbc97390 100644
--- a/perl/Git/Error.pm
+++ b/perl/Git/Error.pm
@@ -39,7 +39,7 @@ sub import {
require Error;
 };
 
-local @_ = ($caller, @_);
+unshift @_, $caller;
 goto ::import;
 }
 


Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules

2017-12-20 Thread Alex Riesen
Ævar Arnfjörð Bjarmason, Wed, Dec 20, 2017 19:24:19 +0100:
> diff --git a/INSTALL b/INSTALL
> index ffb071e9f0..808e07b659 100644
> --- a/INSTALL
> +++ b/INSTALL
> @@ -84,9 +84,24 @@ Issues of note:
>  
>   GIT_EXEC_PATH=`pwd`
>   PATH=`pwd`:$PATH
> - GITPERLLIB=`pwd`/perl/blib/lib
> + GITPERLLIB=`pwd`/perl/build/lib
>   export GIT_EXEC_PATH PATH GITPERLLIB

Sincerely sorry for off-topic, I just wonder why this section of INSTALL
uses the backticks for command substitution. Is there a shell which does not
support the alternative form $(...) but has all the rest of the used syntax?


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules

2017-12-20 Thread Todd Zullinger
Ævar Arnfjörð Bjarmason wrote:
> On Wed, Dec 20, 2017 at 6:41 PM, Todd Zullinger  wrote:
>> /usr/share/perl5/vendor_perl/Git
>> /usr/share/perl5/vendor_perl/Git.pm
>> /usr/share/perl5/vendor_perl/Git/Error.pm
>> [...]
>> /usr/share/perl5/vendor_perl/build
>> /usr/share/perl5/vendor_perl/build/lib
>> /usr/share/perl5/vendor_perl/build/lib/Git
>> /usr/share/perl5/vendor_perl/build/lib/Git.pm
>> /usr/share/perl5/vendor_perl/build/lib/Git/Error.pm
>> [...]
>> Note that not all of the .pm files are matched, which I
>> believe is due to the glob matches only going 4 levels deep
>> under the perl dir.
> 
> Ouch, that's a stupid mistake of mine. Didn't consider that changing
> it from *.pm to *.pmc would of course impact that glob match.
> 
> This fixes it, changes against v5:
> 
> @@ -224,7 +224,7 @@
>   po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
> $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
>   
> -+LIB_PERL := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm 
> perl/*/*/*/*.pm)
> ++LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm 
> perl/Git/*/*/*.pm)
>  +LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
>  +
>  +ifndef NO_PERL
> 
> I.e. let's keep calling it "build" for consistency with other stuff
> and so "ls" will show it, but just alter the glob so we'll only match
> modules like Git{,::*}. I don't think we'll ever add anything outside
> that namespace, so this seems like the best solution.

Sounds good.  While it might not have been too bad to have a
hidden dir for build artifacts, using the more explicit glob
pattern is much nicer.

I'll use this locally and let you know if I notice any
issues.  Thanks for working on this.

-- 
Todd
~~
Some people never go crazy. What truly horrible lives they must
live.
-- Charles Bukowski



[PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules

2017-12-20 Thread Ævar Arnfjörð Bjarmason
Replace the perl/Makefile.PL and the fallback perl/Makefile used under
NO_PERL_MAKEMAKER=NoThanks with a much simpler implementation heavily
inspired by how the i18n infrastructure's build process works[1].

The reason for having the Makefile.PL in the first place is that it
was initially[2] building a perl C binding to interface with libgit,
this functionality, that was removed[3] before Git.pm ever made it to
the master branch.

We've since since started maintaining a fallback perl/Makefile, as
MakeMaker wouldn't work on some platforms[4]. That's just the tip of
the iceberg. We have the PM.stamp hack in the top-level Makefile[5] to
detect whether we need to regenerate the perl/perl.mak, which I fixed
just recently to deal with issues like the perl version changing from
under us[6].

There is absolutely no reason for why this needs to be so complex
anymore. All we're getting out of this elaborate Rube Goldberg machine
was copying perl/* to perl/blib/* as we do a string-replacement on
the *.pm files to hardcode @@LOCALEDIR@@ in the source, as well as
pod2man-ing Git.pm & friends.

So replace the whole thing with something that's pretty much a copy of
how we generate po/build/**.mo from po/*.po, just with a small sed(1)
command instead of msgfmt.

While I'm at it, change the fallback for Error.pm from being something
where we'll ship our own Error.pm if one doesn't exist at build time
to one where we just use a Git::Error wrapper that'll always prefer
the system-wide Error.pm, only falling back to our own copy if it
really doesn't exist at runtime. It's now shipped as
Git::FromCPAN::Error, making it easy to add other modules to
Git::FromCPAN::* in the future if that's needed.

Functional changes:

 * This will not always install into perl's idea of its global
   "installsitelib". This only potentially matters for packagers that
   need to expose Git.pm for non-git use, and as explained in the
   INSTALL file there's a trivial workaround.

 * 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 [7] is
   that this is the desired behavior.

 * We don't build man pages for all of the perl modules as we used to,
   only Git(3pm). As discussed on-list[8] that we were building
   installed manpages for purely internal APIs like Git::I18N or
   private-Error.pm was always a bug anyway, and all the Git::SVN::*
   ones say they're internal APIs.

   There are apparently external users of Git.pm, but I don't expect
   there to be any of the others.

   As a side-effect of these general changes the perl documentation
   now only installed by install-{doc,man}, not a mere "install" as
   before.

1. 5e9637c629 ("i18n: add infrastructure for translating Git with
   gettext", 2011-11-18)

2. b1edc53d06 ("Introduce Git.pm (v4)", 2006-06-24)

3. 18b0fc1ce1 ("Git.pm: Kill Git.xs for now", 2006-09-23)

4. f848718a69 ("Make perl/ build procedure ActiveState friendly.",
   2006-12-04)

5. ee9be06770 ("perl: detect new files in MakeMaker builds",
   2012-07-27)

6. c59c4939c2 ("perl: regenerate perl.mak if perl -V changes",
   2017-03-29)

7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
   default perl path", 2013-11-15)

8. 87bmjjv1pu@evledraar.booking.com ("Re: [PATCH] Makefile:
   replace perl/Makefile.PL with simple make rules"

Signed-off-by: Ævar Arnfjörð Bjarmason 
---

On Wed, Dec 20, 2017 at 6:41 PM, Todd Zullinger  wrote:
> /usr/share/perl5/vendor_perl/Git
> /usr/share/perl5/vendor_perl/Git.pm
> /usr/share/perl5/vendor_perl/Git/Error.pm
> [...]
> /usr/share/perl5/vendor_perl/build
> /usr/share/perl5/vendor_perl/build/lib
> /usr/share/perl5/vendor_perl/build/lib/Git
> /usr/share/perl5/vendor_perl/build/lib/Git.pm
> /usr/share/perl5/vendor_perl/build/lib/Git/Error.pm
> [...]
> Note that not all of the .pm files are matched, which I
> believe is due to the glob matches only going 4 levels deep
> under the perl dir.

Ouch, that's a stupid mistake of mine. Didn't consider that changing
it from *.pm to *.pmc would of course impact that glob match.

This fixes it, changes against v5:

@@ -224,7 +224,7 @@
  po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
  
-+LIB_PERL := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm 
perl/*/*/*/*.pm)
++LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm 
perl/Git/*/*/*.pm)
 +LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
 +
 +ifndef NO_PERL

I.e. let's keep calling it "build" for consistency with other stuff
and so "ls" will show it, but just alter the glob so we'll only match
modules like Git{,::*}. I don't think we'll ever add anything outside
that namespace, so this seems like the best solution.

With this "make install" gives the expected results, i.e. no