Skip to content

Commit c42b749

Browse files
committed
(PA-6422) Namespace gem_install_options
Settings are shared across all components, so `settings[:gem_install_options]` in the ffi gem caused its options to be passed to gems that follow like gssapi in the bolt-runtime: /opt/puppetlabs/bolt/bin/gem install --no-document --local --bindir=/opt/puppetlabs/bolt/bin gssapi-1.3.1.gem -- --disable-system-libffi This commit namespaces the options so they only apply when installing that specific gem. The namespace is based on the full gem name like `rubygems-ffi`, not the short name `ffi`.
1 parent 416c600 commit c42b749

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

configs/components/_base-rubygem.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@
3939

4040
# If a gem needs more command line options to install set the :gem_install_options
4141
# in its component file rubygem-<compoment>, before the instance_eval of this file.
42-
if settings[:gem_install_options].nil?
42+
gem_install_options = settings["#{pkg.get_name}_gem_install_options".to_sym]
43+
if gem_install_options.nil?
4344
pkg.install do
4445
"#{settings[:gem_install]} #{name}-#{version}.gem"
4546
end
4647
else
4748
pkg.install do
48-
"#{settings[:gem_install]} #{name}-#{version}.gem #{settings[:gem_install_options]}"
49+
"#{settings[:gem_install]} #{name}-#{version}.gem #{gem_install_options}"
4950
end
5051
end
5152

configs/components/rubygem-ffi.rb

+6-5
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@
7272
# gem *always* uses the libffi.so we already built. Note the term "system" is
7373
# misleading, because we override PKG_CONFIG_PATH below so that our libffi.so
7474
# is preferred, not the one in /usr/lib.
75-
settings[:gem_install_options] = if rb_major_minor_version > 2.7
76-
"-- --enable-system-libffi"
77-
else
78-
"-- --disable-system-libffi"
79-
end
75+
settings["#{pkg.get_name}_gem_install_options".to_sym] =
76+
if rb_major_minor_version > 2.7
77+
"-- --enable-system-libffi"
78+
else
79+
"-- --disable-system-libffi"
80+
end
8081
instance_eval File.read('configs/components/_base-rubygem.rb')
8182
end
8283

configs/components/rubygem-nokogiri.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
component 'rubygem-nokogiri' do |pkg, _settings, _platform|
1+
component 'rubygem-nokogiri' do |pkg, settings, _platform|
22
pkg.version '1.14.2'
33
pkg.sha256sum 'c765a74aac6cf430a710bb0b6038b8ee11f177393cd6ae8dadc7a44a6e2658b6'
44

5-
settings[:gem_install_options] = "--platform=ruby -- \
5+
settings["#{pkg.get_name}_gem_install_options".to_sym] = "--platform=ruby -- \
66
--use-system-libraries \
77
--with-xml2-lib=#{settings[:libdir]} \
88
--with-xml2-include=#{settings[:includedir]}/libxml2 \

0 commit comments

Comments
 (0)