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).
The lead, which identifies the file as an RPM file and contains some obsolete headers. The signature, which can be used to ensure integrity and/or authenticity. The header, which contains metadata including package name, version, architecture, file list, etc.
Building the rpmMake the SPECS directory your pwd, then create the link. Run the following command to build the rpm. It should only take a moment to create the rpm if no errors occur. Check in the ~/rpmbuild/RPMS/noarch directory to verify that the new rpm exists there.
In order to install an RPM package you must first have the RPM package you are trying to install on your system. The Red Hat Customer Portal provides all the RPM packages included in our products in our Downloads area.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With