Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create an RPM from a module and recursively create separate independent RPMs for the dependencies?

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).

like image 574
NO WAR WITH RUSSIA Avatar asked Jul 10 '19 06:07

NO WAR WITH RUSSIA


People also ask

What are the two parts of an RPM package?

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.

How do I make a Noarch RPM?

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.

When installing downloaded package on a Red Hat based distribution manually using RPM what may you have to do first?

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.


1 Answers

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

like image 56
tukan Avatar answered Sep 29 '22 17:09

tukan