Tuesday, April 12, 2022

[SOLVED] Question about bundling CentOS RPMs for Perl modules

Issue

I am trying to bundle a bunch of Perl modules in RPM packages for easy deployments. I've tried a lot of tools but settled on fpm (https://github.com/jordansissel/fpm).

So I've managed to manually build and install each RPM for each of the required Perl modules. I'm not sure this is correct. But I don't have a lot of experience with RPM packages. But as far as I can tell, this is the correct behavior. Each RPM package contains all required dependencies for the corresponding Perl module.

The problem is I get some conflicts when I try to use the resulting bundle to install my modules.

sudo yum --disablerepo=* localinstall *.rpm

And when it tries to install:

Transaction Summary
==============================================================================================================================================================================================================
Install  174 Packages

Total size: 45 M
Installed size: 357 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Error: Transaction test error:
  file /usr/local/lib64/perl5/auto/Moose/Moose.so conflicts between attempted installs of Moose-Exporter-2.2013-1.x86_64 and Moose-2.2013-1.x86_64
  file /usr/local/lib64/perl5/auto/Moose/Moose.so conflicts between attempted installs of Moose-Role-2.2013-1.x86_64 and Moose-Exporter-2.2013-1.x86_64
  file /usr/local/lib64/perl5/auto/Moose/Moose.so conflicts between attempted installs of Moose-Util-TypeConstraints-2.2013-1.x86_64 and Moose-Role-2.2013-1.x86_64
  file /usr/local/lib64/perl5/auto/Moose/Moose.so conflicts between attempted installs of Moose-Util-2.2013-1.x86_64 and Moose-Util-TypeConstraints-2.2013-1.x86_64
  file /usr/local/lib64/perl5/auto/Moose/Moose.so conflicts between attempted installs of Moose-Meta-TypeConstraint-2.2013-1.x86_64 and Moose-Util-2.2013-1.x86_64
  file /usr/local/lib64/perl5/auto/Moose/Moose.so conflicts between attempted installs of Moose-Meta-TypeConstraint-Union-2.2013-1.x86_64 and Moose-Meta-TypeConstraint-2.2013-1.x86_64
  file /usr/local/lib64/perl5/auto/Moose/Moose.so conflicts between attempted installs of Moose-Util-MetaRole-2.2013-1.x86_64 and Moose-Meta-TypeConstraint-Union-2.2013-1.x86_64
  file /usr/local/lib64/perl5/auto/Moose/Moose.so conflicts between attempted installs of Moose-Meta-Attribute-2.2013-1.x86_64 and Moose-Util-MetaRole-2.2013-1.x86_64
  file /usr/local/lib64/perl5/auto/Moose/Moose.so conflicts between attempted installs of Moose-Meta-Class-2.2013-1.x86_64 and Moose-Meta-Attribute-2.2013-1.x86_64
  file /usr/local/lib64/perl5/auto/Moose/Moose.so conflicts between attempted installs of Moose-Meta-Role-2.2013-1.x86_64 and Moose-Meta-Class-2.2013-1.x86_64
  file /usr/local/lib64/perl5/auto/Moose/Moose.so conflicts between attempted installs of Moose-Meta-Role-Attribute-2.2013-1.x86_64 and Moose-Meta-Role-2.2013-1.x86_64
  file /usr/local/lib64/perl5/auto/HTML/Parser/Parser.so conflicts between attempted installs of HTML-HeadParser-3.75-1.x86_64 and HTML-Entities-3.75-1.x86_64

I've spent days trying to debug the issue but I can't seem to figure it out. All I did was install perl using yum since that was a prerequisite. I expected my local install would work.


Solution

The error message seems clear: you can't have two packages providing the same file.

For the errors around Moose.so, you would probably want to move the shared library into a separate package and make it a dependency of all the modules that require it.

For the errors around HTML-HeadParser, I think you would simply have a HTML-Parser package and that make things like HTML-HeadParser and HTML-Entitities depend on it.

Maybe take some time and look at how the existing Perl modules are packaged? For example, look at:



Answered By - larsks
Answer Checked By - Gilberto Lyons (WPSolving Admin)