关于为 Perl 模块捆绑 CentOS RPM 的问题

Question about bundling CentOS RPMs for Perl modules

我正在尝试将一堆 Perl 模块捆绑在 RPM 包中以便于部署。我尝试了很多工具,但还是选择了 fpm (https://github.com/jordansissel/fpm)。

所以我已经设法为每个所需的 Perl 模块手动构建和安装每个 RPM。我不确定这是正确的。但我对 RPM 包没有太多经验。但据我所知,这是正确的行为。每个 RPM 包都包含相应 Perl 模块所需的所有依赖项。

问题是当我尝试使用生成的包安装我的模块时遇到了一些冲突。

sudo yum --disablerepo=* localinstall *.rpm

当它尝试安装时:

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

我花了几天时间尝试调试这个问题,但我似乎无法弄清楚。我所做的只是使用 yum 安装 perl,因为这是先决条件。我希望我的本地安装能正常工作。

错误消息似乎很清楚:不能有两个包提供相同的文件。

对于 Moose.so 周围的错误,您可能希望将共享库移动到一个单独的包中,并使其成为所有需要它的模块的依赖项。

对于 HTML-HeadParser 周围的错误,我认为您只需拥有一个 HTML-Parser 程序包,并使 HTML-HeadParserHTML-Entitities 之类的东西依赖于它。

也许花点时间看看现有的 Perl 模块是如何打包的?例如,查看: