From 862a6863cdc316c3f2d2b75065e76042fd238f56 Mon Sep 17 00:00:00 2001 From: Jordan Sissel Date: Sun, 8 Dec 2024 22:21:30 -0800 Subject: [PATCH] Add flag to allow using older 'perl' rpm dependency name for systems which do not have 'perl-interpreter' dependency available. (#2066) --- lib/fpm/package/rpm.rb | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/fpm/package/rpm.rb b/lib/fpm/package/rpm.rb index 5e79e5c3a..16cf41548 100644 --- a/lib/fpm/package/rpm.rb +++ b/lib/fpm/package/rpm.rb @@ -185,6 +185,9 @@ class FPM::Package::RPM < FPM::Package end end + option "--old-perl-dependency-name", :flag, + "Use older 'perl' depdency name. Newer Red Hat (and derivatives) use a dependency named 'perl-interpreter'." + private # Fix path name @@ -278,17 +281,19 @@ def iteration # See FPM::Package#converted_from def converted_from(origin) if origin == FPM::Package::CPAN - fixed_deps = [] - self.dependencies.collect do |dep| - # RPM package "perl" is a metapackage which install all the Perl bits and core modules, then gcc... - # this must be replaced by perl-interpreter - if name=/^perl([\s<>=].*)$/.match(dep) - fixed_deps.push("perl-interpreter#{name[1]}") - else - fixed_deps.push(dep) + if !attributes[:rpm_old_perl_dependency_name?] + fixed_deps = [] + self.dependencies.collect do |dep| + # RPM package "perl" is a metapackage which install all the Perl bits and core modules, then gcc... + # this must be replaced by perl-interpreter + if name=/^perl([\s<>=].*)$/.match(dep) + fixed_deps.push("perl-interpreter#{name[1]}") + else + fixed_deps.push(dep) + end end + self.dependencies = fixed_deps end - self.dependencies = fixed_deps elsif origin == FPM::Package::Gem fixed_deps = [] self.dependencies.collect do |dep|