[CentOS] RPM perl requirements woes

Thu May 12 15:33:33 UTC 2016
Robin Lee <robinlee.sysu at gmail.com>

On Thu, May 12, 2016 at 11:14 PM, Anand Buddhdev <anandb at ripe.net> wrote:

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

You can filter the generated Requies by defining filter pattern in the
specfile of your package.
Refer to:
https://fedoraproject.org/wiki/Packaging:AutoProvidesAndRequiresFiltering#Perl

> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos
>