git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Todd Zullinger <tmz@pobox.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Matthieu Moy <git@matthieu-moy.fr>, Petr Baudis <pasky@ucw.cz>,
	Benoit Bourbie <bbourbie@slb.com>, Jeff King <peff@peff.net>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Jari Aalto <jari.aalto@cante.net>,
	Giuseppe Bilotta <giuseppe.bilotta@gmail.com>,
	Marcus Griep <marcus@griep.us>
Subject: Re: [PATCH 3/8] perl: generalize the Git::LoadCPAN facility
Date: Thu, 15 Feb 2018 21:41:54 +0100	[thread overview]
Message-ID: <87sha2f0j1.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <20180215045301.GC27038@zaya.teonanacatl.net>


On Thu, Feb 15 2018, Todd Zullinger jotted:

> Hi Ævar,
>
> Ævar Arnfjörð Bjarmason wrote:
>> +Git::LoadCPAN - Wrapper for loading modules from the CPAN (OS) or Git's own copy
>> +
>> +=head1 DESCRIPTION
>> +
>> +The Perl code in Git depends on some modules from the CPAN, but we
>> +don't want to make those a hard requirement for anyone building from
>> +source.
>> +
>> +Therefore the L<Git::LoadCPAN> namespace shipped with Git contains
>> +wrapper modules like C<Git::LoadCPAN::Module::Name> that will first
>> +attempt to load C<Module::Name> from the OS, and if that doesn't work
>> +will fall back on C<Git::FromCPAN::Module::Name> shipped with Git
>> +itself.
>> +
>> +Usually OS's will not ship with Git's Git::FromCPAN tree at all,
>> +preferring to use their own packaging of CPAN modules instead.
>
> This is something I wondered about.  What's the recommended
> method to ensure git packaged for an OS/distribution doesn't
> ever use the fallbacks?  Remove $perllibdir/Git/FromCPAN
> after make install?
>
> If so, would it be useful to add a Makefile knob to not
> install the FromCPAN bits, which may be generally useful to
> packagers?
>
> Something like the following, perhaps?
>
> (I'd feel bad suggesting this without a patch, after all the
> work you've already done to simplify and improve the perl
> bits.)
>
> ---- 8< ----
> From: Todd Zullinger <tmz@pobox.com>
> Date: Wed, 14 Feb 2018 23:00:30 -0500
> Subject: [PATCH] Makefile: add NO_PERL_CPAN to disable fallback module install
>
> As noted in perl/Git/LoadCPAN.pm, operating system packages often don't
> want to ship Git::FromCPAN tree at all, preferring to use their own
> packaging of CPAN modules instead.  Allow such packagers to set
> NO_PERL_CPAN to easily avoid installing these fallback perl CPAN
> modules.
>
> Signed-off-by: Todd Zullinger <tmz@pobox.com>
> ---
>  Makefile | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 5bcd83ddf3..c4e035e5bf 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -296,6 +296,9 @@ all::
>  #
>  # Define NO_PERL if you do not want Perl scripts or libraries at all.
>  #
> +# Define NO_PERL_CPAN if you do not want to install fallbacks for perl CPAN
> +# modules.
> +#
>  # Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python
>  # but /usr/bin/python2.7 on some platforms).
>  #
> @@ -2572,6 +2575,7 @@ ifndef NO_GETTEXT
>  endif
>  ifndef NO_PERL
>  	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
> +	test -z "$(NO_PERL_CPAN)" || rm -rf perl/build/lib/Git/FromCPAN
>  	(cd perl/build/lib && $(TAR) cf - .) | \
>  	(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
>  	$(MAKE) -C gitweb install
> --
> 2.16.1
>
> I don't particularly like NO_PERL_CPAN, but I'm confident
> someone else will suggest an obviously better name.
>
> I thought about moving the 'rm -rf Git/FromCPAN' after the
> tar/untar, to keep the files in place for the tests.  No
> tests seem to rely on those local files, so I stuck with
> removing them before.  That diff was:
>
> --- a/Makefile
> +++ b/Makefile
> @@ -2574,6 +2574,7 @@
>  	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
>  	(cd perl/build/lib && $(TAR) cf - .) | \
>  	(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
> +	test -n "$(NO_PERL_CPAN)" && rm -rf '$(DESTDIR_SQ)$(perllibdir_SQ)'/Git/FromCPAN
>  	$(MAKE) -C gitweb install
>  endif
>  ifndef NO_TCLTK

That makes sense, I'll incorporate that in a re-roll. I like
NO_PERL_CPAN_FALLBACKS or just NO_CPAN_FALLBACKS better.

I'd really like to find some solution that works differently though,
because with this approach we'll run the full test suite against a
system where our fallbacks will be in place (although if the OS
distributor has done as promised we won't use them), and then just
remove this at 'make install' time, also meaning we'll re-gen it before
running 'make install' again, only to rm it again.

The former issue we could deal with by munging the Git::LoadCPAN file so
it knows about NO_PERL_CPAN_FALLBACKS, and will always refuse to use the
fallbacks if that's set. That's a good idea anyway, because right now if
you e.g. uninstall Error.pm on Debian (which strips the CPAN fallbacks)
you get a cryptic "BUG: ..." message, it should instead say "we couldn't
get this module the OS promised we'd have" or something to that effect.

The latter is trickier, I don't see an easy way to coerce the Makefile
into not copying the FromCPAN directory without going back to a
hardcoded list again, the easiest thing is probably to turn that:

    $(TAR) cf - .)

Into:

    $(TAR) cf - $(find ... -not ....)

Or something like that to get all the stuff that isn't the Git/FromCPAN
directory.

Other suggestions most welcome.

  reply	other threads:[~2018-02-15 20:42 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-14 22:21 [PATCH 0/8] various perl fixes Ævar Arnfjörð Bjarmason
2018-02-14 22:21 ` [PATCH 1/8] perl: *.pm files should not have the executable bit Ævar Arnfjörð Bjarmason
2018-02-14 22:41   ` Jonathan Nieder
2018-02-25 19:01     ` Ævar Arnfjörð Bjarmason
2018-02-14 22:21 ` [PATCH 2/8] perl: move CPAN loader wrappers to another namespace Ævar Arnfjörð Bjarmason
2018-02-14 22:43   ` Jonathan Nieder
2018-02-14 22:21 ` [PATCH 3/8] perl: generalize the Git::LoadCPAN facility Ævar Arnfjörð Bjarmason
2018-02-14 22:57   ` Jonathan Nieder
2018-02-15  5:09     ` Todd Zullinger
2018-02-25 18:56     ` Ævar Arnfjörð Bjarmason
2018-02-25 19:05       ` Randall S. Becker
2018-02-15  4:53   ` Todd Zullinger
2018-02-15 20:41     ` Ævar Arnfjörð Bjarmason [this message]
2018-02-15 21:23       ` Todd Zullinger
2018-02-16 14:39         ` Ævar Arnfjörð Bjarmason
2018-02-16 17:55           ` Todd Zullinger
2018-02-16 22:03             ` Jonathan Nieder
2018-02-17  0:47               ` Todd Zullinger
2018-02-17  5:40                 ` Todd Zullinger
2018-02-14 22:21 ` [PATCH 4/8] perl: update our ancient copy of Error.pm Ævar Arnfjörð Bjarmason
2018-02-14 23:03   ` Jonathan Nieder
2018-02-15 20:46     ` Ævar Arnfjörð Bjarmason
2018-02-14 22:21 ` [PATCH 5/8] perl: update our copy of Mail::Address Ævar Arnfjörð Bjarmason
2018-02-14 23:46   ` Jonathan Nieder
2018-02-15  9:32     ` Matthieu Moy
2018-02-15 20:31       ` Ævar Arnfjörð Bjarmason
2018-02-14 22:21 ` [PATCH 6/8] git-send-email: unconditionally use Net::{SMTP,Domain} Ævar Arnfjörð Bjarmason
2018-02-14 23:49   ` Jonathan Nieder
2018-02-15 20:43     ` Ævar Arnfjörð Bjarmason
2018-02-14 22:21 ` [PATCH 7/8] gitweb: hard-depend on the Digest::MD5 5.8 module Ævar Arnfjörð Bjarmason
2018-02-14 23:52   ` Jonathan Nieder
2018-02-14 22:21 ` [PATCH 8/8] perl: hard-depend on the File::{Temp,Spec} modules Ævar Arnfjörð Bjarmason
2018-02-14 23:54   ` Jonathan Nieder
2018-02-15 20:42     ` Ævar Arnfjörð Bjarmason
2018-02-15 21:33       ` Junio C Hamano
2018-02-25 19:46 ` [PATCH v2 00/13] various perl fixes Ævar Arnfjörð Bjarmason
2018-03-03 15:38   ` [PATCH v3 " Ævar Arnfjörð Bjarmason
2018-03-05 19:01     ` Junio C Hamano
2018-03-03 15:38   ` [PATCH v3 01/13] perl: *.pm files should not have the executable bit Ævar Arnfjörð Bjarmason
2018-03-03 15:38   ` [PATCH v3 02/13] Git.pm: remove redundant "use strict" from sub-package Ævar Arnfjörð Bjarmason
2018-03-03 15:38   ` [PATCH v3 03/13] Git.pm: add the "use warnings" pragma Ævar Arnfjörð Bjarmason
2018-03-03 15:38   ` [PATCH v3 04/13] gitweb: hard-depend on the Digest::MD5 5.8 module Ævar Arnfjörð Bjarmason
2018-03-03 15:38   ` [PATCH v3 05/13] Git.pm: hard-depend on the File::{Temp,Spec} modules Ævar Arnfjörð Bjarmason
2018-03-03 15:38   ` [PATCH v3 06/13] git-send-email: unconditionally use Net::{SMTP,Domain} Ævar Arnfjörð Bjarmason
2018-03-03 15:38   ` [PATCH v3 07/13] perl: update our ancient copy of Error.pm Ævar Arnfjörð Bjarmason
2018-03-03 15:38   ` [PATCH v3 08/13] perl: update our copy of Mail::Address Ævar Arnfjörð Bjarmason
2018-03-03 15:38   ` [PATCH v3 09/13] perl: move CPAN loader wrappers to another namespace Ævar Arnfjörð Bjarmason
2018-03-03 15:38   ` [PATCH v3 10/13] perl: generalize the Git::LoadCPAN facility Ævar Arnfjörð Bjarmason
2018-03-03 15:38   ` [PATCH v3 11/13] perl: move the perl/Git/FromCPAN tree to perl/FromCPAN Ævar Arnfjörð Bjarmason
2018-03-03 15:38   ` [PATCH v3 12/13] Makefile: add NO_PERL_CPAN_FALLBACKS knob Ævar Arnfjörð Bjarmason
2018-03-03 15:38   ` [PATCH v3 13/13] perl Git::LoadCPAN: emit better errors under NO_PERL_CPAN_FALLBACKS Ævar Arnfjörð Bjarmason
2018-02-25 19:46 ` [PATCH v2 01/13] perl: *.pm files should not have the executable bit Ævar Arnfjörð Bjarmason
2018-02-25 19:46 ` [PATCH v2 02/13] Git.pm: remove redundant "use strict" from sub-package Ævar Arnfjörð Bjarmason
2018-02-25 19:46 ` [PATCH v2 03/13] Git.pm: add the "use warnings" pragma Ævar Arnfjörð Bjarmason
2018-02-25 19:46 ` [PATCH v2 04/13] gitweb: hard-depend on the Digest::MD5 5.8 module Ævar Arnfjörð Bjarmason
2018-02-25 20:00   ` Eric Sunshine
2018-02-25 19:46 ` [PATCH v2 05/13] Git.pm: hard-depend on the File::{Temp,Spec} modules Ævar Arnfjörð Bjarmason
2018-02-25 19:46 ` [PATCH v2 06/13] git-send-email: unconditionally use Net::{SMTP,Domain} Ævar Arnfjörð Bjarmason
2018-02-25 20:03   ` Eric Sunshine
2018-02-25 19:46 ` [PATCH v2 07/13] perl: update our ancient copy of Error.pm Ævar Arnfjörð Bjarmason
2018-02-25 19:46 ` [PATCH v2 08/13] perl: update our copy of Mail::Address Ævar Arnfjörð Bjarmason
2018-02-25 19:46 ` [PATCH v2 09/13] perl: move CPAN loader wrappers to another namespace Ævar Arnfjörð Bjarmason
2018-02-25 19:46 ` [PATCH v2 10/13] perl: generalize the Git::LoadCPAN facility Ævar Arnfjörð Bjarmason
2018-02-25 19:46 ` [PATCH v2 11/13] perl: move the perl/Git/FromCPAN tree to perl/FromCPAN Ævar Arnfjörð Bjarmason
2018-02-25 19:46 ` [PATCH v2 12/13] Makefile: add NO_PERL_CPAN_FALLBACKS knob Ævar Arnfjörð Bjarmason
2018-02-25 19:46 ` [PATCH v2 13/13] perl Git::LoadCPAN: emit better errors under NO_PERL_CPAN_FALLBACKS Ævar Arnfjörð Bjarmason

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=87sha2f0j1.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=bbourbie@slb.com \
    --cc=git@matthieu-moy.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=giuseppe.bilotta@gmail.com \
    --cc=jari.aalto@cante.net \
    --cc=marcus@griep.us \
    --cc=pasky@ucw.cz \
    --cc=peff@peff.net \
    --cc=tmz@pobox.com \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).