[CentOS] RPM perl requirements woes

Thu May 12 16:18:31 UTC 2016
Warren Young <wyml at etr-usa.com>

On May 12, 2016, at 9:14 AM, Anand Buddhdev <anandb at ripe.net> wrote:
> curl -L http://cpanmin.us | perl - App::cpanminus -L

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

  $ sudo yum install perl-App-cpanminus

> This way, cpanminus is installed first

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.

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

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.

> Can I
> get away with manually adding:
> Provides: JSON::backportPP Moose::Conflicts

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.