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

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Fri, 16 Feb 2018 15:39:03 +0100

On Thu, Feb 15 2018, Todd Zullinger jotted:

> [I dropped [email-masked] from the Cc: list, as it bounced
> on my previous reply.]
>
> Ævar Arnfjörð Bjarmason wrote:
>> That makes sense, I'll incorporate that in a re-roll. I like
>> NO_PERL_CPAN_FALLBACKS or just NO_CPAN_FALLBACKS better.
>
> Either is an improvement.  Starting with NO_PERL_ seems
> like a slightly better bikeshed color. :)
>
>> 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.
>
> Teaching Git::LoadCPAN to never fallback sounds like a good
> idea.  At least then if the packager intended to avoid the
> fallbacks and didn't get it right the error message could be
> more useful.
>
> Hopefully that's not a common problem for packagers though.
> (And adding the Makefile knob was intended to help make it
> easier for packagers to achieve this common goal.)
>
>> 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.
>
> What about moving perl/Git/FromCPAN to perl/FromCPAN and
> then including perl/FromCPAN in LIB_PERL{,_GEN} only if
> NO_PERL_CPAN_FALLBACKS is unset?
>
>  LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)
> +ifndef NO_PERL_CPAN_FALLBACKS
> +LIB_PERL += $(wildcard perl/FromCPAN/*.pm perl/FromCPAN/*/*.pm)
> +endif
>  LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))
>
> I haven't tested that at all, so it could be broken in many
> ways.

Yes that's a much better idea, it evades the whole problem of conflating
the perl/Git* glob.