@@ -28,12 +28,11 @@ group :development do
2828 gem "fast_gettext" , require : false if Gem ::Version . new ( RUBY_VERSION . dup ) >= Gem ::Version . new ( '2.1.0' )
2929 gem "json_pure" , '<= 2.0.1' , require : false if Gem ::Version . new ( RUBY_VERSION . dup ) < Gem ::Version . new ( '2.0.0' )
3030 gem "json" , '= 1.8.1' , require : false if Gem ::Version . new ( RUBY_VERSION . dup ) == Gem ::Version . new ( '2.1.9' )
31- gem "json" , '<= 2.0.4' , require : false if Gem ::Version . new ( RUBY_VERSION . dup ) == Gem ::Version . new ( '2.4.4' )
3231 gem "puppet-module-posix-default-r#{ minor_version } " , require : false , platforms : [ :ruby ]
3332 gem "puppet-module-posix-dev-r#{ minor_version } " , require : false , platforms : [ :ruby ]
3433 gem "puppet-module-win-default-r#{ minor_version } " , require : false , platforms : [ :mswin , :mingw , :x64_mingw ]
3534 gem "puppet-module-win-dev-r#{ minor_version } " , require : false , platforms : [ :mswin , :mingw , :x64_mingw ]
36- gem "puppet-blacksmith" , '~> 3.4' , require : false , platforms : [ :ruby ]
35+ gem "puppet-blacksmith" , '~> 3.4' , require : false
3736end
3837group :system_tests do
3938 gem "puppet-module-posix-system-r#{ minor_version } " , require : false , platforms : [ :ruby ]
@@ -50,24 +49,73 @@ puppet_type = gem_type(puppet_version)
5049facter_version = ENV [ 'FACTER_GEM_VERSION' ]
5150hiera_version = ENV [ 'HIERA_GEM_VERSION' ]
5251
52+ def puppet_older_than? ( version )
53+ puppet_version = ENV [ 'PUPPET_GEM_VERSION' ]
54+ !puppet_version . nil? &&
55+ Gem ::Version . correct? ( puppet_version ) &&
56+ Gem ::Requirement . new ( "< #{ version } " ) . satisfied_by? ( Gem ::Version . new ( puppet_version . dup ) )
57+ end
58+
5359gems = { }
5460
5561gems [ 'puppet' ] = location_for ( puppet_version )
5662
5763# If facter or hiera versions have been specified via the environment
58- # variables
64+ # variables, use those versions. If not, and if the puppet version is < 3.5.0,
65+ # use known good versions of both for puppet < 3.5.0.
66+ if facter_version
67+ gems [ 'facter' ] = location_for ( facter_version )
68+ elsif puppet_type == :gem && puppet_older_than? ( '3.5.0' )
69+ gems [ 'facter' ] = [ '>= 1.6.11' , '<= 1.7.5' , require : false ]
70+ end
71+
72+ if hiera_version
73+ gems [ 'hiera' ] = location_for ( ENV [ 'HIERA_GEM_VERSION' ] )
74+ elsif puppet_type == :gem && puppet_older_than? ( '3.5.0' )
75+ gems [ 'hiera' ] = [ '>= 1.0.0' , '<= 1.3.0' , require : false ]
76+ end
5977
60- gems [ 'facter' ] = location_for ( facter_version ) if facter_version
61- gems [ 'hiera' ] = location_for ( hiera_version ) if hiera_version
78+ if Gem . win_platform? && ( puppet_type != :gem || puppet_older_than? ( '3.5.0' ) )
79+ # For Puppet gems < 3.5.0 (tested as far back as 3.0.0) on Windows
80+ if puppet_type == :gem
81+ gems [ 'ffi' ] = [ '1.9.0' , require : false ]
82+ gems [ 'minitar' ] = [ '0.5.4' , require : false ]
83+ gems [ 'win32-eventlog' ] = [ '0.5.3' , '<= 0.6.5' , require : false ]
84+ gems [ 'win32-process' ] = [ '0.6.5' , '<= 0.7.5' , require : false ]
85+ gems [ 'win32-security' ] = [ '~> 0.1.2' , '<= 0.2.5' , require : false ]
86+ gems [ 'win32-service' ] = [ '0.7.2' , '<= 0.8.8' , require : false ]
87+ else
88+ gems [ 'ffi' ] = [ '~> 1.9.0' , require : false ]
89+ gems [ 'minitar' ] = [ '~> 0.5.4' , require : false ]
90+ gems [ 'win32-eventlog' ] = [ '~> 0.5' , '<= 0.6.5' , require : false ]
91+ gems [ 'win32-process' ] = [ '~> 0.6' , '<= 0.7.5' , require : false ]
92+ gems [ 'win32-security' ] = [ '~> 0.1' , '<= 0.2.5' , require : false ]
93+ gems [ 'win32-service' ] = [ '~> 0.7' , '<= 0.8.8' , require : false ]
94+ end
95+
96+ gems [ 'win32-dir' ] = [ '~> 0.3' , '<= 0.4.9' , require : false ]
97+
98+ if RUBY_VERSION . start_with? ( '1.' )
99+ gems [ 'win32console' ] = [ '1.3.2' , require : false ]
100+ # sys-admin was removed in Puppet 3.7.0 and doesn't compile under Ruby 2.x
101+ gems [ 'sys-admin' ] = [ '1.5.6' , require : false ]
102+ end
62103
63- if Gem . win_platform? && puppet_version =~ %r{^(file:///|git://)}
104+ # Puppet < 3.7.0 requires these.
105+ # Puppet >= 3.5.0 gem includes these as requirements.
106+ # The following versions are tested to work with 3.0.0 <= puppet < 3.7.0.
107+ gems [ 'win32-api' ] = [ '1.4.8' , require : false ]
108+ gems [ 'win32-taskscheduler' ] = [ '0.2.2' , require : false ]
109+ gems [ 'windows-api' ] = [ '0.4.3' , require : false ]
110+ gems [ 'windows-pr' ] = [ '1.2.3' , require : false ]
111+ elsif Gem . win_platform?
64112 # If we're using a Puppet gem on Windows which handles its own win32-xxx gem
65113 # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445).
66114 gems [ 'win32-dir' ] = [ '<= 0.4.9' , require : false ]
67115 gems [ 'win32-eventlog' ] = [ '<= 0.6.5' , require : false ]
68116 gems [ 'win32-process' ] = [ '<= 0.7.5' , require : false ]
69117 gems [ 'win32-security' ] = [ '<= 0.2.5' , require : false ]
70- gems [ 'win32-service' ] = [ '0.8.8' , require : false ]
118+ gems [ 'win32-service' ] = [ '<= 0.8.8' , require : false ]
71119end
72120
73121gems . each do |gem_name , gem_params |
0 commit comments