【问题标题】:How can I create an RPM from a module and recursively create separate independent RPMs for the dependencies?如何从模块创建 RPM 并递归地为依赖项创建单独的独立 RPM?
【发布时间】:2019-11-19 17:09:28
【问题描述】:

给定一个模块,我如何创建一个不仅包含模块的 rpm,还包含所有模块的依赖项?

首先创建一个测试模块

$ module-starter --author "Evan Carroll" --email "me@evancarroll.com" --module Foo::Bar
Added to MANIFEST: Changes
Added to MANIFEST: ignore.txt
Added to MANIFEST: lib/Foo/Bar.pm
Added to MANIFEST: Makefile.PL
Added to MANIFEST: MANIFEST
Added to MANIFEST: README
Added to MANIFEST: t/00-load.t
Added to MANIFEST: t/manifest.t
Added to MANIFEST: t/pod-coverage.t
Added to MANIFEST: t/pod.t
Added to MANIFEST: xt/boilerplate.t
Created starter directories and files

现在我编辑Makefile.pl,并添加Mojolicious 作为先决条件。

...
PREREQ_PM => {                                                         
      'Mojolicious' => '0'
....

现在我可以跑了

perl Makefile.PL
make dist

但正在运行,

$ sudo cpantorpm -y /tmp/yum /tmp/Foo-Bar/Foo-Bar-0.01.tar.gz 

我明白了,

error: Failed build dependencies:
        perl >= 5.006 is needed by perl-Foo-Bar-0.01-1.noarch
        perl(ExtUtils::MakeMaker) is needed by perl-Foo-Bar-0.01-1.noarch
        perl(Mojolicious) is needed by perl-Foo-Bar-0.01-1.noarch

这是有道理的,但我希望它为这些要求创建 RPM。我希望Foo::Bar 需要一个也从代表 Mojolicious 的 cpan 生成的 rpm,并让构建系统输出两个 RPM(一个 rpm 用于 Foo::Bar,它需要同时提供的 Mojolicious RPM)。

【问题讨论】:

  • FWIW 我试过这个(不使用sudo)和cpantorpm 失败,因为它使用strace 来监视运行perl Makefile.PL; makestrace 的输出失败,/bin/strace: Could not attach to process...For more details, see /etc/sysctl.d/10-ptrace.conf: Operation not permitted。请参阅this post 了解更多信息。

标签: perl rpm packaging cpan


【解决方案1】:

这太容易绕过依赖地狱了。我会去做一些项目 比如cpan-dependecy。已经有人做了 为你工作。

这是它的工作原理:

1) 如何安装以下 CPAN 模块是必需的。

  • CPANPLUS
  • RPM::规范文件

2) 使用方法 创建Linux::Smaps的rpm bin/cpan-dependency.pl --conf=config/conf.yml Linux::Smaps

3) conf.yml

  • filter_requires .. 从包中删除指定的要求。
  • build_skip .. 跳过构建包。
  • build_requires .. 在构建包之前构建和安装指定的包。
  • 需要..将指定的包添加到包的依赖项中。

你需要调整conf.yml来满足你的依赖。

要构建您的项目,您需要执行以下操作:

bin/cpan-dependency.pl --conf=config/conf.yml Foo::Bar

【讨论】:

    猜你喜欢
    • 2013-07-20
    • 2020-04-10
    • 2019-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-25
    • 2020-06-01
    • 2020-01-03
    相关资源
    最近更新 更多