From 433e8114e16c236aa9210141e017f51c8e8cbbdd Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 8 May 2024 12:03:34 -0700 Subject: [PATCH] (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`. --- configs/components/_base-rubygem.rb | 5 +++-- configs/components/rubygem-ffi.rb | 11 ++++++----- configs/components/rubygem-nokogiri.rb | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/configs/components/_base-rubygem.rb b/configs/components/_base-rubygem.rb index 90f399555..a5614b81b 100644 --- a/configs/components/_base-rubygem.rb +++ b/configs/components/_base-rubygem.rb @@ -39,13 +39,14 @@ # If a gem needs more command line options to install set the :gem_install_options # in its component file rubygem-, before the instance_eval of this file. -if settings[:gem_install_options].nil? +gem_install_options = settings["#{pkg.get_name}_gem_install_options".to_sym] +if gem_install_options.nil? pkg.install do "#{settings[:gem_install]} #{name}-#{version}.gem" end else pkg.install do - "#{settings[:gem_install]} #{name}-#{version}.gem #{settings[:gem_install_options]}" + "#{settings[:gem_install]} #{name}-#{version}.gem #{gem_install_options}" end end diff --git a/configs/components/rubygem-ffi.rb b/configs/components/rubygem-ffi.rb index 5af3e8864..f4c73444e 100644 --- a/configs/components/rubygem-ffi.rb +++ b/configs/components/rubygem-ffi.rb @@ -72,11 +72,12 @@ # gem *always* uses the libffi.so we already built. Note the term "system" is # misleading, because we override PKG_CONFIG_PATH below so that our libffi.so # is preferred, not the one in /usr/lib. - settings[:gem_install_options] = if rb_major_minor_version > 2.7 - "-- --enable-system-libffi" - else - "-- --disable-system-libffi" - end + settings["#{pkg.get_name}_gem_install_options".to_sym] = + if rb_major_minor_version > 2.7 + "-- --enable-system-libffi" + else + "-- --disable-system-libffi" + end instance_eval File.read('configs/components/_base-rubygem.rb') end diff --git a/configs/components/rubygem-nokogiri.rb b/configs/components/rubygem-nokogiri.rb index eca304201..79fd58038 100644 --- a/configs/components/rubygem-nokogiri.rb +++ b/configs/components/rubygem-nokogiri.rb @@ -1,8 +1,8 @@ -component 'rubygem-nokogiri' do |pkg, _settings, _platform| +component 'rubygem-nokogiri' do |pkg, settings, _platform| pkg.version '1.14.2' pkg.sha256sum 'c765a74aac6cf430a710bb0b6038b8ee11f177393cd6ae8dadc7a44a6e2658b6' - settings[:gem_install_options] = "--platform=ruby -- \ + settings["#{pkg.get_name}_gem_install_options".to_sym] = "--platform=ruby -- \ --use-system-libraries \ --with-xml2-lib=#{settings[:libdir]} \ --with-xml2-include=#{settings[:includedir]}/libxml2 \