RPM Perl Requirements Woes

Home » CentOS » RPM Perl Requirements Woes
CentOS 3 Comments

Dear CentOS hive mind,

I’m trying to package up a perl module into an RPM for easy deployment. I want it to be as self-contained as possible (to avoid version issues with perl modules in base or EPEL). So in my spec file, I’m doing:

curl -L http://cpanmin.us | perl – App::cpanminus -L
%{buildroot}/opt/zonemaster Zonemaster

This way, cpanminus is installed first, and then it goes on to install the module and all its dependencies. In the %files section, if I do:

/opt/zonemaster

the RPM is also neatly packaged up. However, trying to install this on another system causes errors:

# yum install zonemaster-engine-1.0.13-1.el7.gii.x86_64.rpm

… elided

… Error: Package: zonemaster-engine-1.0.13-1.el7.gii.x86_64
(/zonemaster-engine-1.0.13-1.el7.gii.x86_64)
Requires: perl(JSON::backportPP)
Error: Package: zonemaster-engine-1.0.13-1.el7.gii.x86_64
(/zonemaster-engine-1.0.13-1.el7.gii.x86_64)
Requires: perl(namespace::clean::_Util)
Error: Package: zonemaster-engine-1.0.13-1.el7.gii.x86_64
(/zonemaster-engine-1.0.13-1.el7.gii.x86_64)
Requires: perl(Moose::Conflicts)

Now, JSON::backportPP and Moose::Conflicts are part of JSON and Moose, respectively. However, those specific modules hide themselves from
/usr/lib/rpm/perl.prov, by doing this:

package # hide from PAUSE
Moose::Conflicts;

and

package # This is JSON::backportPP
JSON::PP;

This is annoying. Does anyone have any idea on how to fix this? Can I
get away with manually adding:

Provides: JSON::backportPP Moose::Conflicts

to the spec file? It looks like an ugly hack to me.

Regards, Anand

3 thoughts on - RPM Perl Requirements Woes

  • cpanminus is already packaged for EL7. It just isn’t installed by default.

    $ sudo yum install perl-App-cpanminus

    You can list perl-App-cpanminus in a BuildRequires rule to tell rpmpbuild that it’s needed to build the RPM. Then you don’t have a command soaking up CPU time and network I/O on each RPM build.

    Add a Requires line for perl-JSON or perl-JSON-PP to the spec file, and the same for perl-Moose. That will make yum seek those dependencies out and install them before your RPM.

    Because perl-Moose is in EPEL, this does add an implicit dependency on EPEL, but from your post it seems you’re already depending on it.

    Only if your package does in fact include those Perl distributions. But given that perl-JSON and perl-Moose are available separately, I don’t see why you’d want to do that.