thaljef / Pinto

Curate your own repository of Perl modules
https://metacpan.org/module/Pinto::Manual
66 stars 49 forks source link

Add dependency resolution of Perl bundles. #165

Closed chakatodd closed 10 years ago

chakatodd commented 10 years ago

Jeff,

What needs to be done so that a "pinto add path/to/Bundle-My-App-1.0.tar.gz" will also pull the dependencies from CPAN?

Thanks!

thaljef commented 10 years ago

Basically, Pinto::PackageExtractor needs to know how to extract the dependencies from a Bundle-style distribution. The code for that can probably be lifted from CPAN.pm.

If you are the author of the Bundle, would it be possible to use the Task-style distribution instead? Tasks are generally preferred over Bundles because they are more compatible with the rest of the perl toolchain (including Pinto).

chakatodd commented 10 years ago

Yes, totally possible. I had never looked into the difference between Bundle and Task, but I will do that!

thaljef commented 10 years ago

Here is some background on Tasks: https://metacpan.org/pod/Task

Adam's examples are geared toward using his Module::Install system. But you can use any build system you want. Basically, a Task is just a distribution with a placeholder module that using the conventional META files to declare dependencies.

There are lots of examples on CPAN: https://metacpan.org/search?q=Task

Hope that helps.

hartzell commented 10 years ago

If you are a Dist::Zilla user, check out the Taskweaver plugin for laziness and easy documentation.

chakatodd commented 10 years ago

Any idea why this isn't enough for pinto to recognize my dependencies?

$ find TaskHellowWorldToybox2 -type f
TaskHellowWorldToybox2/Build.PL
TaskHellowWorldToybox2/lib/Task/HelloWorld/Toybox2.pm
TaskHellowWorldToybox2/MANIFEST

Pinto adds the module but not it's deps. Is there some other file my distribution needs?

chakatodd commented 10 years ago

FYI, I downloaded Task::Latemp and when I remove the Makefile.PL "pinto add" no longer recognizes the dependencies.

chakatodd commented 10 years ago

Jeff, I made some progress on this. The main problem I am finding is that pinto is just not as good as figuring out dependencies as cpanm is. So pinto add Task-MyTask-0.01.tgz adds many modules, but then using cpanm --mirror file:///pinto_repo/stacks/master/ --mirror-only Task::MyTask fails to find many dependencies on the mirror. No doubt this is not a bug in pinto, but a bug in either the modules that gather the metadata or problems in the packaging of specific modules. Still, it adds some challenge to using pinto. Still, thanks for the hard work on pinto!

thaljef commented 10 years ago

Todd, if you send me your Task tarball, I can try to diagnose the problem.

chakatodd commented 10 years ago

I figured this out too. There were a few problems. First, my module name ended in a "Toybox2" and that was causing that string to be used as the version. I think this is a big on one of the metadata modules that pinto uses.

Once I removed the 2 I figured out that I needed a META.yml/json. I'm using Module::Build so I did:

perl Build.PL
./Build distmeta
./Build dist

And pinto properly processed that distribution. If I am no using Module::Build correctly please let me know.

That got me to the problem with HTTP::Thin::UserAgent which we discussed separately.

Thank you for your help and patience!

On Thursday, July 10, 2014, Jeffrey Ryan Thalhammer < notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

Todd, if you send me your Task tarball, I can try to diagnose the problem.

— Reply to this email directly or view it on GitHub https://github.com/thaljef/Pinto/issues/165#issuecomment-48674699.

thaljef commented 10 years ago

The number in the name shouldn't be a problem. For example, pinto handles Dancer2 just fine.

But yes, you need to run the proper ./Build steps to create the meta files and pack the tar ball.