jonathanstowe / TermReadKey

Character mode terminal access for Perl
12 stars 27 forks source link

Why does META.yml claim to provide the Term::ReadKey package? #29

Closed thaljef closed 5 years ago

thaljef commented 7 years ago

Starting in 2.37, the dist metadata says that META.yml is the file that provides the Term::ReadKey package. This appears to be deliberately injected by the ADD_META in Makefile.PL. This throws off Module::Metadata (used by Metacpan and Pinto) which expect the file to be something that looks like source code (usually either a .pm or .PL file). Can you help @mschout and myself understand why it is being done this way. See also thaljef/Pinto#241

chizmw commented 6 years ago

Aha! I got bitten by this problem this morning, trying to pull 2.37 into our pinto repo at work. I'd be interested to know what's happening here too.

hartzell commented 6 years ago

[edit, calmer wording]

This has bitten me too. What's behind this?

hartzell commented 6 years ago

This is biting me again and I can no longer fix it by pinning to the older (2.33) version because that has a bug with the number of tests that are skipped when running without a TTY that keeps the tests from passing when being built as part of a Jenkins job.

The Makefile.PL for this package contains this bit:

        provides  => {
            'Term::ReadKey' => {
                file    => 'META.yml',
                version => '2.37',
            },
        },

which leads to this bit in the META.json:

   "provides" : {
      "Term::ReadKey" : {
         "file" : "META.yml",
         "version" : "2.37"
      }
   },

The provides section of the CPAN Meta Spec says:

This field is required. It must contain a Unix-style relative file path from the root of the distribution directory to a file that contains or generates the package. It may be given as META.yml or META.json to claim a package for indexing without needing a *.pm.

There is no actual Term/ReadKey.pm in the source tree to point at, I think that the package is doing the right thing and that thaljef/Pinto#241 should be generalized for the case where the "file" is META.{yaml,json} to follow the spec.

hartzell commented 6 years ago

Alternatively, it seems as if used ReadKey_pm.PL instead of META.yml would also fulfill the META spec.

mschout commented 6 years ago

I submitted a PR to pinto that fixes this in Pinto. I'd consider this issue closed as its perfectly valid per the CPAN Meta Spec to declare a provides file of META.yml like this.

hartzell commented 6 years ago

I'm not sure what Pinto's release schedule is. It might be nice to mitigate the issue on this side (and perhaps make the metacpan search results less confusing). See #31

hartzell commented 6 years ago

Ack. That renaming doesn't work. It fails to match this regex in sub is_simile here:

    $file =~ s|\.pm(?:\.PL)?||;

Renaming the file to ReadKey.pm.PL and touching up Makefile.PL and MANIFEST (and setting SIGN to false) result in a distribution that passes its tests and that Pinto can index as is.

mschout commented 6 years ago

The fix for this has already been merged into Pinto. I'm guessing @thaljef will release a fixed version soon, which makes all of this pointless. What Term::ReadKey is doing is perfectly valid according to the CPAN Meta Spec. This was a Pinto problem, not a Term::ReadKey problem.

Grinnz commented 5 years ago

There is a file which generates the source code for this module so there's no need to use META.yml, so I'd still consider this a valid issue, without an explanation for why this was done.

jonathanstowe commented 5 years ago

I have just pushed 2.38 which includes the above PR