Skip to contentSkip to conversation

Makefile: replace the overly complex perl build system with something simple

RFC/PATCH Superseded Ævar Arnfjörð Bjarmason 11 participants 35 messages Nov 29, 2017 – Jan 2, 2018 Kbuild

lore
Share & tools
lore
#0 lore raw

As the history of perl/Makefile.PL reveals the reason we have it in the first place is because during its initial development the perl bindings would link to libgit, building such a module with any sanity requires ExtUtils::MakeMaker and Devel::PPPort.

However, since then this grew into a much simpler problem while keeping all the complexity of the initial implementation. We just need to take the files in perl/**.pm, copy them to a build directory while search/replacing one string (@@LOCALEDIR@@), and have them available for the likes of git-svn once Git is installed.

This patch is a WIP effort to do that. Trade-offs this makes & other caveats:

* 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, but my reading of 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to default perl path", 2013-11-15) is that this does the right thing, but I may be wrong.

* We don't build the Git(3) Git::I18N(3) etc. man pages from the embedded perldoc. I suspect nobody really cares, these are mostly internal APIs, and if someone's developing against them they likely know enough to issue a "perldoc" against the installed file to get the same result.

But this is a change in how Git is installed now on e.g. CentOS & Debian which carry these manpages. They could be added (via pod2man) if anyone really cares.

* Currently the Error.pm fallback doesn't work. This is a TODO item, but I didn't have enough time to hack this up.

I think that whole thing should be changed, we're checking an ancient Error.pm version that was released in 2006, we should just stop that, then we check *at build time* whether the library is there, instead we should call it/load it via e.g. Git::Error which would be a small wrapper that would either load Error.pm from the system, or use our copy in Git::Error_CPAN.

---

So *long* CC list but a lot of people have touched this stuff over the years. This obviously conflicts with Dan Jacques's patches in a big way, but I think it's worth it to rebase them on top of this if there's interest in this, and depending on what people think about the caveats I've noted about this above.

 INSTALL               | 18 ++++++++++-
 Makefile              | 51 +++++++++++++----------------
 perl/.gitignore       |  9 +-----
 perl/Git/I18N.pm      |  2 +-
 perl/Makefile         | 90 ---------------------------------------------------
 perl/Makefile.PL      | 62 -----------------------------------
 t/perf/aggregate.perl |  2 +-
 t/test-lib.sh         |  2 +-
 wrap-for-bin.sh       |  2 +-
 9 files changed, 45 insertions(+), 193 deletions(-)
 delete mode 100644 perl/Makefile
 delete mode 100644 perl/Makefile.PL
INSTALL +17 -1
index ffb071e9f0..e6266a9127 100644
@@ -84,9 +84,25 @@ Issues of note:
 
 	GIT_EXEC_PATH=`pwd`
 	PATH=`pwd`:$PATH
-	GITPERLLIB=`pwd`/perl/blib/lib
+	GITPERLLIB=`pwd`/perl/build
 	export GIT_EXEC_PATH PATH GITPERLLIB
 
+ - By default (unless NO_PERL is provided) Git will ship various perl
+   scripts & libraries it needs. However, for simplicity it doesn't
+   use the ExtUtils::MakeMaker toolchain to decide where to place the
+   perl libraries. Depending on the system this can result in the perl
+   libraries not being where you'd like them if they're expected to be
+   used by things other than Git itself.
+
+   Manually supplying a perllibdir prefix should fix this, if this is
+   a problem you care about, e.g.:
+
+       prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wE 'my ($relsite) = $Config{installsitelib} =~ m[^\Q$Config{siteprefixexp}\E/(.+)]s; say $relsite')
+
+   Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,
+   perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS
+   etc.
+
  - Git is reasonably self-sufficient, but does depend on a few external
    programs and libraries.  Git can be used without most of them by adding
    the approriate "NO_<LIBRARY>=YesPlease" to the make command line or
Makefile +23 -28

125 lines not on this page · raw message

perl/.gitignore +1 -8
index 0f1fc27f86..84c048a73c 100644
@@ -1,8 +1 @@
-perl.mak
-perl.mak.old
-MYMETA.json
-MYMETA.yml
-blib
-blibdirs
-pm_to_blib
-PM.stamp
+/build/
perl/Git/I18N.pm +1 -1
index 836a5c2382..dba96fff0a 100644
@@ -18,7 +18,7 @@ our @EXPORT_OK = @EXPORT;
 
 sub __bootstrap_locale_messages {
 	our $TEXTDOMAIN = 'git';
-	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';
+	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
 
 	require POSIX;
 	POSIX->import(qw(setlocale));
perl/Makefile deleted +0 -90

90 lines not on this page · raw message

perl/Makefile.PL deleted +0 -62

62 lines not on this page · raw message

t/perf/aggregate.perl +1 -1
index 1dbc85b214..0ef5cf1c60 100755
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use lib '../../perl/blib/lib';
+use lib '../../perl/build';
 use strict;
 use warnings;
 use Git;
t/test-lib.sh +1 -1
index 116bd6a70c..69d81e1c97 100644
@@ -919,7 +919,7 @@ then
 	fi
 fi
 
-GITPERLLIB="$GIT_BUILD_DIR"/perl/blib/lib:"$GIT_BUILD_DIR"/perl/blib/arch/auto/Git
+GITPERLLIB="$GIT_BUILD_DIR"/perl/build
 export GITPERLLIB
 test -d "$GIT_BUILD_DIR"/templates/blt || {
 	error "You haven't built things yet, have you?"
wrap-for-bin.sh +1 -1
index 22b6e4948f..7a8429bcc9 100644
@@ -14,7 +14,7 @@ else
 	GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
 	export GIT_TEMPLATE_DIR
 fi
-GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GITPERLLIB='@@BUILD_DIR@@/perl/build'"${GITPERLLIB:+:$GITPERLLIB}"
 GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
 PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
 
Signature · 1 line
2.15.0.403.gc27cc4dac6
#1 lore raw

PATCH 1/1 Makefile: replace perl/Makefile.PL with simple make rules

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.

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. As that's being done rename the files from *.pm to *.pmc just to indicate that they're genreated (see "perldoc -f require").

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 the Git(3) Git::I18N(3) etc. man pages from the embedded perldoc. I suspect nobody really cares, these are mostly internal APIs, and if someone's developing against them they likely know enough to issue a "perldoc" against the installed file to get the same result.

But this is a change in how Git is installed now on e.g. CentOS & Debian which carry these manpages. They could be added (via pod2man) if anyone really cares.

I doubt they will. The reason these were built in the first place was as a side-effect of how ExtUtils::MakeMaker works.

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)

---

Here's the non-RFC version. I think this is ready to be applied, fixing that issue with Error.pm was easier than I thought.

 INSTALL                                          | 17 ++++-
 Makefile                                         | 53 +++++++-------
 contrib/examples/git-difftool.perl               |  2 +-
 git-send-email.perl                              |  2 +-
 perl/.gitignore                                  |  9 +--
 perl/Git.pm                                      |  2 +-
 perl/Git/Error.pm                                | 47 +++++++++++++
 perl/{private-Error.pm => Git/FromCPAN/Error.pm} |  0
 perl/Git/I18N.pm                                 |  2 +-
 perl/Makefile                                    | 90 ------------------------
 perl/Makefile.PL                                 | 62 ----------------
 t/perf/aggregate.perl                            |  2 +-
 t/test-lib.sh                                    |  2 +-
 wrap-for-bin.sh                                  |  2 +-
 14 files changed, 95 insertions(+), 197 deletions(-)
 create mode 100644 perl/Git/Error.pm
 rename perl/{private-Error.pm => Git/FromCPAN/Error.pm} (100%)
 delete mode 100644 perl/Makefile
 delete mode 100644 perl/Makefile.PL
INSTALL +16 -1
index ffb071e9f0..822ed16095 100644
@@ -84,9 +84,24 @@ Issues of note:
 
 	GIT_EXEC_PATH=`pwd`
 	PATH=`pwd`:$PATH
-	GITPERLLIB=`pwd`/perl/blib/lib
+	GITPERLLIB=`pwd`/perl/build
 	export GIT_EXEC_PATH PATH GITPERLLIB
 
+ - By default (unless NO_PERL is provided) Git will ship various perl
+   scripts & libraries it needs. However, for simplicity it doesn't
+   use the ExtUtils::MakeMaker toolchain to decide where to place the
+   perl libraries. Depending on the system this can result in the perl
+   libraries not being where you'd like them if they're expected to be
+   used by things other than Git itself.
+
+   Manually supplying a perllibdir prefix should fix this, if this is
+   a problem you care about, e.g.:
+
+       prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wle 'print substr $Config{installsitelib}, 1 + length $Config{siteprefixexp}')
+
+   Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,
+   perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS.
+
  - Git is reasonably self-sufficient, but does depend on a few external
    programs and libraries.  Git can be used without most of them by adding
    the approriate "NO_<LIBRARY>=YesPlease" to the make command line or
Makefile +24 -29

126 lines not on this page · raw message

contrib/examples/git-difftool.perl +1 -1
index df59bdfe97..fb0fd0b84b 100755
@@ -13,7 +13,7 @@
 use 5.008;
 use strict;
 use warnings;
-use Error qw(:try);
+use Git::Error qw(:try);
 use File::Basename qw(dirname);
 use File::Copy;
 use File::Find;
git-send-email.perl +1 -1
index 2208dcc213..88a0edcd7d 100755
@@ -26,7 +26,7 @@ use Text::ParseWords;
 use Term::ANSIColor;
 use File::Temp qw/ tempdir tempfile /;
 use File::Spec::Functions qw(catdir catfile);
-use Error qw(:try);
+use Git::Error qw(:try);
 use Cwd qw(abs_path cwd);
 use Git;
 use Git::I18N;
perl/.gitignore +1 -8
index 0f1fc27f86..84c048a73c 100644
@@ -1,8 +1 @@
-perl.mak
-perl.mak.old
-MYMETA.json
-MYMETA.yml
-blib
-blibdirs
-pm_to_blib
-PM.stamp
+/build/
perl/Git.pm +1 -1
index ffa09ace92..02a3871e94 100644
@@ -101,7 +101,7 @@ increase notwithstanding).
 
 
 use Carp qw(carp croak); # but croak is bad - throw instead
-use Error qw(:try);
+use Git::Error qw(:try);
 use Cwd qw(abs_path cwd);
 use IPC::Open2 qw(open2);
 use Fcntl qw(SEEK_SET SEEK_CUR);
perl/Git/Error.pm new file +47 -0

47 lines not on this page · raw message

perl/Git/FromCPAN/Error.pm renamed from perl/private-Error.pm +0 -0
similarity index 100%
rename from perl/private-Error.pm
rename to perl/Git/FromCPAN/Error.pm
perl/Git/I18N.pm +1 -1
index 836a5c2382..dba96fff0a 100644
@@ -18,7 +18,7 @@ our @EXPORT_OK = @EXPORT;
 
 sub __bootstrap_locale_messages {
 	our $TEXTDOMAIN = 'git';
-	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';
+	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
 
 	require POSIX;
 	POSIX->import(qw(setlocale));
perl/Makefile deleted +0 -90

90 lines not on this page · raw message

perl/Makefile.PL deleted +0 -62

62 lines not on this page · raw message

t/perf/aggregate.perl +1 -1
index 1dbc85b214..0ef5cf1c60 100755
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use lib '../../perl/blib/lib';
+use lib '../../perl/build';
 use strict;
 use warnings;
 use Git;
t/test-lib.sh +1 -1
index 116bd6a70c..69d81e1c97 100644
@@ -919,7 +919,7 @@ then
 	fi
 fi
 
-GITPERLLIB="$GIT_BUILD_DIR"/perl/blib/lib:"$GIT_BUILD_DIR"/perl/blib/arch/auto/Git
+GITPERLLIB="$GIT_BUILD_DIR"/perl/build
 export GITPERLLIB
 test -d "$GIT_BUILD_DIR"/templates/blt || {
 	error "You haven't built things yet, have you?"
wrap-for-bin.sh +1 -1
index 22b6e4948f..7a8429bcc9 100644
@@ -14,7 +14,7 @@ else
 	GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
 	export GIT_TEMPLATE_DIR
 fi
-GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GITPERLLIB='@@BUILD_DIR@@/perl/build'"${GITPERLLIB:+:$GITPERLLIB}"
 GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
 PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
 
Signature · 1 line
2.15.0.403.gc27cc4dac6
#2 lore raw

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

Hi,

Quoted 3 lines · Æ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].

Yay! This looks exciting.

One quick comment:

[...]

Quoted 6 lines

* We don't build the Git(3) Git::I18N(3) etc. man pages from the embedded perldoc. I suspect nobody really cares, these are mostly internal APIs, and if someone's developing against them they likely know enough to issue a "perldoc" against the installed file to get the same result.

Quoted 6 lines

But this is a change in how Git is installed now on e.g. CentOS & Debian which carry these manpages. They could be added (via pod2man) if anyone really cares.

I doubt they will. The reason these were built in the first place was as a side-effect of how ExtUtils::MakeMaker works.

Debian cares (see
https://www.debian.org/doc/packaging-manuals/perl-policy/ch-module_packages.html
for details).

I'll try applying this patch and seeing what happens some time this week.

Thanks,
Jonathan

#3 lore raw

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

On Thu, Nov 30 2017, Jonathan Nieder jotted:

Quoted 26 lines

Hi,

Quoted 3 lines · Æ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].

Yay! This looks exciting.

One quick comment:

[...]

Quoted 6 lines

* We don't build the Git(3) Git::I18N(3) etc. man pages from the embedded perldoc. I suspect nobody really cares, these are mostly internal APIs, and if someone's developing against them they likely know enough to issue a "perldoc" against the installed file to get the same result.

Quoted 6 lines

But this is a change in how Git is installed now on e.g. CentOS & Debian which carry these manpages. They could be added (via pod2man) if anyone really cares.

I doubt they will. The reason these were built in the first place was as a side-effect of how ExtUtils::MakeMaker works.

Quoted 6 lines

Debian cares (see
https://www.debian.org/doc/packaging-manuals/perl-policy/ch-module_packages.html
for details).

I'll try applying this patch and seeing what happens some time this week.

It just says you have to install the manpages in such-and-such a place, but I don't have any. There, policy issue fixed :)

More seriously, it seems to me that the only reason we have these manpages in the first place is because of emergent effects. *Maybe* I'm wrong about someone using Git.pm as an external API, is that the case?

I was assuming this was more of a case where we were manifying the equivalent of Documentation/technical/api-*.txt and shipping them as user docs just because that's what EU::MM will do by default, and nobody thought to stop it.

But sure, if we still want these I can just provide them, here's the relevant generated perl.mak section:

	POD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--"
	POD2MAN = $(POD2MAN_EXE)
	manifypods : pure_all config  \
		Git.pm \
		Git/I18N.pm \
		Git/SVN/Editor.pm \
		Git/SVN/Fetcher.pm \
		Git/SVN/Memoize/YAML.pm \
		Git/SVN/Prompt.pm \
		Git/SVN/Ra.pm \
		Git/SVN/Utils.pm
		$(NOECHO) $(POD2MAN) --section=$(MAN3EXT) --perm_rw=$(PERM_RW) -u \
		  Git.pm $(INST_MAN3DIR)/Git.$(MAN3EXT) \
		  Git/I18N.pm $(INST_MAN3DIR)/Git::I18N.$(MAN3EXT) \
		  Git/SVN/Editor.pm $(INST_MAN3DIR)/Git::SVN::Editor.$(MAN3EXT) \
		  Git/SVN/Fetcher.pm $(INST_MAN3DIR)/Git::SVN::Fetcher.$(MAN3EXT) \
		  Git/SVN/Memoize/YAML.pm $(INST_MAN3DIR)/Git::SVN::Memoize::YAML.$(MAN3EXT) \
		  Git/SVN/Prompt.pm $(INST_MAN3DIR)/Git::SVN::Prompt.$(MAN3EXT) \
		  Git/SVN/Ra.pm $(INST_MAN3DIR)/Git::SVN::Ra.$(MAN3EXT) \
		  Git/SVN/Utils.pm $(INST_MAN3DIR)/Git::SVN::Utils.$(MAN3EXT)

I.e. we'd just need to create the mandir, then call pod2man.

However, even then we should consider what I've noted above and decide which modules we really want to be shipping docs for, e.g. Git::I18n is never going to be used by anyone external, nor is the Git::SVN stuff.

I think the only thing we're talking about shipping manpages for is *maybe* just Git.pm itself, no?

I don't really care, so if others want to ship them all I'll just hack it up. This just seemed like a bug to fix while I was at it.

#4 lore raw

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

Quoted 8 lines · Ævar Arnfjörð Bjarmason

On Thu, Nov 30 2017, Jonathan Nieder jotted:

Quoted 7 lines
Quoted 5 lines · Ævar Arnfjörð Bjarmason

* We don't build the Git(3) Git::I18N(3) etc. man pages from the embedded perldoc. I suspect nobody really cares, these are mostly internal APIs, and if someone's developing against them they likely know enough to issue a "perldoc" against the installed file to get the same result.

[...]

Quoted 3 lines
Quoted 3 lines

Debian cares (see
https://www.debian.org/doc/packaging-manuals/perl-policy/ch-module_packages.html
for details).

[...]

Quoted 6 lines

It just says you have to install the manpages in such-and-such a place, but I don't have any. There, policy issue fixed :)

More seriously, it seems to me that the only reason we have these manpages in the first place is because of emergent effects. *Maybe* I'm wrong about someone using Git.pm as an external API, is that the case?

Yeah, people really do use Git.pm as an external API.

Unlike e.g. something on CPAN, its API stability guarantees are not great, so I am not saying I recommend it, but people have been using it that way.

If we want to prevent this, then we should not be installing it in the public perl module path. Or we should at least add a note to the manpages we ship :) to recommend not using it.

Thanks,
Jonathan

#5 lore raw

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

Quoted 1 line · Jonathan Nieder

Yeah, people really do use Git.pm as an external API.

Yikes :<

Quoted 3 lines

If we want to prevent this, then we should not be installing it in the public perl module path. Or we should at least add a note to the manpages we ship :) to recommend not using it.

I think a note in manpages is fine; maybe a load-time warning to non-git.git users. We shouldn't be breaking other peoples' code when they upgrade, though.

#6 lore raw

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

In reply to Ævar Arnfjörð Bjarmason
Quoted 3 lines · Æ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].

I'm very happy to see the recursive make invocation go away. The perl makefile generation was one of the few places where parallel make could racily get confused (though I haven't seen that for a while, so maybe it was fixed alongside some of the other .stamp work you did).

Quoted 4 lines

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.

Thanks for doing all this history digging. I agree that it doesn't seem like there's really any reason to carry the complexity. Of your functional changes, the only one that gives me pause is:

Quoted 4 lines

* 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.

This could be a minor hiccup for people using Git.pm from other scripts. But maybe only in funny setups? It seems like $prefix/share/perl5 would be in most people's @INC unless they are doing something exotic.

Quoted 5 lines

* We don't build the Git(3) Git::I18N(3) etc. man pages from the embedded perldoc. I suspect nobody really cares, these are mostly internal APIs, and if someone's developing against them they likely know enough to issue a "perldoc" against the installed file to get the same result.

I don't have a real opinion on this, but it sounds from the rest of the thread like we should maybe build these to be on the safe side.

Makefile endif · line 2276

Quoted 5 lines
Makefile +1 -0
@@ -2291,6 +2273,17 @@ 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)

Yuck. :) I don't think there's a better wildcard solution within make, though. And I'd rather see this than doing a $(shell) to "find" or similar.

The other option is to actually list the files, as we do for .o files. That's a minor pain to update, but it would allow things like differentiating which ones get their documentation built.

Makefile endif · line 2277

Quoted 1 line
Makefile +1 -0
+PMCFILES := $(patsubst perl/%.pm,perl/build/%.pmc,$(PMFILES))

TIL about pmc files. It sounds like they've had a storied history, but should be supported everywhere.

Quoted 1 line

[...]

The rest of the patch all looked good to me. Thanks for working on this.

-Peff

#7 lore raw

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

On Thu, Nov 30 2017, Jeff King jotted:

Quoted 20 lines · Ævar Arnfjörð Bjarmason
Quoted 4 lines

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].

I'm very happy to see the recursive make invocation go away. The perl makefile generation was one of the few places where parallel make could racily get confused (though I haven't seen that for a while, so maybe it was fixed alongside some of the other .stamp work you did).

Quoted 4 lines

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.

Thanks for doing all this history digging. I agree that it doesn't seem like there's really any reason to carry the complexity. Of your functional changes, the only one that gives me pause is:

Quoted 8 lines
Quoted 4 lines

* 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.

This could be a minor hiccup for people using Git.pm from other scripts. But maybe only in funny setups? It seems like $prefix/share/perl5 would be in most people's @INC unless they are doing something exotic.

I think so, but I'm not 100% sure. I'm hoping downstream maintainers will catch this one if it's an issue, but in many cases it'll just work, e.g. I have /usr/share/perl5 in /usr/bin/perl's @INC on Debian even though that's not the target install dir EU::MM would have picked.

Whether there's perl configurations that don't have $prefix/share/perl5 in @INC at all I don't know.

Quoted 8 lines
Quoted 5 lines

* We don't build the Git(3) Git::I18N(3) etc. man pages from the embedded perldoc. I suspect nobody really cares, these are mostly internal APIs, and if someone's developing against them they likely know enough to issue a "perldoc" against the installed file to get the same result.

I don't have a real opinion on this, but it sounds from the rest of the thread like we should maybe build these to be on the safe side.

Indeed, we'll need to ship at least the Git.3pm manpage.

I tried coming up with something that worked like the current Makefile.PL but couldn't figure out how I'd generate a::file::like::this.3pm from a/file/like/this.pm

So I hacked up the following minimal patch to just build Git.3pm:

	diff --git a/Makefile b/Makefile
	index 48f1b868d1..ba6607b7e7 100644
	--- a/Makefile
	+++ b/Makefile
	@@ -1709,6 +1709,7 @@ ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
	 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
	 bindir_SQ = $(subst ','\'',$(bindir))
	 bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
	+mandir_SQ = $(subst ','\'',$(mandir))
	 mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
	 infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
	 perllibdir_SQ = $(subst ','\'',$(perllibdir))
	@@ -2284,6 +2285,10 @@ perl/build/lib/%.pmc: perl/%.pm
	 	$(QUIET_GEN)mkdir -p $(dir $@) && \
	 	sed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@

	+perl/build/man/man3/Git.3pm: perl/Git.pm
	+	$(QUIET_GEN)mkdir -p $(dir $@) && \
	+	pod2man $< $@
	+
	 FIND_SOURCE_FILES = ( \
	 	git ls-files \
	 		'*.[hcS]' \
	@@ -2595,12 +2600,17 @@ endif
	 install-gitweb:
	 	$(MAKE) -C gitweb install

	-install-doc:
	+install-doc: install-man-perl
	 	$(MAKE) -C Documentation install

	-install-man:
	+install-man: install-man-perl
	 	$(MAKE) -C Documentation install-man

	+install-man-perl: perl/build/man/man3/Git.3pm
	+	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
	+	(cd perl/build/man/man3 && $(TAR) cf - .) | \
	+	(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)
	+
	 install-html:
	 	$(MAKE) -C Documentation install-html

Maybe this approach is bad, I don't know. This might be a better fit for Documentation/Makefile since it has some "man" logic already, but do we want it to be depending on stuff in ../perl?

On my Debian install I have these from existing Git:

    /usr/share/man/man3/Git.3pm.gz
    /usr/share/man/man3/Git::I18N.3pm.gz
    /usr/share/man/man3/private-Error.3pm.gz

We definitely don't want the 2nd two ones to have manpages, that was always an accident. git-svn has a few more:

    /usr/share/man/man3/Git::SVN::Editor.3pm.gz
    /usr/share/man/man3/Git::SVN::Fetcher.3pm.gz
    /usr/share/man/man3/Git::SVN::Memoize::YAML.3pm.gz
    /usr/share/man/man3/Git::SVN::Prompt.3pm.gz
    /usr/share/man/man3/Git::SVN::Ra.3pm.gz
    /usr/share/man/man3/Git::SVN::Utils.3pm.gz

But those all say that they're internal API only. So maybe this hack of mine is fine. What do others think?

In any case, a solution that tries to build all the manpages with a glob is going to suck currently since some of them have POD, and others don't, which gets us into the headache of trying to distinguish whether something has POD v.s. whether we just had pod2man fail.

So it seems better just to whitelist the man3 pages that get build, which to me seems like just one currently.

Quoted 24 lines

Makefile endif · line 2276

Quoted 5 lines
Makefile +1 -0
@@ -2291,6 +2273,17 @@ 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)

Yuck. :) I don't think there's a better wildcard solution within make, though. And I'd rather see this than doing a $(shell) to "find" or similar.

The other option is to actually list the files, as we do for .o files. That's a minor pain to update, but it would allow things like differentiating which ones get their documentation built.

Makefile endif · line 2277

Quoted 1 line
Makefile +1 -0
+PMCFILES := $(patsubst perl/%.pm,perl/build/%.pmc,$(PMFILES))

TIL about pmc files. It sounds like they've had a storied history, but should be supported everywhere.

Quoted 1 line

[...]

The rest of the patch all looked good to me. Thanks for working on this.

-Peff

#8 lore raw

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

In reply to Jeff King
Quoted 10 lines · Jeff King
Quoted 3 lines · Æ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].

I'm very happy to see the recursive make invocation go away. The perl makefile generation was one of the few places where parallel make could racily get confused (though I haven't seen that for a while, so maybe it was fixed alongside some of the other .stamp work you did).

As a datapoint, I've seen it fairly regularly with -j8 in 2.15.1 builds from a clean tree that I've been doing recently. I'm looking forward to not having to make the choice between "maybe run it twice" or "compile slower" -- this looks great!
- Alex

#9 lore raw

PATCH v2 1/1 Makefile: replace perl/Makefile.PL with simple make rules

In reply to Æ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. As that's being done rename the files from *.pm to *.pmc just to indicate that they're genreated (see "perldoc -f require").

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 man pages for all of the perl modules as we used t, 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. [email protected] ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"

---

Per my reading of the list discussion this should be OK to apply. We now build the manpage for Git.pm (but no other *.pm, as discussed).

Aside from the improved commit message & POD building I updated the INSTALL instructions & we now build stuff in perl/build/{lib,man} instead of just PM stuff in perl/build/lib. tbdiff with v2 follows:

    1: 6eae4593dc ! 1: 90ee965ea6 Makefile: replace perl/Makefile.PL with simple make rules
        @@ -21,7 +21,8 @@
             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.
        +    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)
        @@ -49,18 +50,18 @@
                it could be set in addition to INSTLIBDIR, but my reading of [7] is
                that this is the desired behavior.
             
        -     * We don't build the Git(3) Git::I18N(3) etc. man pages from the
        -       embedded perldoc. I suspect nobody really cares, these are mostly
        -       internal APIs, and if someone's developing against them they likely
        -       know enough to issue a "perldoc" against the installed file to get
        -       the same result.
        -    
        -       But this is a change in how Git is installed now on e.g. CentOS &
        -       Debian which carry these manpages. They could be added (via
        -       pod2man) if anyone really cares.
        -    
        -       I doubt they will. The reason these were built in the first place
        -       was as a side-effect of how ExtUtils::MakeMaker works.
        +     * We don't man pages for all of the perl modules as we used t, 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)
        @@ -80,6 +81,9 @@
             
             7. 0386dd37b1 ("Makefile: add PERLLIB_EXTRA variable that adds to
                default perl path", 2013-11-15)
        +    
        +    8. [email protected] ("Re: [PATCH] Makefile:
        +       replace perl/Makefile.PL with simple make rules"
             
             Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]>
         
        @@ -91,7 +95,7 @@
          	GIT_EXEC_PATH=`pwd`
          	PATH=`pwd`:$PATH
         -	GITPERLLIB=`pwd`/perl/blib/lib
        -+	GITPERLLIB=`pwd`/perl/build
        ++	GITPERLLIB=`pwd`/perl/build/lib
          	export GIT_EXEC_PATH PATH GITPERLLIB
          
         + - By default (unless NO_PERL is provided) Git will ship various perl
        @@ -154,7 +158,10 @@
          	COMPAT_CFLAGS += -DNO_HSTRERROR
          	COMPAT_OBJS += compat/hstrerror.o
         @@
        + DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
        + bindir_SQ = $(subst ','\'',$(bindir))
          bindir_relative_SQ = $(subst ','\'',$(bindir_relative))
        ++mandir_SQ = $(subst ','\'',$(mandir))
          mandir_relative_SQ = $(subst ','\'',$(mandir_relative))
          infodir_relative_SQ = $(subst ','\'',$(infodir_relative))
         +perllibdir_SQ = $(subst ','\'',$(perllibdir))
        @@ -194,11 +201,11 @@
         -	$(PERL_PATH) -V >>$@+ && \
         -	{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \
         -	$(RM) $@+
        -+$(SCRIPT_PERL_GEN):
        - 
        +-
         -perl/perl.mak: GIT-CFLAGS GIT-PREFIX perl/Makefile perl/Makefile.PL
         -	$(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
        --
        ++$(SCRIPT_PERL_GEN):
        + 
         -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)
        @@ -220,15 +227,19 @@
          	$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
          
         +PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)
        -+PMCFILES := $(patsubst perl/%.pm,perl/build/%.pmc,$(PMFILES))
        ++PMCFILES := $(patsubst perl/%.pm,perl/build/lib/%.pmc,$(PMFILES))
         +
         +ifndef NO_PERL
         +all:: $(PMCFILES)
         +endif
         +
        -+perl/build/%.pmc: perl/%.pm
        ++perl/build/lib/%.pmc: perl/%.pm
         +	$(QUIET_GEN)mkdir -p $(dir $@) && \
         +	sed -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' < $< > $@
        ++
        ++perl/build/man/man3/Git.3pm: perl/Git.pm
        ++	$(QUIET_GEN)mkdir -p $(dir $@) && \
        ++	pod2man $< $@
         +
          FIND_SOURCE_FILES = ( \
          	git ls-files \
        @@ -239,11 +250,31 @@
          ifndef NO_PERL
         -	$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
         +	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
        -+	(cd perl/build && $(TAR) cf - .) | \
        ++	(cd perl/build/lib && $(TAR) cf - .) | \
         +	(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
          	$(MAKE) -C gitweb install
          endif
          ifndef NO_TCLTK
        +@@
        + install-gitweb:
        + 	$(MAKE) -C gitweb install
        + 
        +-install-doc:
        ++install-doc: install-man-perl
        + 	$(MAKE) -C Documentation install
        + 
        +-install-man:
        ++install-man: install-man-perl
        + 	$(MAKE) -C Documentation install-man
        + 
        ++install-man-perl: perl/build/man/man3/Git.3pm
        ++	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
        ++	(cd perl/build/man/man3 && $(TAR) cf - .) | \
        ++	(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)
        ++
        + install-html:
        + 	$(MAKE) -C Documentation install-html
        + 
         @@
          	$(MAKE) -C Documentation/ clean
          ifndef NO_PERL
        @@ -549,7 +580,7 @@
          #!/usr/bin/perl
          
         -use lib '../../perl/blib/lib';
        -+use lib '../../perl/build';
        ++use lib '../../perl/build/lib';
          use strict;
          use warnings;
          use Git;
        @@ -562,7 +593,7 @@
          fi
          
         -GITPERLLIB="$GIT_BUILD_DIR"/perl/blib/lib:"$GIT_BUILD_DIR"/perl/blib/arch/auto/Git
        -+GITPERLLIB="$GIT_BUILD_DIR"/perl/build
        ++GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
          export GITPERLLIB
          test -d "$GIT_BUILD_DIR"/templates/blt || {
          	error "You haven't built things yet, have you?"
        @@ -575,7 +606,7 @@
          	export GIT_TEMPLATE_DIR
          fi
         -GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'"${GITPERLLIB:+:$GITPERLLIB}"
        -+GITPERLLIB='@@BUILD_DIR@@/perl/build'"${GITPERLLIB:+:$GITPERLLIB}"
        ++GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
          GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
          PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
 INSTALL                                          | 17 ++++-
 Makefile                                         | 67 ++++++++++--------
 contrib/examples/git-difftool.perl               |  2 +-
 git-send-email.perl                              |  2 +-
 perl/.gitignore                                  |  9 +--
 perl/Git.pm                                      |  2 +-
 perl/Git/Error.pm                                | 47 +++++++++++++
 perl/{private-Error.pm => Git/FromCPAN/Error.pm} |  0
 perl/Git/I18N.pm                                 |  2 +-
 perl/Makefile                                    | 90 ------------------------
 perl/Makefile.PL                                 | 62 ----------------
 t/perf/aggregate.perl                            |  2 +-
 t/test-lib.sh                                    |  2 +-
 wrap-for-bin.sh                                  |  2 +-
 14 files changed, 107 insertions(+), 199 deletions(-)
 create mode 100644 perl/Git/Error.pm
 rename perl/{private-Error.pm => Git/FromCPAN/Error.pm} (100%)
 delete mode 100644 perl/Makefile
 delete mode 100644 perl/Makefile.PL
INSTALL +16 -1
index ffb071e9f0..808e07b659 100644
@@ -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
 
+ - By default (unless NO_PERL is provided) Git will ship various perl
+   scripts & libraries it needs. However, for simplicity it doesn't
+   use the ExtUtils::MakeMaker toolchain to decide where to place the
+   perl libraries. Depending on the system this can result in the perl
+   libraries not being where you'd like them if they're expected to be
+   used by things other than Git itself.
+
+   Manually supplying a perllibdir prefix should fix this, if this is
+   a problem you care about, e.g.:
+
+       prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wle 'print substr $Config{installsitelib}, 1 + length $Config{siteprefixexp}')
+
+   Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,
+   perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS.
+
  - Git is reasonably self-sufficient, but does depend on a few external
    programs and libraries.  Git can be used without most of them by adding
    the approriate "NO_<LIBRARY>=YesPlease" to the make command line or
Makefile +36 -31

152 lines not on this page · raw message

contrib/examples/git-difftool.perl +1 -1
index df59bdfe97..fb0fd0b84b 100755
@@ -13,7 +13,7 @@
 use 5.008;
 use strict;
 use warnings;
-use Error qw(:try);
+use Git::Error qw(:try);
 use File::Basename qw(dirname);
 use File::Copy;
 use File::Find;
git-send-email.perl +1 -1
index 2208dcc213..88a0edcd7d 100755
@@ -26,7 +26,7 @@ use Text::ParseWords;
 use Term::ANSIColor;
 use File::Temp qw/ tempdir tempfile /;
 use File::Spec::Functions qw(catdir catfile);
-use Error qw(:try);
+use Git::Error qw(:try);
 use Cwd qw(abs_path cwd);
 use Git;
 use Git::I18N;
perl/.gitignore +1 -8
index 0f1fc27f86..84c048a73c 100644
@@ -1,8 +1 @@
-perl.mak
-perl.mak.old
-MYMETA.json
-MYMETA.yml
-blib
-blibdirs
-pm_to_blib
-PM.stamp
+/build/
perl/Git.pm +1 -1
index ffa09ace92..02a3871e94 100644
@@ -101,7 +101,7 @@ increase notwithstanding).
 
 
 use Carp qw(carp croak); # but croak is bad - throw instead
-use Error qw(:try);
+use Git::Error qw(:try);
 use Cwd qw(abs_path cwd);
 use IPC::Open2 qw(open2);
 use Fcntl qw(SEEK_SET SEEK_CUR);
perl/Git/Error.pm new file +47 -0

47 lines not on this page · raw message

perl/Git/FromCPAN/Error.pm renamed from perl/private-Error.pm +0 -0
similarity index 100%
rename from perl/private-Error.pm
rename to perl/Git/FromCPAN/Error.pm
perl/Git/I18N.pm +1 -1
index 836a5c2382..dba96fff0a 100644
@@ -18,7 +18,7 @@ our @EXPORT_OK = @EXPORT;
 
 sub __bootstrap_locale_messages {
 	our $TEXTDOMAIN = 'git';
-	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';
+	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
 
 	require POSIX;
 	POSIX->import(qw(setlocale));
perl/Makefile deleted +0 -90

90 lines not on this page · raw message

perl/Makefile.PL deleted +0 -62

62 lines not on this page · raw message

t/perf/aggregate.perl +1 -1
index 1dbc85b214..923044df6a 100755
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use lib '../../perl/blib/lib';
+use lib '../../perl/build/lib';
 use strict;
 use warnings;
 use Git;
t/test-lib.sh +1 -1
index 116bd6a70c..85a0fabb47 100644
@@ -919,7 +919,7 @@ then
 	fi
 fi
 
-GITPERLLIB="$GIT_BUILD_DIR"/perl/blib/lib:"$GIT_BUILD_DIR"/perl/blib/arch/auto/Git
+GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
 export GITPERLLIB
 test -d "$GIT_BUILD_DIR"/templates/blt || {
 	error "You haven't built things yet, have you?"
wrap-for-bin.sh +1 -1
index 22b6e4948f..5842408817 100644
@@ -14,7 +14,7 @@ else
 	GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
 	export GIT_TEMPLATE_DIR
 fi
-GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
 GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
 PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
 
Signature · 1 line
2.15.0.403.gc27cc4dac6
#10 lore raw

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

I did this immediately after applying; please double check.

Thanks.

1: da337670f5 ! 1: aeae85bdd0 Makefile: replace perl/Makefile.PL with simple make rules
@@ -27,7 +27,7 @@
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. As that's being done rename the files
- from *.pm to *.pmc just to indicate that they're genreated (see
+ from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").

While I'm at it, change the fallback for Error.pm from being something
@@ -50,9 +50,9 @@
it could be set in addition to INSTLIBDIR, but my reading of [7] is that this is the desired behavior.

- * We don't man pages for all of the perl modules as we used t, only
- Git(3pm). As discussed on-list[8] that we were building installed
- manpages for purely internal APIs like Git::I18N or
+ * 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.

:

#11 lore raw

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

Quoted 3 lines · Junio C Hamano

I did this immediately after applying; please double check.

Thanks.

Thanks. Looks good to me. I'll incorporate that info future submissions if there's more stuff to fix, but for now if you could queue it like that that would be great.

Quoted 24 lines

1: da337670f5 ! 1: aeae85bdd0 Makefile: replace perl/Makefile.PL with simple make rules
@@ -27,7 +27,7 @@
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. As that's being done rename the files
- from *.pm to *.pmc just to indicate that they're genreated (see
+ from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").

While I'm at it, change the fallback for Error.pm from being something
@@ -50,9 +50,9 @@
it could be set in addition to INSTLIBDIR, but my reading of [7] is that this is the desired behavior.

- * We don't man pages for all of the perl modules as we used t, only
- Git(3pm). As discussed on-list[8] that we were building installed
- manpages for purely internal APIs like Git::I18N or
+ * 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.

:

#12 lore raw

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

Quoted 8 lines · Ævar Arnfjörð Bjarmason
Quoted 3 lines · Junio C Hamano

I did this immediately after applying; please double check.

Thanks.

Thanks. Looks good to me. I'll incorporate that info future submissions if there's more stuff to fix, but for now if you could queue it like that that would be great.

Well the thing is that I cannot queue this and Dan's at the same time, while both of these topics are expected to be in flux. For today's pushout, I tentatively kicked out Dan's relative path series and queued this one to see how well it works with the rest of the system, after giving this patch another round of reading.

It seemed that Dan was happy with (an earlier draft of?) this build procedure simplification patch, so hopefully we can solidify this one reasonably quickly and ask the relative path series to be rebuilt on top of it?

Thanks.

#13 lore raw

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

Quoted 10 lines · Junio C Hamano

Well the thing is that I cannot queue this and Dan's at the same time, while both of these topics are expected to be in flux. For today's pushout, I tentatively kicked out Dan's relative path series and queued this one to see how well it works with the rest of the system, after giving this patch another round of reading.

It seemed that Dan was happy with (an earlier draft of?) this build procedure simplification patch, so hopefully we can solidify this one reasonably quickly and ask the relative path series to be rebuilt on top of it?

Sounds good to me! I'm in no rush, and if this is moving forward I'm more than happy to wait for it to land and rebase on top.

I didn't want to weigh in too heavily on the actual details of this patch since I think the majority stakeholders are the folks who maintain the Perl subsystem and those who build distribution packages. My work on Perl only touches installation as a means to an end, and avarab@'s work does simplify this for me.

Cheers, and thanks!
-Dan

#14 lore raw

PATCH v3 1/1 Makefile: replace perl/Makefile.PL with simple make rules

In reply to Æ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. As that's being done rename the files from *.pm to *.pmc just to indicate that they're generated (see "perldoc -f require").

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. [email protected] ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"

---

This fixes the test failure we had on 32 bit Linux due to v2. That error had nothing to do with 32 bit per-se, it was just a logic error in the fallback logic if the system didn't have an Error.pm, and evidently the 32 bit environment doesn't have that installed.

This also incorporates Junio's typo/grammar fixes of my commit message, tbdiff with v2:

@@ -27,7 +27,7 @@
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. As that's being done rename the files
- from *.pm to *.pmc just to indicate that they're genreated (see
+ from *.pm to *.pmc just to indicate that they're generated (see
"perldoc -f require").

While I'm at it, change the fallback for Error.pm from being something
@@ -50,9 +50,9 @@
it could be set in addition to INSTLIBDIR, but my reading of [7] is that this is the desired behavior.

- * We don't man pages for all of the perl modules as we used t, only
- Git(3pm). As discussed on-list[8] that we were building installed
- manpages for purely internal APIs like Git::I18N or
+ * 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.

@@ -354,8 +354,7 @@
+
+=head1 DESCRIPTION
+
-+Wraps the import function for the L<Error> module. The L<Git> module
-+must be imported first.
++Wraps the import function for the L<Error> module.
+
+This module is only intended to be used for code shipping in the
+C<git.git> repository. Use it for anything else at your peril!
@@ -372,13 +371,13 @@
+ } or do {
+ my $error = $@ || "Zombie Error";
+
-+ my $Git_pm_path = $INC{"Git.pm"} || die "BUG: Should have loaded the Git module first!";
++ my $Git_Error_pm_path = $INC{"Git/Error.pm"} || die "BUG: Should have our own path from %INC!";
+
+ require File::Basename;
-+ my $Git_pm_root = File::Basename::dirname($Git_pm_path) || die "BUG: Can't figure out dirname from '$Git_pm_path'!"; ++ my $Git_Error_pm_root = File::Basename::dirname($Git_Error_pm_path) || die "BUG: Can't figure out lib/Git dirname from '$Git_Error_pm_path'!";
+
+ require File::Spec;
-+ my $Git_pm_FromCPAN_root = File::Spec->catdir($Git_pm_root, qw(Git FromCPAN));
++ my $Git_pm_FromCPAN_root = File::Spec->catdir($Git_Error_pm_root, 'FromCPAN');
+ die "BUG: '$Git_pm_FromCPAN_root' should be a directory!" unless -d $Git_pm_FromCPAN_root;
+
+ local @INC = ($Git_pm_FromCPAN_root, @INC);

So the issue is that we had some things (like git-send-email) which would load Git::Error without first loading Git.pm.

There's no actual reason for why we can't just find the path relative to Git::Error.pm instead of Git.pm.

I don't know what I was thinking when I wrote this, but this logic should be fully robust, and I've confirmed that all tests pass with/without an Error.pm installed globally.

 INSTALL                                          | 17 ++++-
 Makefile                                         | 67 ++++++++++--------
 contrib/examples/git-difftool.perl               |  2 +-
 git-send-email.perl                              |  2 +-
 perl/.gitignore                                  |  9 +--
 perl/Git.pm                                      |  2 +-
 perl/Git/Error.pm                                | 46 ++++++++++++
 perl/{private-Error.pm => Git/FromCPAN/Error.pm} |  0
 perl/Git/I18N.pm                                 |  2 +-
 perl/Makefile                                    | 90 ------------------------
 perl/Makefile.PL                                 | 62 ----------------
 t/perf/aggregate.perl                            |  2 +-
 t/test-lib.sh                                    |  2 +-
 wrap-for-bin.sh                                  |  2 +-
 14 files changed, 106 insertions(+), 199 deletions(-)
 create mode 100644 perl/Git/Error.pm
 rename perl/{private-Error.pm => Git/FromCPAN/Error.pm} (100%)
 delete mode 100644 perl/Makefile
 delete mode 100644 perl/Makefile.PL
INSTALL +16 -1
index ffb071e9f0..808e07b659 100644
@@ -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
 
+ - By default (unless NO_PERL is provided) Git will ship various perl
+   scripts & libraries it needs. However, for simplicity it doesn't
+   use the ExtUtils::MakeMaker toolchain to decide where to place the
+   perl libraries. Depending on the system this can result in the perl
+   libraries not being where you'd like them if they're expected to be
+   used by things other than Git itself.
+
+   Manually supplying a perllibdir prefix should fix this, if this is
+   a problem you care about, e.g.:
+
+       prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wle 'print substr $Config{installsitelib}, 1 + length $Config{siteprefixexp}')
+
+   Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,
+   perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS.
+
  - Git is reasonably self-sufficient, but does depend on a few external
    programs and libraries.  Git can be used without most of them by adding
    the approriate "NO_<LIBRARY>=YesPlease" to the make command line or
Makefile +36 -31

152 lines not on this page · raw message

contrib/examples/git-difftool.perl +1 -1
index df59bdfe97..fb0fd0b84b 100755
@@ -13,7 +13,7 @@
 use 5.008;
 use strict;
 use warnings;
-use Error qw(:try);
+use Git::Error qw(:try);
 use File::Basename qw(dirname);
 use File::Copy;
 use File::Find;
git-send-email.perl +1 -1
index 2208dcc213..88a0edcd7d 100755
@@ -26,7 +26,7 @@ use Text::ParseWords;
 use Term::ANSIColor;
 use File::Temp qw/ tempdir tempfile /;
 use File::Spec::Functions qw(catdir catfile);
-use Error qw(:try);
+use Git::Error qw(:try);
 use Cwd qw(abs_path cwd);
 use Git;
 use Git::I18N;
perl/.gitignore +1 -8
index 0f1fc27f86..84c048a73c 100644
@@ -1,8 +1 @@
-perl.mak
-perl.mak.old
-MYMETA.json
-MYMETA.yml
-blib
-blibdirs
-pm_to_blib
-PM.stamp
+/build/
perl/Git.pm +1 -1
index ffa09ace92..02a3871e94 100644
@@ -101,7 +101,7 @@ increase notwithstanding).
 
 
 use Carp qw(carp croak); # but croak is bad - throw instead
-use Error qw(:try);
+use Git::Error qw(:try);
 use Cwd qw(abs_path cwd);
 use IPC::Open2 qw(open2);
 use Fcntl qw(SEEK_SET SEEK_CUR);
perl/Git/Error.pm new file +46 -0

46 lines not on this page · raw message

perl/Git/FromCPAN/Error.pm renamed from perl/private-Error.pm +0 -0
similarity index 100%
rename from perl/private-Error.pm
rename to perl/Git/FromCPAN/Error.pm
perl/Git/I18N.pm +1 -1
index 836a5c2382..dba96fff0a 100644
@@ -18,7 +18,7 @@ our @EXPORT_OK = @EXPORT;
 
 sub __bootstrap_locale_messages {
 	our $TEXTDOMAIN = 'git';
-	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';
+	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
 
 	require POSIX;
 	POSIX->import(qw(setlocale));
perl/Makefile deleted +0 -90

90 lines not on this page · raw message

perl/Makefile.PL deleted +0 -62

62 lines not on this page · raw message

t/perf/aggregate.perl +1 -1
index e401208488..3096f4ec77 100755
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use lib '../../perl/blib/lib';
+use lib '../../perl/build/lib';
 use strict;
 use warnings;
 use Git;
t/test-lib.sh +1 -1
index 116bd6a70c..85a0fabb47 100644
@@ -919,7 +919,7 @@ then
 	fi
 fi
 
-GITPERLLIB="$GIT_BUILD_DIR"/perl/blib/lib:"$GIT_BUILD_DIR"/perl/blib/arch/auto/Git
+GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
 export GITPERLLIB
 test -d "$GIT_BUILD_DIR"/templates/blt || {
 	error "You haven't built things yet, have you?"
wrap-for-bin.sh +1 -1
index 22b6e4948f..5842408817 100644
@@ -14,7 +14,7 @@ else
 	GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
 	export GIT_TEMPLATE_DIR
 fi
-GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
 GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
 PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
 
Signature · 1 line
2.15.1.424.g9478a66081
#15 lore raw

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

Quoted 3 lines · Ævar Arnfjörð Bjarmason

I don't know what I was thinking when I wrote this, but this logic should be fully robust, and I've confirmed that all tests pass with/without an Error.pm installed globally.

Thanks. Will queue and drop the revert from 'pu'.

#16 lore raw

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

In reply to Ævar Arnfjörð Bjarmason

-----Original Message-----
On December 10, 2017 4:14 PM, Ævar Arnfjörð Bjarmason wrote:
Subject: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules

Quoted 2 lines

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.

<big snip>

I would like to request that the we be careful that the git builds do not introduce arbitrary dependencies to CPAN. Some platforms (I can think of one off the top, being NonStop) does not provide for arbitrary additions to the supplied perl implementation as of yet. The assumption about being able to add CPAN modules may apply on some platforms but is not a general capability. I am humbly requesting that caution be used when adding dependencies. Being non-$DAYJOB responsible for the git port for NonStop, this scares me a bit, but I and my group can help validate the available modules used for builds.

Note: we do not yet have CPAN's SCM so can't and don't use perl for access to git anyway - much that I've tried to change that.

Please keep build dependencies to a minimum.

Thanks for my and my whole team.

Randall

-- Brief whoami: NonStop&UNIX developer since approximately UNIX(421664400)/NonStop(211288444200000000) -- In my real life, I talk too much.

#17 lore raw

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

On Tue, Dec 12 2017, Randall S. Becker jotted:

Quoted 8 lines

-----Original Message-----
On December 10, 2017 4:14 PM, Ævar Arnfjörð Bjarmason wrote:
Subject: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules

Quoted 2 lines

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.

<big snip>

Quoted 7 lines

I would like to request that the we be careful that the git builds do not introduce arbitrary dependencies to CPAN. Some platforms (I can think of one off the top, being NonStop) does not provide for arbitrary additions to the supplied perl implementation as of yet. The assumption about being able to add CPAN modules may apply on some platforms but is not a general capability. I am humbly requesting that caution be used when adding dependencies. Being non-$DAYJOB responsible for the git port for NonStop, this scares me a bit, but I and my group can help validate the available modules used for builds.

Note: we do not yet have CPAN's SCM so can't and don't use perl for access to git anyway - much that I've tried to change that.

Please keep build dependencies to a minimum.

Thanks for my and my whole team.

I think you should be happy with this patch then, and it doesn't add any more CPAN dependency than before, and sets up a framework (as discussed in [1]) where we can use more CPAN modules while not requiring packagers such as yourself to package CPAN modules.

However, it doesn't sound believable to me that even on NonStop you can't install any CPAN modules whatsoever.

That would also mean that this patch doesn't work for you, because it means that you either don't have anything resembling a hierarchical filesystem on which git can be installed in the first place (in which case it wouldn't work), or perl doesn't have an @INC to search through perl libs on on NonStop. What does:

perl -V

Return for you on that system?

If this patch works, and if at the bottom of perl -V you see some directories which you could write a package to drop some static *.pm files, then you can grab a *.tar.gz from CPAN such as the one for Error.pm[2] and arrange for the *.pm files contained within its lib/ directory to be dropped into one of those @INC directories.

It may be that some aspect of the CPAN toolchain is broken for you, or even ExtUtils::MakeMaker, but you typically don't need that to package non-XS perl modules, certainly not any of the ones we've discussed possibly bundling up in git.git on-list recently. As a (very occasional) contributor to perl.git I'd be interested to know if that's what you mean is broken, and if so see if it could be fixed for you.

1. <CACBZZX58KpQ7=V8GUFfxuMQq_Ar6cmmoXyPx_umUTbU19+0LCw@mail.gmail.com>
-- https://public-inbox.org/git/CACBZZX58KpQ7=V8GUFfxuMQq_Ar6cmmoXyPx_umUTbU19+0LCw@mail.gmail.com/

2. https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/Error-0.17025.tar.gz

#18 lore raw

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

Ævar Arnfjörð Bjarmason venit, vidit, dixit 12.12.2017 23:26:

Quoted 50 lines

On Tue, Dec 12 2017, Randall S. Becker jotted:

Quoted 8 lines

-----Original Message-----
On December 10, 2017 4:14 PM, Ævar Arnfjörð Bjarmason wrote:
Subject: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules

Quoted 2 lines

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.

<big snip>

Quoted 7 lines

I would like to request that the we be careful that the git builds do not introduce arbitrary dependencies to CPAN. Some platforms (I can think of one off the top, being NonStop) does not provide for arbitrary additions to the supplied perl implementation as of yet. The assumption about being able to add CPAN modules may apply on some platforms but is not a general capability. I am humbly requesting that caution be used when adding dependencies. Being non-$DAYJOB responsible for the git port for NonStop, this scares me a bit, but I and my group can help validate the available modules used for builds.

Note: we do not yet have CPAN's SCM so can't and don't use perl for access to git anyway - much that I've tried to change that.

Please keep build dependencies to a minimum.

Thanks for my and my whole team.

I think you should be happy with this patch then, and it doesn't add any more CPAN dependency than before, and sets up a framework (as discussed in [1]) where we can use more CPAN modules while not requiring packagers such as yourself to package CPAN modules.

However, it doesn't sound believable to me that even on NonStop you can't install any CPAN modules whatsoever.

That would also mean that this patch doesn't work for you, because it means that you either don't have anything resembling a hierarchical filesystem on which git can be installed in the first place (in which case it wouldn't work), or perl doesn't have an @INC to search through perl libs on on NonStop. What does:

perl -V

Return for you on that system?

If this patch works, and if at the bottom of perl -V you see some directories which you could write a package to drop some static *.pm files, then you can grab a *.tar.gz from CPAN such as the one for Error.pm[2] and arrange for the *.pm files contained within its lib/ directory to be dropped into one of those @INC directories.

It may be that some aspect of the CPAN toolchain is broken for you, or even ExtUtils::MakeMaker, but you typically don't need that to package non-XS perl modules, certainly not any of the ones we've discussed possibly bundling up in git.git on-list recently. As a (very occasional) contributor to perl.git I'd be interested to know if that's what you mean is broken, and if so see if it could be fixed for you.

Quoted 5 lines

1. <CACBZZX58KpQ7=V8GUFfxuMQq_Ar6cmmoXyPx_umUTbU19+0LCw@mail.gmail.com>
-- https://public-inbox.org/git/CACBZZX58KpQ7=V8GUFfxuMQq_Ar6cmmoXyPx_umUTbU19+0LCw@mail.gmail.com/

2. https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/Error-0.17025.tar.gz

This patch (currently in origin/next) makes a ton of tests from our test suite fail for me on pretty standard systems (Fedora 27, CentOS 7.4.1708).

Is there anything I'm supposed to do differently now to make our test suite run? If yes then a clear and short hint in the patch description would me more than approriate.

Michael

Test Summary Report
-------------------
t0090-cache-tree.sh (Wstat: 256 Tests: 21
Failed: 1)
Failed test: 10
Non-zero exit status: 1
t2016-checkout-patch.sh (Wstat: 256 Tests: 14
Failed: 12)
Failed tests: 2-13
Non-zero exit status: 1
t3701-add-interactive.sh (Wstat: 256 Tests: 44
Failed: 25)
Failed tests: 2, 4-5, 7, 9-10, 13, 16, 18, 21-25, 29

                31, 33, 35, 37, 39-44

Non-zero exit status: 1
t3904-stash-patch.sh (Wstat: 256 Tests: 8
Failed: 4)
Failed tests: 3-6
Non-zero exit status: 1
t7105-reset-patch.sh (Wstat: 256 Tests: 8
Failed: 6)
Failed tests: 2-7
Non-zero exit status: 1
t7106-reset-unborn-branch.sh (Wstat: 256 Tests: 7
Failed: 1)
Failed test: 5
Non-zero exit status: 1
t7501-commit.sh (Wstat: 256 Tests: 66
Failed: 2)
Failed tests: 7, 39
Non-zero exit status: 1
t7514-commit-patch.sh (Wstat: 256 Tests: 3
Failed: 2)
Failed tests: 2-3
Non-zero exit status: 1
t9001-send-email.sh (Wstat: 256 Tests: 151
Failed: 111)
Failed tests: 4-7, 9-10, 12-13, 15, 17, 19-26, 29-31

                33-39, 41-43, 45, 47, 49, 51, 53, 55, 57
                59, 61-68, 71-94, 97, 99-101, 104, 106-108
                110, 112, 114, 117, 119-133, 135-145, 150-151

Non-zero exit status: 1

#19 lore raw

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

Hi Michael,

Quoted 6 lines · Michael J Gruber

This patch (currently in origin/next) makes a ton of tests from our test suite fail for me on pretty standard systems (Fedora 27, CentOS 7.4.1708).

Is there anything I'm supposed to do differently now to make our test suite run? If yes then a clear and short hint in the patch description would me more than approriate.

Interesting. I'll have to try building next. I was going to wait until the first 2.16.0 rc for a full test.

I did apply this patch on top of 2.15.1 on 12/10 and built an rpm locally for fedora (only f26 though). I didn't see any test failures, which is why I thought I'd wait for 2.16.0-rc0 to test further.

FWIW, the minor spec file changes I made (against fedora's git package master branch) are here:

https://src.fedoraproject.org/fork/tmz/rpms/git/branch/perl-makefile

The only change in the patch since I tested it is:

+-modules += Git/Packet

in perl/Makefile.

I don't think any of these changes to the rpm spec file or the Git/Packet addition in modules look like they'd affect the test suite, but it's early here and I could be wrong.

I'll try to test a build of next soon to see if I get similar failures on Fedora/CentOS.

Signature · 5 lines
Todd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
After one look at this planet any visitor from outer space would say
"I want to see the manager."
    -- William S. Burroughs
#20 lore raw

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

In reply to Michael J Gruber
Quoted 57 lines · Michael J Gruber

Ævar Arnfjörð Bjarmason venit, vidit, dixit 12.12.2017 23:26:

Quoted 50 lines

On Tue, Dec 12 2017, Randall S. Becker jotted:

Quoted 8 lines

-----Original Message-----
On December 10, 2017 4:14 PM, Ævar Arnfjörð Bjarmason wrote:
Subject: [PATCH v3] Makefile: replace perl/Makefile.PL with simple make rules

Quoted 2 lines

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.

<big snip>

Quoted 7 lines

I would like to request that the we be careful that the git builds do not introduce arbitrary dependencies to CPAN. Some platforms (I can think of one off the top, being NonStop) does not provide for arbitrary additions to the supplied perl implementation as of yet. The assumption about being able to add CPAN modules may apply on some platforms but is not a general capability. I am humbly requesting that caution be used when adding dependencies. Being non-$DAYJOB responsible for the git port for NonStop, this scares me a bit, but I and my group can help validate the available modules used for builds.

Note: we do not yet have CPAN's SCM so can't and don't use perl for access to git anyway - much that I've tried to change that.

Please keep build dependencies to a minimum.

Thanks for my and my whole team.

I think you should be happy with this patch then, and it doesn't add any more CPAN dependency than before, and sets up a framework (as discussed in [1]) where we can use more CPAN modules while not requiring packagers such as yourself to package CPAN modules.

However, it doesn't sound believable to me that even on NonStop you can't install any CPAN modules whatsoever.

That would also mean that this patch doesn't work for you, because it means that you either don't have anything resembling a hierarchical filesystem on which git can be installed in the first place (in which case it wouldn't work), or perl doesn't have an @INC to search through perl libs on on NonStop. What does:

perl -V

Return for you on that system?

If this patch works, and if at the bottom of perl -V you see some directories which you could write a package to drop some static *.pm files, then you can grab a *.tar.gz from CPAN such as the one for Error.pm[2] and arrange for the *.pm files contained within its lib/ directory to be dropped into one of those @INC directories.

It may be that some aspect of the CPAN toolchain is broken for you, or even ExtUtils::MakeMaker, but you typically don't need that to package non-XS perl modules, certainly not any of the ones we've discussed possibly bundling up in git.git on-list recently. As a (very occasional) contributor to perl.git I'd be interested to know if that's what you mean is broken, and if so see if it could be fixed for you.

Quoted 5 lines

1. <CACBZZX58KpQ7=V8GUFfxuMQq_Ar6cmmoXyPx_umUTbU19+0LCw@mail.gmail.com>
-- https://public-inbox.org/git/CACBZZX58KpQ7=V8GUFfxuMQq_Ar6cmmoXyPx_umUTbU19+0LCw@mail.gmail.com/

2. https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/Error-0.17025.tar.gz

Quoted 6 lines

This patch (currently in origin/next) makes a ton of tests from our test suite fail for me on pretty standard systems (Fedora 27, CentOS 7.4.1708).

Is there anything I'm supposed to do differently now to make our test suite run? If yes then a clear and short hint in the patch description would me more than approriate.

This is a bug in my patch, I can reproduce it on CO7. Will figure out what's going on there...

#21 lore raw

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

Quoted 6 lines · Ævar Arnfjörð Bjarmason
Quoted 3 lines

Is there anything I'm supposed to do differently now to make our test suite run? If yes then a clear and short hint in the patch description would me more than approriate.

This is a bug in my patch, I can reproduce it on CO7. Will figure out what's going on there...

Thanks.

#22 lore raw

PATCH v4 1/1 Makefile: replace perl/Makefile.PL with simple make rules

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. As that's being done rename the files from *.pm to *.pmc just to indicate that they're generated (see "perldoc -f require").

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. [email protected] ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"

---

Here's a hopefully final version. The only difference with v3 is:

- local @_ = ($caller, @_);
+ unshift @_, $caller;

As it turns out localizing @_ isn't something that worked properly until
https://github.com/Perl/perl5/commit/049bd5ffd62b73325d4b2e75e59ba04b3569137d

That commit isn't part of the 5.16.3 version that ships with CentOS 7, which explains why Michael J Gruber had issues with it. I've tested this on CentOS 7 myself, it passes all tests now.

 INSTALL                                          | 17 ++++-
 Makefile                                         | 67 ++++++++++--------
 contrib/examples/git-difftool.perl               |  2 +-
 git-send-email.perl                              |  2 +-
 perl/.gitignore                                  |  9 +--
 perl/Git.pm                                      |  2 +-
 perl/Git/Error.pm                                | 46 ++++++++++++
 perl/{private-Error.pm => Git/FromCPAN/Error.pm} |  0
 perl/Git/I18N.pm                                 |  2 +-
 perl/Makefile                                    | 90 ------------------------
 perl/Makefile.PL                                 | 62 ----------------
 t/perf/aggregate.perl                            |  2 +-
 t/test-lib.sh                                    |  2 +-
 wrap-for-bin.sh                                  |  2 +-
 14 files changed, 106 insertions(+), 199 deletions(-)
 create mode 100644 perl/Git/Error.pm
 rename perl/{private-Error.pm => Git/FromCPAN/Error.pm} (100%)
 delete mode 100644 perl/Makefile
 delete mode 100644 perl/Makefile.PL
INSTALL +16 -1
index ffb071e9f0..808e07b659 100644
@@ -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
 
+ - By default (unless NO_PERL is provided) Git will ship various perl
+   scripts & libraries it needs. However, for simplicity it doesn't
+   use the ExtUtils::MakeMaker toolchain to decide where to place the
+   perl libraries. Depending on the system this can result in the perl
+   libraries not being where you'd like them if they're expected to be
+   used by things other than Git itself.
+
+   Manually supplying a perllibdir prefix should fix this, if this is
+   a problem you care about, e.g.:
+
+       prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wle 'print substr $Config{installsitelib}, 1 + length $Config{siteprefixexp}')
+
+   Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,
+   perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS.
+
  - Git is reasonably self-sufficient, but does depend on a few external
    programs and libraries.  Git can be used without most of them by adding
    the approriate "NO_<LIBRARY>=YesPlease" to the make command line or
Makefile +36 -31

152 lines not on this page · raw message

contrib/examples/git-difftool.perl +1 -1
index df59bdfe97..fb0fd0b84b 100755
@@ -13,7 +13,7 @@
 use 5.008;
 use strict;
 use warnings;
-use Error qw(:try);
+use Git::Error qw(:try);
 use File::Basename qw(dirname);
 use File::Copy;
 use File::Find;
git-send-email.perl +1 -1
index edcc6d3469..63ca2ddfb7 100755
@@ -26,7 +26,7 @@ use Text::ParseWords;
 use Term::ANSIColor;
 use File::Temp qw/ tempdir tempfile /;
 use File::Spec::Functions qw(catdir catfile);
-use Error qw(:try);
+use Git::Error qw(:try);
 use Cwd qw(abs_path cwd);
 use Git;
 use Git::I18N;
perl/.gitignore +1 -8
index 0f1fc27f86..84c048a73c 100644
@@ -1,8 +1 @@
-perl.mak
-perl.mak.old
-MYMETA.json
-MYMETA.yml
-blib
-blibdirs
-pm_to_blib
-PM.stamp
+/build/
perl/Git.pm +1 -1
index ffa09ace92..02a3871e94 100644
@@ -101,7 +101,7 @@ increase notwithstanding).
 
 
 use Carp qw(carp croak); # but croak is bad - throw instead
-use Error qw(:try);
+use Git::Error qw(:try);
 use Cwd qw(abs_path cwd);
 use IPC::Open2 qw(open2);
 use Fcntl qw(SEEK_SET SEEK_CUR);
perl/Git/Error.pm new file +46 -0

46 lines not on this page · raw message

perl/Git/FromCPAN/Error.pm renamed from perl/private-Error.pm +0 -0
similarity index 100%
rename from perl/private-Error.pm
rename to perl/Git/FromCPAN/Error.pm
perl/Git/I18N.pm +1 -1
index 836a5c2382..dba96fff0a 100644
@@ -18,7 +18,7 @@ our @EXPORT_OK = @EXPORT;
 
 sub __bootstrap_locale_messages {
 	our $TEXTDOMAIN = 'git';
-	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';
+	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
 
 	require POSIX;
 	POSIX->import(qw(setlocale));
perl/Makefile deleted +0 -90

90 lines not on this page · raw message

perl/Makefile.PL deleted +0 -62

62 lines not on this page · raw message

t/perf/aggregate.perl +1 -1
index e401208488..3096f4ec77 100755
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use lib '../../perl/blib/lib';
+use lib '../../perl/build/lib';
 use strict;
 use warnings;
 use Git;
t/test-lib.sh +1 -1
index e7065df2bb..a6f00ff712 100644
@@ -919,7 +919,7 @@ then
 	fi
 fi
 
-GITPERLLIB="$GIT_BUILD_DIR"/perl/blib/lib:"$GIT_BUILD_DIR"/perl/blib/arch/auto/Git
+GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
 export GITPERLLIB
 test -d "$GIT_BUILD_DIR"/templates/blt || {
 	error "You haven't built things yet, have you?"
wrap-for-bin.sh +1 -1
index 22b6e4948f..5842408817 100644
@@ -14,7 +14,7 @@ else
 	GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
 	export GIT_TEMPLATE_DIR
 fi
-GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
 GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
 PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
 
Signature · 1 line
2.15.1.424.g9478a66081
#23 lore raw

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

Hi Ævar,

Quoted 5 lines · Ævar Arnfjörð Bjarmason

Here's a hopefully final version. The only difference with v3 is:

- local @_ = ($caller, @_);
+ unshift @_, $caller;

Quoted 7 lines

As it turns out localizing @_ isn't something that worked properly until
https://github.com/Perl/perl5/commit/049bd5ffd62b73325d4b2e75e59ba04b3569137d

That commit isn't part of the 5.16.3 version that ships with CentOS 7, which explains why Michael J Gruber had issues with it. I've tested this on CentOS 7 myself, it passes all tests now.

Thanks for tracking this down!

FWIW, I applied this version to next and tested it with CentOS 6 and 7. The tests pass on both (though there are some unrelated failures on CentOS 6 in t5700-protocol-v1, which I haven't looked into further yet).

I also applied this patch to 2.15.1 and ran the tests in the Fedora build system for all fedora and epel releases, which also passed (though with some spurious git-svn failures on x86_64 in fedora 28, AKA rawhide).

The .pmc extensions seem to cause rpm to fail to parse the files for rpm 'provides' as it normally would. This causes scripts like git-send-email which generates a 'requires' on Git::Error to fail to find anything which provides it.

I'm not familiar with the .pmc extenstion. Searching the fedora repositories, there is only one other package - and one file within it - which has a .pmc extension.

(The package is perl-test, the file is /usr/libexec/perl5-tests/perl-tests/t/run/flib/t2.pmc.)

Perhaps it's a bug in rpm's perl dependency generator, but I'd like to think that git wouldn't be the first package to find it.

Is the .pmc extension important to ensure these files are loaded in the right order? Since they're all in the Git namespace, I don't imagine there should be anything else in @INC which would be provided by the system or another package.

Pardon my ignorance if I've missed the obvious (I haven't fully read "perldoc -f require" which you referenced in the commit message).

Signature · 5 lines
Todd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppose I were a member of Congress, and suppose I were an idiot. But,
I repeat myself.
    -- Mark Twain
#24 lore raw

PATCH v5 1/1 Makefile: replace perl/Makefile.PL with simple make rules

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. [email protected] ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"

---

On Wed, Dec 20, 2017 at 7:15 AM, Todd Zullinger <[email protected]> wrote:

[Sorry for not CC-ing you on the last version. Forgot to update the giant send-email line I'm juggling for this series].

Quoted 9 lines

FWIW, I applied this version to next and tested it with CentOS 6 and 7. The tests pass on both (though there are some unrelated failures on CentOS 6 in t5700-protocol-v1, which I haven't looked into further yet).

I also applied this patch to 2.15.1 and ran the tests in the Fedora build system for all fedora and epel releases, which also passed (though with some spurious git-svn failures on x86_64 in fedora 28, AKA rawhide).

Great, thanks a lot.

Quoted 22 lines

The .pmc extensions seem to cause rpm to fail to parse the files for rpm 'provides' as it normally would. This causes scripts like git-send-email which generates a 'requires' on Git::Error to fail to find anything which provides it.

I'm not familiar with the .pmc extenstion. Searching the fedora repositories, there is only one other package - and one file within it - which has a .pmc extension.

(The package is perl-test, the file is /usr/libexec/perl5-tests/perl-tests/t/run/flib/t2.pmc.)

Perhaps it's a bug in rpm's perl dependency generator, but I'd like to think that git wouldn't be the first package to find it.

Is the .pmc extension important to ensure these files are loaded in the right order? Since they're all in the Git namespace, I don't imagine there should be anything else in @INC which would be provided by the system or another package.

Quoted 3 lines

Pardon my ignorance if I've missed the obvious (I haven't fully read "perldoc -f require" which you referenced in the commit message).

This *.pmc thing is just me being overly clever. Here's a v5 that gets rid of it. Diff with v4:

    1: f85565f93b ! 1: 59cda7589f Makefile: replace perl/Makefile.PL with simple make rules
        @@ -26,9 +26,7 @@

             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. As that's being done rename the files
        -    from *.pm to *.pmc just to indicate that they're generated (see
        -    "perldoc -f require").
        +    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
        @@ -226,14 +224,14 @@
          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/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.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' < $< > $@
         +

Aside from the tooling issues you mentioned:

* It's obscure enough that lots of editors won't know *.pmc is perl for syntax highlighting etc.

* Even though this use case works, perl really expects you to have a *.pm file alongside the *.pmc, so e.g if there's an error it *reports the *.pm path, even though no such file exists. I.e. it's *for compiler-generated files where the compiled version could have *changed line numbers etc.

 INSTALL                                          | 17 ++++-
 Makefile                                         | 67 ++++++++++--------
 contrib/examples/git-difftool.perl               |  2 +-
 git-send-email.perl                              |  2 +-
 perl/.gitignore                                  |  9 +--
 perl/Git.pm                                      |  2 +-
 perl/Git/Error.pm                                | 46 ++++++++++++
 perl/{private-Error.pm => Git/FromCPAN/Error.pm} |  0
 perl/Git/I18N.pm                                 |  2 +-
 perl/Makefile                                    | 90 ------------------------
 perl/Makefile.PL                                 | 62 ----------------
 t/perf/aggregate.perl                            |  2 +-
 t/test-lib.sh                                    |  2 +-
 wrap-for-bin.sh                                  |  2 +-
 14 files changed, 106 insertions(+), 199 deletions(-)
 create mode 100644 perl/Git/Error.pm
 rename perl/{private-Error.pm => Git/FromCPAN/Error.pm} (100%)
 delete mode 100644 perl/Makefile
 delete mode 100644 perl/Makefile.PL
INSTALL +16 -1
index ffb071e9f0..808e07b659 100644
@@ -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
 
+ - By default (unless NO_PERL is provided) Git will ship various perl
+   scripts & libraries it needs. However, for simplicity it doesn't
+   use the ExtUtils::MakeMaker toolchain to decide where to place the
+   perl libraries. Depending on the system this can result in the perl
+   libraries not being where you'd like them if they're expected to be
+   used by things other than Git itself.
+
+   Manually supplying a perllibdir prefix should fix this, if this is
+   a problem you care about, e.g.:
+
+       prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wle 'print substr $Config{installsitelib}, 1 + length $Config{siteprefixexp}')
+
+   Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,
+   perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS.
+
  - Git is reasonably self-sufficient, but does depend on a few external
    programs and libraries.  Git can be used without most of them by adding
    the approriate "NO_<LIBRARY>=YesPlease" to the make command line or
Makefile +36 -31

152 lines not on this page · raw message

contrib/examples/git-difftool.perl +1 -1
index df59bdfe97..fb0fd0b84b 100755
@@ -13,7 +13,7 @@
 use 5.008;
 use strict;
 use warnings;
-use Error qw(:try);
+use Git::Error qw(:try);
 use File::Basename qw(dirname);
 use File::Copy;
 use File::Find;
git-send-email.perl +1 -1
index edcc6d3469..63ca2ddfb7 100755
@@ -26,7 +26,7 @@ use Text::ParseWords;
 use Term::ANSIColor;
 use File::Temp qw/ tempdir tempfile /;
 use File::Spec::Functions qw(catdir catfile);
-use Error qw(:try);
+use Git::Error qw(:try);
 use Cwd qw(abs_path cwd);
 use Git;
 use Git::I18N;
perl/.gitignore +1 -8
index 0f1fc27f86..84c048a73c 100644
@@ -1,8 +1 @@
-perl.mak
-perl.mak.old
-MYMETA.json
-MYMETA.yml
-blib
-blibdirs
-pm_to_blib
-PM.stamp
+/build/
perl/Git.pm +1 -1
index ffa09ace92..02a3871e94 100644
@@ -101,7 +101,7 @@ increase notwithstanding).
 
 
 use Carp qw(carp croak); # but croak is bad - throw instead
-use Error qw(:try);
+use Git::Error qw(:try);
 use Cwd qw(abs_path cwd);
 use IPC::Open2 qw(open2);
 use Fcntl qw(SEEK_SET SEEK_CUR);
perl/Git/Error.pm new file +46 -0

46 lines not on this page · raw message

perl/Git/FromCPAN/Error.pm renamed from perl/private-Error.pm +0 -0
similarity index 100%
rename from perl/private-Error.pm
rename to perl/Git/FromCPAN/Error.pm
perl/Git/I18N.pm +1 -1
index 836a5c2382..dba96fff0a 100644
@@ -18,7 +18,7 @@ our @EXPORT_OK = @EXPORT;
 
 sub __bootstrap_locale_messages {
 	our $TEXTDOMAIN = 'git';
-	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';
+	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
 
 	require POSIX;
 	POSIX->import(qw(setlocale));
perl/Makefile deleted +0 -90

90 lines not on this page · raw message

perl/Makefile.PL deleted +0 -62

62 lines not on this page · raw message

t/perf/aggregate.perl +1 -1
index e401208488..3096f4ec77 100755
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use lib '../../perl/blib/lib';
+use lib '../../perl/build/lib';
 use strict;
 use warnings;
 use Git;
t/test-lib.sh +1 -1
index e7065df2bb..a6f00ff712 100644
@@ -919,7 +919,7 @@ then
 	fi
 fi
 
-GITPERLLIB="$GIT_BUILD_DIR"/perl/blib/lib:"$GIT_BUILD_DIR"/perl/blib/arch/auto/Git
+GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
 export GITPERLLIB
 test -d "$GIT_BUILD_DIR"/templates/blt || {
 	error "You haven't built things yet, have you?"
wrap-for-bin.sh +1 -1
index 22b6e4948f..5842408817 100644
@@ -14,7 +14,7 @@ else
 	GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
 	export GIT_TEMPLATE_DIR
 fi
-GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
 GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
 PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
 
Signature · 1 line
2.15.1.424.g9478a66081
#25 lore raw

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

Quoted 2 lines · Ævar Arnfjörð Bjarmason

[Sorry for not CC-ing you on the last version. Forgot to update the giant send-email line I'm juggling for this series].

No worries. It is a rather large CC list at this point. :)

Quoted 2 lines

This *.pmc thing is just me being overly clever. Here's a v5 that gets rid of it. Diff with v4:

Ahh, thanks for the additional details on this.

Quoted 7 lines
        -+PMFILES := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)
        -+PMCFILES := $(patsubst perl/%.pm,perl/build/lib/%.pmc,$(PMFILES))
        ++LIB_PERL := $(wildcard perl/*.pm perl/*/*.pm perl/*/*/*.pm perl/*/*/*/*.pm)
        ++LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
         +
         +ifndef NO_PERL
        -+all:: $(PMCFILES)
Quoted 8 lines
        ++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' < $< > $@
         +

Without the .pmc extensions, rpm picks up the perl dependencies, which is good. But an additional build/lib dir is created, which ends up in $perllibdir after install.

Here's an extract from a local build:

mkdir -p perl/build/lib/build/lib/ && \
sed -e 's|@@LOCALEDIR@@|/usr/share/locale|g' < perl/build/lib/Git.pm > perl/build/lib/build/lib/Git.pm mkdir -p perl/build/lib/build/lib/Git/ && \
sed -e 's|@@LOCALEDIR@@|/usr/share/locale|g' < perl/build/lib/Git/IndexInfo.pm > perl/build/lib/build/lib/Git/IndexInfo.pm mkdir -p perl/build/lib/build/lib/Git/ && \
sed -e 's|@@LOCALEDIR@@|/usr/share/locale|g' < perl/build/lib/Git/SVN.pm > perl/build/lib/build/lib/Git/SVN.pm mkdir -p perl/build/lib/build/lib/Git/ && \
sed -e 's|@@LOCALEDIR@@|/usr/share/locale|g' < perl/build/lib/Git/Error.pm > perl/build/lib/build/lib/Git/Error.pm mkdir -p perl/build/lib/build/lib/Git/ && \
sed -e 's|@@LOCALEDIR@@|/usr/share/locale|g' < perl/build/lib/Git/I18N.pm > perl/build/lib/build/lib/Git/I18N.pm

When PMFILES and PMCFILES matched .pm and .pmc respectively, the glob didn't match duplicated files under build/lib, so this wasn't an issue. I'm not sure where this is best fixed. The build/lib dir could be moved outside of perl or it could be made .build/lib to avoid the wildcard match, perhaps.

Building with perllibdir=/usr/share/perl5/vendor_perl results in:

/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/Git/FromCPAN /usr/share/perl5/vendor_perl/Git/FromCPAN/Error.pm /usr/share/perl5/vendor_perl/Git/I18N.pm /usr/share/perl5/vendor_perl/Git/IndexInfo.pm /usr/share/perl5/vendor_perl/Git/SVN /usr/share/perl5/vendor_perl/Git/SVN.pm /usr/share/perl5/vendor_perl/Git/SVN/Editor.pm /usr/share/perl5/vendor_perl/Git/SVN/Fetcher.pm /usr/share/perl5/vendor_perl/Git/SVN/GlobSpec.pm /usr/share/perl5/vendor_perl/Git/SVN/Log.pm /usr/share/perl5/vendor_perl/Git/SVN/Memoize /usr/share/perl5/vendor_perl/Git/SVN/Memoize/YAML.pm /usr/share/perl5/vendor_perl/Git/SVN/Migration.pm /usr/share/perl5/vendor_perl/Git/SVN/Prompt.pm /usr/share/perl5/vendor_perl/Git/SVN/Ra.pm /usr/share/perl5/vendor_perl/Git/SVN/Utils.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 /usr/share/perl5/vendor_perl/build/lib/Git/I18N.pm /usr/share/perl5/vendor_perl/build/lib/Git/IndexInfo.pm /usr/share/perl5/vendor_perl/build/lib/Git/SVN.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.

Thanks,

Signature · 4 lines
Todd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Never do today that which will become someone else's responsibility
tomorrow.
#26 lore raw

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

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. [email protected] ("Re: [PATCH] Makefile:
replace perl/Makefile.PL with simple make rules"

---

Quoted 5 lines · Todd Zullinger

/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

Quoted 8 lines

/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 build/ directory in perllibdir.

 INSTALL                                          | 17 ++++-
 Makefile                                         | 67 ++++++++++--------
 contrib/examples/git-difftool.perl               |  2 +-
 git-send-email.perl                              |  2 +-
 perl/.gitignore                                  |  9 +--
 perl/Git.pm                                      |  2 +-
 perl/Git/Error.pm                                | 46 ++++++++++++
 perl/{private-Error.pm => Git/FromCPAN/Error.pm} |  0
 perl/Git/I18N.pm                                 |  2 +-
 perl/Makefile                                    | 90 ------------------------
 perl/Makefile.PL                                 | 62 ----------------
 t/perf/aggregate.perl                            |  2 +-
 t/test-lib.sh                                    |  2 +-
 wrap-for-bin.sh                                  |  2 +-
 14 files changed, 106 insertions(+), 199 deletions(-)
 create mode 100644 perl/Git/Error.pm
 rename perl/{private-Error.pm => Git/FromCPAN/Error.pm} (100%)
 delete mode 100644 perl/Makefile
 delete mode 100644 perl/Makefile.PL
INSTALL +16 -1
index ffb071e9f0..808e07b659 100644
@@ -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
 
+ - By default (unless NO_PERL is provided) Git will ship various perl
+   scripts & libraries it needs. However, for simplicity it doesn't
+   use the ExtUtils::MakeMaker toolchain to decide where to place the
+   perl libraries. Depending on the system this can result in the perl
+   libraries not being where you'd like them if they're expected to be
+   used by things other than Git itself.
+
+   Manually supplying a perllibdir prefix should fix this, if this is
+   a problem you care about, e.g.:
+
+       prefix=/usr perllibdir=/usr/$(/usr/bin/perl -MConfig -wle 'print substr $Config{installsitelib}, 1 + length $Config{siteprefixexp}')
+
+   Will result in e.g. perllibdir=/usr/share/perl/5.26.1 on Debian,
+   perllibdir=/usr/share/perl5 (which we'd use by default) on CentOS.
+
  - Git is reasonably self-sufficient, but does depend on a few external
    programs and libraries.  Git can be used without most of them by adding
    the approriate "NO_<LIBRARY>=YesPlease" to the make command line or
Makefile +36 -31

152 lines not on this page · raw message

contrib/examples/git-difftool.perl +1 -1
index df59bdfe97..fb0fd0b84b 100755
@@ -13,7 +13,7 @@
 use 5.008;
 use strict;
 use warnings;
-use Error qw(:try);
+use Git::Error qw(:try);
 use File::Basename qw(dirname);
 use File::Copy;
 use File::Find;
git-send-email.perl +1 -1
index edcc6d3469..63ca2ddfb7 100755
@@ -26,7 +26,7 @@ use Text::ParseWords;
 use Term::ANSIColor;
 use File::Temp qw/ tempdir tempfile /;
 use File::Spec::Functions qw(catdir catfile);
-use Error qw(:try);
+use Git::Error qw(:try);
 use Cwd qw(abs_path cwd);
 use Git;
 use Git::I18N;
perl/.gitignore +1 -8
index 0f1fc27f86..84c048a73c 100644
@@ -1,8 +1 @@
-perl.mak
-perl.mak.old
-MYMETA.json
-MYMETA.yml
-blib
-blibdirs
-pm_to_blib
-PM.stamp
+/build/
perl/Git.pm +1 -1
index ffa09ace92..02a3871e94 100644
@@ -101,7 +101,7 @@ increase notwithstanding).
 
 
 use Carp qw(carp croak); # but croak is bad - throw instead
-use Error qw(:try);
+use Git::Error qw(:try);
 use Cwd qw(abs_path cwd);
 use IPC::Open2 qw(open2);
 use Fcntl qw(SEEK_SET SEEK_CUR);
perl/Git/Error.pm new file +46 -0

46 lines not on this page · raw message

perl/Git/FromCPAN/Error.pm renamed from perl/private-Error.pm +0 -0
similarity index 100%
rename from perl/private-Error.pm
rename to perl/Git/FromCPAN/Error.pm
perl/Git/I18N.pm +1 -1
index 836a5c2382..dba96fff0a 100644
@@ -18,7 +18,7 @@ our @EXPORT_OK = @EXPORT;
 
 sub __bootstrap_locale_messages {
 	our $TEXTDOMAIN = 'git';
-	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '++LOCALEDIR++';
+	our $TEXTDOMAINDIR = $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
 
 	require POSIX;
 	POSIX->import(qw(setlocale));
perl/Makefile deleted +0 -90

90 lines not on this page · raw message

perl/Makefile.PL deleted +0 -62

62 lines not on this page · raw message

t/perf/aggregate.perl +1 -1
index e401208488..3096f4ec77 100755
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use lib '../../perl/blib/lib';
+use lib '../../perl/build/lib';
 use strict;
 use warnings;
 use Git;
t/test-lib.sh +1 -1
index e7065df2bb..a6f00ff712 100644
@@ -919,7 +919,7 @@ then
 	fi
 fi
 
-GITPERLLIB="$GIT_BUILD_DIR"/perl/blib/lib:"$GIT_BUILD_DIR"/perl/blib/arch/auto/Git
+GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
 export GITPERLLIB
 test -d "$GIT_BUILD_DIR"/templates/blt || {
 	error "You haven't built things yet, have you?"
wrap-for-bin.sh +1 -1
index 22b6e4948f..5842408817 100644
@@ -14,7 +14,7 @@ else
 	GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
 	export GIT_TEMPLATE_DIR
 fi
-GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'"${GITPERLLIB:+:$GITPERLLIB}"
+GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
 GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
 PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
 
Signature · 1 line
2.15.1.424.g9478a66081
#27 lore raw

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

Quoted 30 lines · Ævar Arnfjörð Bjarmason
Quoted 5 lines · Todd Zullinger

/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

Quoted 8 lines

/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
Quoted 4 lines

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.

Signature · 5 lines
Todd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Some people never go crazy. What truly horrible lives they must
live.
    -- Charles Bukowski
#28 lore raw

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

In reply to Ævar Arnfjörð Bjarmason

Ævar Arnfjörð Bjarmason, Wed, Dec 20, 2017 19:24:19 +0100:

INSTALL Issues of note: · line 88

Quoted 11 lines
INSTALL +1 -1
index ffb071e9f0..808e07b659 100644
@@ -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

#29 lore raw

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

In reply to Ævar Arnfjörð Bjarmason
Quoted 2 lines · Æ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 <[email protected]>
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 &sub is used until recent versions of Perl. Avoid it (and we do not need to localize it here anyway).

---

Makefile +4 -4
index ba6607b7e7..5c73cd208a 100644
@@ -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' < $< > $@
 
perl/Git/Error.pm +1 -1
index 5874672150..09bbc97390 100644
@@ -39,7 +39,7 @@ sub import {
 	require Error;
     };
 
-    local @_ = ($caller, @_);
+    unshift @_, $caller;
     goto &Error::import;
 }
 
#30 lore raw

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

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

Quoted 15 lines
Quoted 2 lines · Æ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 <[email protected]>
Subject: perl: avoid *.pmc and fix Error.pm further

Quoted 7 lines

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 &sub 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:

(if needed)

Quoted 37 lines

---

Makefile +4 -4
index ba6607b7e7..5c73cd208a 100644
@@ -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' < $< > $@
 
perl/Git/Error.pm +1 -1
index 5874672150..09bbc97390 100644
@@ -39,7 +39,7 @@ sub import {
 	require Error;
     };
 
-    local @_ = ($caller, @_);
+    unshift @_, $caller;
     goto &Error::import;
 }
 
#31 lore raw

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

Quoted 6 lines · Ævar Arnfjörð Bjarmason
Quoted 3 lines

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!

#32 lore raw

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

In reply to Ævar Arnfjörð Bjarmason

Hi,

Quoted 1 line · Ævar Arnfjörð Bjarmason

+++ b/Makefile

[...]

Makefile git.res: git.rc GIT-VERSION-FILE · line 1961

Quoted 13 lines
Makefile +3 -4
-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

#33 lore raw

PATCH 1/1 perl: treat PERLLIB_EXTRA as an extra path again (Re: [PATCH v6] Makefile: replace perl/Makefile.PL with simple make rules)

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.

---

Quoted 6 lines · Jonathan Nieder

Hi,

Quoted 1 line · Ævar Arnfjörð Bjarmason

+++ b/Makefile

[...]

Quoted 15 lines

Review

Quoted 13 lines
(quoted diff) +3 -4
-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(-)
Makefile +2 -1
index 5c73cd208a..409e8f6ec9 100644
@@ -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 '}' \
Signature · 1 line
2.16.0.rc0.224.g99853183ba
#34 lore raw

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)

On Tue, Jan 02 2018, Jonathan Nieder jotted:

Quoted 77 lines

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.

---

Quoted 6 lines · Jonathan Nieder

Hi,

Quoted 1 line · Ævar Arnfjörð Bjarmason

+++ b/Makefile

[...]

Quoted 15 lines

Review

Quoted 13 lines
(quoted diff) +3 -4
-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(-)
Makefile +1 -0
index 5c73cd208a..409e8f6ec9 100644
@@ -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)' && \

Makefile $(SCRIPT_PERL_GEN): · line 1963

Quoted 10 lines
Makefile +1 -1
 	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!