miyagawa / Carmel

CPAN Artifact Repository Manager
Other
138 stars 17 forks source link

Can't find artifact for Time::Piece::MySQL only when Test::MockTime is also present #89

Closed m-dango closed 2 years ago

m-dango commented 2 years ago
$ cat cpanfile
requires 'Time::Piece::MySQL';
requires 'Test::MockTime';
$ carmel
Using Test::MockTime (0.17)
---> Installing new dependencies: Time::Piece::MySQL
Successfully installed Time-Piece-MySQL-0.06
1 distribution installed
Using Test::MockTime (0.17)
Can't find an artifact for Time::Piece::MySQL => 0
You need to run `carmel install` first to get the modules installed and artifacts built.
$ carmel --version
Carmel version v0.9.1

Run on perl 5.34.1 and 5.36.0-RC3. Both function correctly when independent from each other

miyagawa commented 2 years ago

Thanks for the report. Looks like a bug caused by bad install.json generated for Time::Piece::MySQL (with Parse::PMFile):

Noe builds/Time-Piece-MySQL-0.06 
➜  jq . blib/meta/install.json
{
  "name": "Time::Piece::MySQL",
  "target": "Time::Piece::MySQL",
  "dist": "Time-Piece-MySQL-0.06",
  "version": 0.06,
  "pathname": "K/KA/KASEI/Time-Piece-MySQL-0.06.tar.gz",
  "provides": {
    "Time::Piece::MySQL": {
      "version": 0.06,
      "file": "lib/Time/Piece/MySQL.pm"
    },
    "Time::Piece": {
      "file": "lib/Time/Piece/MySQL.pm",
      "version": 0.06
    }
  }
}
m-dango commented 2 years ago

Had been looking around on the Time::Piece::MySQL and spotted a potentially related bug: https://rt.cpan.org/Public/Bug/Display.html?id=125106

miyagawa commented 2 years ago

Yep, https://metacpan.org/dist/Time-Piece-MySQL/source/lib/Time/Piece/MySQL.pm#L10 is the offending line.

That, in combination with Time::Piece being a core module causes Carmel to skip this distribution during carmel install but then unable to verify the requirements after that. I'll try to come up with a workaround.

m-dango commented 2 years ago

Manually removing Time::Piece from within provides in the install.json seems to be working for me in the time being.

miyagawa commented 2 years ago

Yeah, that'd work as long as you develop in your local environment.

miyagawa commented 2 years ago

OK, the reason this fails is that the provides section (Time::Piece: 0.06) conflicts with the Test::MockTime's requirement of runtime requires Time::Piece: 1.08 (0.06 < 1.08), so Carmel's artifact search excludes this distribution.

I can't think about an easy way to work around this at the code level at this moment.

Ideal solution would be one of:

miyagawa commented 2 years ago

Experiment pushed to work around the issue in #90