[CentOS] RPM perl requirements woes

Thu May 12 15:14:20 UTC 2016
Anand Buddhdev <anandb at ripe.net>

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:


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
Error: Package: 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
           Requires: perl(namespace::clean::_Util)
Error: Package: 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


package # This is JSON::backportPP

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.