git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/8] perl: generalize the Git::LoadCPAN facility

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Feb 25, 2018, 18:56 UTC
Message-ID
<87sh9oew4d.fsf@evledraar.gmail.com>
In-Reply-To
<20180214225754.GC136185@aiede.svl.corp.google.com>
On Wed, Feb 14 2018, Jonathan Nieder jotted:
Show 35 quoted lines
> Ævar Arnfjörð Bjarmason wrote:
>
>> Change the two wrappers to load from CPAN (local OS) or our own copy
>> to do so via the same codepath.
>
> nit: I think with s/to load/that load/ this will be easier to read.
>
>> I added the Error.pm wrapper in 20d2a30f8f ("Makefile: replace
>> perl/Makefile.PL with simple make rules", 2017-12-10), and shortly
>> afterwards Matthieu Moy added a wrapper for Mail::Address in
>> bd869f67b9 ("send-email: add and use a local copy of Mail::Address",
>> 2018-01-05).
>>
>> His was simpler since Mail::Address doesn't have an "import" method,
>> but didn't do the same sanity checking, e.g. a missing FromCPAN
>> directory (which OS packages are likely not to have) wouldn't be
>> explicitly warned about.
>
> I'm having trouble parsing this.  Mail::Address didn't do the same
> sanity checking or his didn't?
>
> The comma before e.g. should be a period or semicolon, since it's
> starting a new independent clause.
>
>> Now both use a modification of the previously Error.pm-specific
>> codepath, which has been amended to take the module to load as
>> parameter, as well as whether or not that module has an import method.
>
> Does "now" mean before this patch or after this patch?  Usually
> commit messages describe the status quo without the patch in the
> present tense and the change the patch will make in the imperative.
> So this could say:
>
> 	Update both to use a common implementation based on the previous
> 	Error.pm loader.

All good feeedback, thanks. Incorporated into v2 which I'm about to submit.

Show 12 quoted lines
> [...]
>> +++ b/perl/Git/LoadCPAN.pm
>> @@ -0,0 +1,74 @@
> [...]
>> +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.
>
> not about this patch: have we considered making it a hard requirement?
> Both Mail::Address and Error.pm are pretty widely available, and I
> wonder if we could make the instructions in the INSTALL file say that
> they are required dependencies to simplify things.

I can't remember when, but at some point this was discussed on list, and the consensus was that us using perl should be kept as a non-invasive implementation detail that would be as small of a pain as possible for users.

It's easy for distros to package these modules, but for users building from source who know nothing about perl it can be a pain.

I also think it's very useful to avoid the side-discussion about not using some useful CPAN module in the future just because it's not widely used, but would be perfect for some use-case of ours.

> I admit part of my bias here is coming from the distro world, where we
> have to do extra work to get rid of the FromCPAN embedded copies and
> would be happier not to have to.

I think there's a very good argument to be made for inverting the NO_PERL_CPAN_FALLBACKS logic, but my soon to be submitted v2 keeps it off by default.

Show 6 quoted lines
> [...]
>> +Usually OS's will not ship with Git's Git::FromCPAN tree at all,
>> +preferring to use their own packaging of CPAN modules instead.
>
> nit: I think the plural of OS is OSes, or something like
> "distributors" or "operating systems".
Thanks.
Show 11 quoted lines
> [...]
>> +    eval {
>> +	require $package_pm;
>> +	1;
>> +    } or do {
>
> also not about this patch: this mixed tabs/spacing formatting feels a
> bit unusual.  I don't know if it's idiomatic for perl, and if it is
> then no complaints; it just stood out a little.  Can
> Documentation/CodingGuidelines say something about the preferred
> indentation in Perl to avoid having to think about such questions?

Thanks, that sucked. Changed to \t. I still haven't gotten around to hacking my $EDITOR settings for git.git (like for C & SH).

Show 15 quoted lines
>> --- a/perl/Git/LoadCPAN/Error.pm
>> +++ b/perl/Git/LoadCPAN/Error.pm
>> @@ -2,45 +2,9 @@ package Git::LoadCPAN::Error;
>>  use 5.008;
>>  use strict;
>>  use warnings;
>> +use Git::LoadCPAN (
>> +    module => 'Error',
>> +    import => 1,
>> +);
>
> Nice!
>
> Thanks and hope that helps,
> Jonathan
Previous: Todd ZullingerNext: Randall S. Becker
Message 13 of 66 in “various perl fixes”
  1. 0/8 various perl fixesÆvar Arnfjörð Bjarmason, Feb 14, 2018
  2. 1/8 perl: *.pm files should not have the executable bitÆvar Arnfjörð Bjarmason, Feb 14, 2018
  3. Jonathan NiederFeb 14, 2018
  4. Ævar Arnfjörð BjarmasonFeb 25, 2018
  5. 2/8 perl: move CPAN loader wrappers to another namespaceÆvar Arnfjörð Bjarmason, Feb 14, 2018
  6. Jonathan NiederFeb 14, 2018
  7. 4/8 perl: update our ancient copy of Error.pmÆvar Arnfjörð Bjarmason, Feb 14, 2018
  8. Jonathan NiederFeb 14, 2018
  9. Ævar Arnfjörð BjarmasonFeb 15, 2018
  10. 3/8 perl: generalize the Git::LoadCPAN facilityÆvar Arnfjörð Bjarmason, Feb 14, 2018
  11. Jonathan NiederFeb 14, 2018
  12. Todd ZullingerFeb 15, 2018
  13. Ævar Arnfjörð BjarmasonFeb 25, 2018
  14. Randall S. BeckerFeb 25, 2018
  15. Todd ZullingerFeb 15, 2018
  16. Ævar Arnfjörð BjarmasonFeb 15, 2018
  17. Todd ZullingerFeb 15, 2018
  18. Ævar Arnfjörð BjarmasonFeb 16, 2018
  19. Todd ZullingerFeb 16, 2018
  20. Jonathan NiederFeb 16, 2018
  21. Todd ZullingerFeb 17, 2018
  22. Todd ZullingerFeb 17, 2018
  23. 6/8 git-send-email: unconditionally use Net::{SMTP,Domain}Ævar Arnfjörð Bjarmason, Feb 14, 2018
  24. Jonathan NiederFeb 14, 2018
  25. Ævar Arnfjörð BjarmasonFeb 15, 2018
  26. 7/8 gitweb: hard-depend on the Digest::MD5 5.8 moduleÆvar Arnfjörð Bjarmason, Feb 14, 2018
  27. Jonathan NiederFeb 14, 2018
  28. 5/8 perl: update our copy of Mail::AddressÆvar Arnfjörð Bjarmason, Feb 14, 2018
  29. Jonathan NiederFeb 14, 2018
  30. Matthieu MoyFeb 15, 2018
  31. Ævar Arnfjörð BjarmasonFeb 15, 2018
  32. 8/8 perl: hard-depend on the File::{Temp,Spec} modulesÆvar Arnfjörð Bjarmason, Feb 14, 2018
  33. Jonathan NiederFeb 14, 2018
  34. Ævar Arnfjörð BjarmasonFeb 15, 2018
  35. Junio C HamanoFeb 15, 2018
  36. 00/13 various perl fixesÆvar Arnfjörð Bjarmason, Feb 25, 2018
  37. 01/13 perl: *.pm files should not have the executable bitÆvar Arnfjörð Bjarmason, Feb 25, 2018
  38. 02/13 Git.pm: remove redundant "use strict" from sub-packageÆvar Arnfjörð Bjarmason, Feb 25, 2018
  39. 03/13 Git.pm: add the "use warnings" pragmaÆvar Arnfjörð Bjarmason, Feb 25, 2018
  40. 04/13 gitweb: hard-depend on the Digest::MD5 5.8 moduleÆvar Arnfjörð Bjarmason, Feb 25, 2018
  41. Eric SunshineFeb 25, 2018
  42. 05/13 Git.pm: hard-depend on the File::{Temp,Spec} modulesÆvar Arnfjörð Bjarmason, Feb 25, 2018
  43. 07/13 perl: update our ancient copy of Error.pmÆvar Arnfjörð Bjarmason, Feb 25, 2018
  44. 06/13 git-send-email: unconditionally use Net::{SMTP,Domain}Ævar Arnfjörð Bjarmason, Feb 25, 2018
  45. Eric SunshineFeb 25, 2018
  46. 09/13 perl: move CPAN loader wrappers to another namespaceÆvar Arnfjörð Bjarmason, Feb 25, 2018
  47. 08/13 perl: update our copy of Mail::AddressÆvar Arnfjörð Bjarmason, Feb 25, 2018
  48. 10/13 perl: generalize the Git::LoadCPAN facilityÆvar Arnfjörð Bjarmason, Feb 25, 2018
  49. 11/13 perl: move the perl/Git/FromCPAN tree to perl/FromCPANÆvar Arnfjörð Bjarmason, Feb 25, 2018
  50. 13/13 perl Git::LoadCPAN: emit better errors under NO_PERL_CPAN_FALLBACKSÆvar Arnfjörð Bjarmason, Feb 25, 2018
  51. 12/13 Makefile: add NO_PERL_CPAN_FALLBACKS knobÆvar Arnfjörð Bjarmason, Feb 25, 2018
  52. 00/13 various perl fixesÆvar Arnfjörð Bjarmason, Mar 3, 2018
  53. 01/13 perl: *.pm files should not have the executable bitÆvar Arnfjörð Bjarmason, Mar 3, 2018
  54. 02/13 Git.pm: remove redundant "use strict" from sub-packageÆvar Arnfjörð Bjarmason, Mar 3, 2018
  55. 04/13 gitweb: hard-depend on the Digest::MD5 5.8 moduleÆvar Arnfjörð Bjarmason, Mar 3, 2018
  56. 05/13 Git.pm: hard-depend on the File::{Temp,Spec} modulesÆvar Arnfjörð Bjarmason, Mar 3, 2018
  57. 03/13 Git.pm: add the "use warnings" pragmaÆvar Arnfjörð Bjarmason, Mar 3, 2018
  58. 06/13 git-send-email: unconditionally use Net::{SMTP,Domain}Ævar Arnfjörð Bjarmason, Mar 3, 2018
  59. 10/13 perl: generalize the Git::LoadCPAN facilityÆvar Arnfjörð Bjarmason, Mar 3, 2018
  60. 11/13 perl: move the perl/Git/FromCPAN tree to perl/FromCPANÆvar Arnfjörð Bjarmason, Mar 3, 2018
  61. 12/13 Makefile: add NO_PERL_CPAN_FALLBACKS knobÆvar Arnfjörð Bjarmason, Mar 3, 2018
  62. 13/13 perl Git::LoadCPAN: emit better errors under NO_PERL_CPAN_FALLBACKSÆvar Arnfjörð Bjarmason, Mar 3, 2018
  63. 08/13 perl: update our copy of Mail::AddressÆvar Arnfjörð Bjarmason, Mar 3, 2018
  64. 09/13 perl: move CPAN loader wrappers to another namespaceÆvar Arnfjörð Bjarmason, Mar 3, 2018
  65. 07/13 perl: update our ancient copy of Error.pmÆvar Arnfjörð Bjarmason, Mar 3, 2018
  66. Junio C HamanoMar 5, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.