Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ 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"])
# 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
Expand All @@ -27,7 +31,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
Expand All @@ -41,7 +45,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
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/feature/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 6 additions & 12 deletions lib/puppet/module_tool/tar/mini.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions openvox.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion packaging/setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 3 additions & 3 deletions spec/unit/module_tool/tar/mini_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down
Loading