From a914972c4bf3764d812fd71a6dd48dd83cf7308d Mon Sep 17 00:00:00 2001 From: Nick Burgan <13688219+nmburgan@users.noreply.github.com> Date: Wed, 19 Nov 2025 09:51:49 -0800 Subject: [PATCH 1/3] Loosen some gem dependencies for new versions and update minitar usage This loosens some dependencies so we can use the latest version. This includes minitar, which includes a namespace change, so this make the appropriate changes to use the latest minitar. --- Gemfile | 6 +++--- lib/puppet/feature/base.rb | 2 +- lib/puppet/module_tool/tar/mini.rb | 18 ++++++------------ openvox.gemspec | 8 ++++---- spec/unit/module_tool/tar/mini_spec.rb | 6 +++--- 5 files changed, 17 insertions(+), 23 deletions(-) diff --git a/Gemfile b/Gemfile index d391661cc2..b2712aadb6 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,7 @@ end gem "openfact", *location_for(ENV['OPENFACT_LOCATION'] || ["~> 5.0"]) gem "semantic_puppet", *location_for(ENV['SEMANTIC_PUPPET_LOCATION'] || ["~> 1.0"]) -gem "puppet-resource_api", *location_for(ENV['RESOURCE_API_LOCATION'] || ["~> 1.5"]) +gem "puppet-resource_api", *location_for(ENV['RESOURCE_API_LOCATION'] || ["~> 2.0"]) group(:features) do gem 'diff-lcs', '~> 1.3', require: false @@ -27,7 +27,7 @@ group(:features) do gem 'hocon', '~> 1.0', require: false # requires native libshadow headers/libs #gem 'ruby-shadow', '~> 2.5', require: false, platforms: [:ruby] - gem 'minitar', '~> 0.9', require: false + gem 'minitar', '~> 1.0', require: false gem 'msgpack', '~> 1.2', require: false gem 'rdoc', ['~> 6.0', '< 6.4.0'], require: false, platforms: [:ruby] # requires native augeas headers/libs @@ -41,7 +41,7 @@ end group(:test) do # 1.16.0 - 1.16.2 are broken on Windows - gem 'ffi', '>= 1.15.5', '< 1.17.0', '!= 1.16.0', '!= 1.16.1', '!= 1.16.2', require: false + gem 'ffi', '>= 1.15.5', '< 2', '!= 1.16.0', '!= 1.16.1', '!= 1.16.2', require: false gem "json-schema", '>= 2', '< 6', require: false gem "rake", *location_for(ENV['RAKE_LOCATION'] || '~> 13.0') gem "rspec", "~> 3.1", require: false diff --git a/lib/puppet/feature/base.rb b/lib/puppet/feature/base.rb index 9dbb8d0395..23f5d1b7ce 100644 --- a/lib/puppet/feature/base.rb +++ b/lib/puppet/feature/base.rb @@ -47,7 +47,7 @@ # We have Hiera Puppet.features.add(:hiera, :libs => ["hiera"]) -Puppet.features.add(:minitar, :libs => ["archive/tar/minitar"]) +Puppet.features.add(:minitar, :libs => ["minitar"]) # We can manage symlinks Puppet.features.add(:manages_symlinks) do diff --git a/lib/puppet/module_tool/tar/mini.rb b/lib/puppet/module_tool/tar/mini.rb index 8238bca7a1..c8427cd93a 100644 --- a/lib/puppet/module_tool/tar/mini.rb +++ b/lib/puppet/module_tool/tar/mini.rb @@ -3,17 +3,11 @@ class Puppet::ModuleTool::Tar::Mini def unpack(sourcefile, destdir, _) Zlib::GzipReader.open(sourcefile) do |reader| - # puppet doesn't have a hard dependency on minitar, so we - # can't be certain which version is installed. If it's 0.9 - # or above then we can prevent minitar from fsync'ing each - # extracted file and directory, otherwise fallback to the - # old behavior args = [reader, destdir, find_valid_files(reader)] - spec = Gem::Specification.find_by_name('minitar') - if spec && spec.version >= Gem::Version.new('0.9') - args << { :fsync => false } - end - Archive::Tar::Minitar.unpack(*args) do |action, name, stats| + # With minitar >= 0.9, we can prevent minitar from fsync'ing + # each extracted file and directory + args << { :fsync => false } + Minitar.unpack(*args) do |action, name, stats| case action when :dir validate_entry(destdir, name) @@ -33,7 +27,7 @@ def unpack(sourcefile, destdir, _) def pack(sourcedir, destfile) Zlib::GzipWriter.open(destfile) do |writer| - Archive::Tar::Minitar.pack(sourcedir, writer) do |step, name, stats| + Minitar.pack(sourcedir, writer) do |step, name, stats| # TODO smcclellan 2017-10-31 Set permissions here when this yield block # executes before the header is written. As it stands, the `stats` # argument isn't mutable in a way that will effect the desired mode for @@ -93,7 +87,7 @@ def set_default_user_and_group!(stats) # tar format info: https://pic.dhe.ibm.com/infocenter/zos/v1r13/index.jsp?topic=%2Fcom.ibm.zos.r13.bpxa500%2Ftaf.htm # pax format info: https://pic.dhe.ibm.com/infocenter/zos/v1r13/index.jsp?topic=%2Fcom.ibm.zos.r13.bpxa500%2Fpxarchfm.htm def find_valid_files(tarfile) - Archive::Tar::Minitar.open(tarfile).collect do |entry| + Minitar.open(tarfile).collect do |entry| flag = entry.typeflag if flag.nil? || flag =~ /[[:digit:]]/ && (0..7).cover?(flag.to_i) entry.full_name diff --git a/openvox.gemspec b/openvox.gemspec index db82ca8eb6..18451163b7 100644 --- a/openvox.gemspec +++ b/openvox.gemspec @@ -39,19 +39,19 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency('multi_json', '~> 1.13') spec.add_runtime_dependency('openfact', '~> 5.0') spec.add_runtime_dependency('ostruct', '~> 0.6.0') - spec.add_runtime_dependency('puppet-resource_api', '~> 1.5') + spec.add_runtime_dependency('puppet-resource_api', '~> 2.0') spec.add_runtime_dependency('racc', '~> 1.5') spec.add_runtime_dependency('scanf', '~> 1.0') spec.add_runtime_dependency('semantic_puppet', '~> 1.0') platform = spec.platform.to_s if platform == 'universal-darwin' - spec.add_runtime_dependency('CFPropertyList', ['>= 3.0.6', '< 4']) + spec.add_runtime_dependency('CFPropertyList', ['>= 3.0.6', '< 5']) end if platform == 'x64-mingw32' || platform == 'x86-mingw32' # ffi 1.16.0 - 1.16.2 are broken on Windows - spec.add_runtime_dependency('ffi', '>= 1.15.5', '< 1.17.0', '!= 1.16.0', '!= 1.16.1', '!= 1.16.2') - spec.add_runtime_dependency('minitar', '~> 0.9') + spec.add_runtime_dependency('ffi', '>= 1.15.5', '< 2', '!= 1.16.0', '!= 1.16.1', '!= 1.16.2') + spec.add_runtime_dependency('minitar', '~> 1.0') end end diff --git a/spec/unit/module_tool/tar/mini_spec.rb b/spec/unit/module_tool/tar/mini_spec.rb index 807f3d495c..2a2a00f910 100644 --- a/spec/unit/module_tool/tar/mini_spec.rb +++ b/spec/unit/module_tool/tar/mini_spec.rb @@ -61,7 +61,7 @@ def initialize(mode = 0100) expect(Zlib::GzipWriter).to receive(:open).with(destfile).and_yield(writer) stats = {:mode => 0222} - expect(Archive::Tar::Minitar).to receive(:pack).with(sourcedir, writer).and_yield(:file_start, 'abc', stats) + expect(Minitar).to receive(:pack).with(sourcedir, writer).and_yield(:file_start, 'abc', stats) minitar.pack(sourcedir, destfile) end @@ -70,7 +70,7 @@ def initialize(mode = 0100) writer = double('GzipWriter') expect(Zlib::GzipWriter).to receive(:open).with(destfile).and_yield(writer) - expect(Archive::Tar::Minitar).to receive(:pack).with(sourcedir, writer). + expect(Minitar).to receive(:pack).with(sourcedir, writer). and_yield(:file_start, 'abc', {:entry => MockFileStatEntry.new(nil)}) minitar.pack(sourcedir, destfile) @@ -82,7 +82,7 @@ def unpacks_the_entry(type, name, mode = 0100) expect(Zlib::GzipReader).to receive(:open).with(sourcefile).and_yield(reader) expect(minitar).to receive(:find_valid_files).with(reader).and_return([name]) entry = MockFileStatEntry.new(mode) - expect(Archive::Tar::Minitar).to receive(:unpack).with(reader, destdir, [name], {:fsync => false}). + expect(Minitar).to receive(:unpack).with(reader, destdir, [name], {:fsync => false}). and_yield(type, name, {:entry => entry}) entry end From e35e1e6d355f97f656a2286e20021c6418b11640 Mon Sep 17 00:00:00 2001 From: nmburgan <13688219+nmburgan@users.noreply.github.com> Date: Wed, 19 Nov 2025 17:33:11 -0800 Subject: [PATCH 2/3] Add openssl gem --- Gemfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index b2712aadb6..d61547d565 100644 --- a/Gemfile +++ b/Gemfile @@ -19,6 +19,10 @@ end gem "openfact", *location_for(ENV['OPENFACT_LOCATION'] || ["~> 5.0"]) gem "semantic_puppet", *location_for(ENV['SEMANTIC_PUPPET_LOCATION'] || ["~> 1.0"]) gem "puppet-resource_api", *location_for(ENV['RESOURCE_API_LOCATION'] || ["~> 2.0"]) +# Need to update the openssl gem on MacOS to avoid SSL errors. Doesn't hurt to have the newest +# for all platforms. +# https://www.rubyonmac.dev/certificate-verify-failed-unable-to-get-certificate-crl-openssl-ssl-sslerror +gem 'openssl' unless `uname -o`.chomp == 'Cygwin' group(:features) do gem 'diff-lcs', '~> 1.3', require: false From 5d95cdf569d85edaffc2855a47f00b06151e1fa8 Mon Sep 17 00:00:00 2001 From: nmburgan <13688219+nmburgan@users.noreply.github.com> Date: Wed, 19 Nov 2025 17:38:30 -0800 Subject: [PATCH 3/3] Pin Ruby to 3.2.2 for Windows This is only for the bundle, not for the actual build. This is the only 3.2 version available on Cygwin, and using 3.4 breaks some things. --- packaging/setup.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/setup.ps1 b/packaging/setup.ps1 index 43fdf08ce8..336ef9fe0c 100644 --- a/packaging/setup.ps1 +++ b/packaging/setup.ps1 @@ -6,4 +6,4 @@ cmd /c "C:\wix314.exe -quiet" $url="https://cygwin.com/setup-x86_64.exe" $dest="C:\setup-x86_64.exe" Invoke-WebRequest -Uri $url -OutFile $dest -cmd /c "C:\setup-x86_64.exe -s https://cygwin.osuosl.org -q -P ruby,ruby-devel,gcc-core,make,git,libyaml-devel" +cmd /c "C:\setup-x86_64.exe -s https://cygwin.osuosl.org -q -P ruby=3.2.2-2,ruby-devel=3.2.2-2,gcc-core,make,git,libyaml-devel"