Reputation: 1
Given a module how can I create an rpm of not just the module, but all the module's dependencies?
Start by creating a test module
$ module-starter --author "Evan Carroll" --email "[email protected]" --module Foo::Bar
Added to MANIFEST: Changes
Added to MANIFEST: ignore.txt
Added to MANIFEST: lib/Foo/Bar.pm
Added to MANIFEST: Makefile.PL
Added to MANIFEST: MANIFEST
Added to MANIFEST: README
Added to MANIFEST: t/00-load.t
Added to MANIFEST: t/manifest.t
Added to MANIFEST: t/pod-coverage.t
Added to MANIFEST: t/pod.t
Added to MANIFEST: xt/boilerplate.t
Created starter directories and files
Now I edit the Makefile.pl
, and add Mojolicious
as a prereq.
...
PREREQ_PM => {
'Mojolicious' => '0'
....
Now I can run
perl Makefile.PL
make dist
But running,
$ sudo cpantorpm -y /tmp/yum /tmp/Foo-Bar/Foo-Bar-0.01.tar.gz
I get this,
error: Failed build dependencies:
perl >= 5.006 is needed by perl-Foo-Bar-0.01-1.noarch
perl(ExtUtils::MakeMaker) is needed by perl-Foo-Bar-0.01-1.noarch
perl(Mojolicious) is needed by perl-Foo-Bar-0.01-1.noarch
That makes sense, but I want it to create RPMs for these requirements. I would like Foo::Bar
to require an rpm that is also generated from cpan that represents Mojolicious, and for a build system to output two RPMs (one rpm for Foo::Bar
which requires the also-provided Mojolicious
RPM).
Upvotes: 10
Views: 575
Reputation: 17347
That would be way too easy to get around the dependecy hell. I would go for some project like cpan-dependecy . Somebody already did the work for you.
Here is how it works:
1) How to install Following CPAN modules are required.
- CPANPLUS
- RPM::Specfile
2) How to use To create a rpm of Linux::Smaps bin/cpan-dependency.pl --conf=config/conf.yml Linux::Smaps
3) conf.yml
- filter_requires .. Remove specified requires from the package.
- build_skip .. Skip to build the package.
- build_requires .. Build&Install specified packages before building the package.
- requires .. Add specified packages to the package's dependency.
You need to adjust conf.yml to satisfy your dependecies.
To build your project you would do the following:
bin/cpan-dependency.pl --conf=config/conf.yml Foo::Bar
Upvotes: 2