simp-rake-helpers 5.15.0 → 5.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fc850ad07208e9cca1afe63b9ad29253c8e6dc2310290ad7c168faedd9ad0a7
4
- data.tar.gz: 3bd521f05c66567b3478e675603be5c75a9b8a0ad9561322e43ad725e22f1d15
3
+ metadata.gz: 6547ac015ab43e4ab18898ddddddecf10bc07d1f45fb03b44bd41c86f4cc5ef4
4
+ data.tar.gz: cc0c2474d430410ab54f5ad70620d0465099f322922ebbbdcc8fef46660dcda4
5
5
  SHA512:
6
- metadata.gz: f74eabacff77b22d46a168a1890fc0af3b97910e9aba213f72385e8bc349a0be59316158f14799dfc24d4b949d9c0342678767ce772181a0e1e938723bdad185
7
- data.tar.gz: 61e13e8c60a02fe50481f5d19437e3d1ae9936cb28313d8a9e0a4a74041e243f63891872982b6695fcb26ffa5629237cb2d26b6777f4caba45a158e6d68fe571
6
+ metadata.gz: c60b0c662f9db31c2923efffa06c3ca478194a701ff5bc4be1486086ecc14dc8a058dd3cb92dee596aa5df0e5efbc59f492f676b4a8086a99ff299d688594761
7
+ data.tar.gz: 450a2ba31bc7eac2f6158c629bc6c2f5cde6597ab4b3f42fec63f9c8ba97f96be0cc7ac144d8599ba44d4125da6257f3ad88d7f39a49ade2304d0a7e390befb2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ### 5.17.0 /2022-10-30
2
+ - Added
3
+ - The RPM dependency file can now use `ignores` to remove items instead of
4
+ needing to redefine the entire dependency stack to remove deps
5
+
6
+ ### 5.16.0 / 2022-06-24
7
+ - Added
8
+ - The `puppet-lint-optional_default-check` was added to prevent setting
9
+ `Optional` parameters with default values.
10
+
1
11
  ### 5.15.0 / 2022-06-03
2
12
  - Added
3
13
  - Users now have the ability to set version limits in the `dependencies.yaml`
data/Gemfile CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # SIMP_GEM_SERVERS | a space/comma delimited list of rubygem servers
4
4
  # PUPPET_VERSION | specifies the version of the puppet gem to load
5
- puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : '~> 6'
5
+ puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : '~> 7'
6
6
  gem_sources = ENV.key?('SIMP_GEM_SERVERS') ? ENV['SIMP_GEM_SERVERS'].split(/[, ]+/) : ['https://rubygems.org']
7
7
 
8
8
  gem_sources.each { |gem_source| source gem_source }
@@ -11,7 +11,6 @@ gemspec
11
11
 
12
12
  gem 'simp-build-helpers'
13
13
  gem 'simp-beaker-helpers'
14
- gem 'beaker-puppet_install_helper'
15
14
  gem 'rake', '>= 12.3.3'
16
15
  gem 'beaker-docker'
17
16
 
@@ -104,7 +104,8 @@ module Simp::Rake::Build::RpmDeps
104
104
  # * Requires rpm-name <= 2.0.0
105
105
  # +module_metadata+:: Hash containing the contents of the
106
106
  # module's 'metadata.json' file
107
- def self.generate_custom_rpm_requires(requires_list, module_metadata)
107
+ # +ignores+:: Array of package names to ignore during processing
108
+ def self.generate_custom_rpm_requires(requires_list, module_metadata, ignores=[])
108
109
  rpm_metadata_content = []
109
110
 
110
111
  requires_list.each do |pkg_to_modify|
@@ -114,6 +115,8 @@ module Simp::Rake::Build::RpmDeps
114
115
 
115
116
  pkg, min_version, max_version = pkg if pkg.is_a?(Array)
116
117
 
118
+ next if ignores.include?(pkg)
119
+
117
120
  rpm_version_chars = ['<','>','=']
118
121
 
119
122
  if min_version && rpm_version_chars.none? { |x| min_version.include?(x) }
@@ -140,7 +143,7 @@ module Simp::Rake::Build::RpmDeps
140
143
  end
141
144
 
142
145
  if dep_info.empty?
143
- err_msg = "Could not find #{short_names.first} dependency"
146
+ err_msg = "Could not find '#{short_names.first}' dependency"
144
147
  raise SIMPRpmDepException.new(err_msg)
145
148
  else
146
149
  dep_version = dep_info.first['version_requirement']
@@ -154,7 +157,7 @@ module Simp::Rake::Build::RpmDeps
154
157
  begin
155
158
  rpm_metadata_content << get_version_requires(pkg, dep_version)
156
159
  rescue SIMPRpmDepVersionException
157
- err_msg = "Unable to parse #{short_names.first} dependency" +
160
+ err_msg = "Unable to parse '#{short_names.first}' dependency" +
158
161
  " version '#{dep_version}'"
159
162
  raise SIMPRpmDepException.new(err_msg)
160
163
  end
@@ -174,15 +177,19 @@ module Simp::Rake::Build::RpmDeps
174
177
  # is a Hash containing the version info. For example,
175
178
  # [ 'package1' => { :min => '1.0.0' },
176
179
  # 'package2' => { :min => '3.1-1', :max => '4.0' } ]
177
- def self.generate_external_rpm_requires(ext_deps_list)
180
+ # +ignores+:: Array of package names to ignore during processing
181
+ def self.generate_external_rpm_requires(ext_deps_list, ignores=[])
178
182
  requires = []
179
183
 
180
184
  ext_deps_list.each do |pkg_name, options|
185
+ next if ignores.include?(pkg_name)
186
+
181
187
  requires << "Requires: #{pkg_name} >= #{options[:min]}"
182
188
  if options[:max]
183
189
  requires << "Requires: #{pkg_name} < #{options[:max]}"
184
190
  end
185
191
  end
192
+
186
193
  requires
187
194
  end
188
195
 
@@ -197,7 +204,8 @@ module Simp::Rake::Build::RpmDeps
197
204
  #
198
205
  # +module_metadata+:: Hash containing the contents of the
199
206
  # module's 'metadata.json' file
200
- def self.generate_module_rpm_requires(module_metadata)
207
+ # +ignores+:: Array of package names to ignore during processing
208
+ def self.generate_module_rpm_requires(module_metadata, ignores=[])
201
209
  rpm_metadata_content = []
202
210
 
203
211
  deps = []
@@ -214,12 +222,15 @@ module Simp::Rake::Build::RpmDeps
214
222
  deps.sort! { |x,y| x['name'] <=> y['name'] }
215
223
  deps.each do |dep|
216
224
  pkg = "pupmod-#{dep['name'].gsub('/', '-')}"
225
+
226
+ next if ignores.include?(pkg)
227
+
217
228
  dep_version = dep['version_requirement']
218
229
 
219
230
  begin
220
231
  rpm_metadata_content << get_version_requires(pkg, dep_version)
221
232
  rescue SIMPRpmDepVersionException
222
- err_msg = "Unable to parse #{dep['name']} dependency" +
233
+ err_msg = "Unable to parse '#{dep['name']}' dependency" +
223
234
  " version '#{dep_version}'"
224
235
  raise SIMPRpmDepException.new(err_msg)
225
236
  end
@@ -252,6 +263,10 @@ module Simp::Rake::Build::RpmDeps
252
263
  # dependencies are pulled from module_metadata.
253
264
  # * 'Requires' line(s) for any external dependencies specified
254
265
  # in the module_rpm_meta hash.
266
+ # * Any items matching the name in an 'ignores' array will be removed from the
267
+ # dependency list.
268
+ # * This will be an *exact* match, globbing and regexes are not supported
269
+ # * Does not affect Obsoletes statements
255
270
  #
256
271
  # Otherwise, the generated 'requires' file will contain "Requires"
257
272
  # lines for each dependency and each SIMP optional dependency
@@ -269,18 +284,31 @@ module Simp::Rake::Build::RpmDeps
269
284
  # 'dependencies.yaml' file or nil, if no entry exists
270
285
  def self.generate_rpm_requires_file(dir, module_metadata, module_rpm_meta)
271
286
  rpm_metadata_content = []
287
+
288
+ ignores = module_rpm_meta ? Array(module_rpm_meta[:ignores]) : []
289
+
272
290
  if module_rpm_meta and module_rpm_meta[:obsoletes]
273
- rpm_metadata_content = generate_custom_rpm_obsoletes(module_rpm_meta[:obsoletes], module_metadata)
291
+ rpm_metadata_content = generate_custom_rpm_obsoletes(
292
+ module_rpm_meta[:obsoletes],
293
+ module_metadata
294
+ )
274
295
  end
275
296
 
276
297
  if module_rpm_meta and module_rpm_meta[:requires]
277
- rpm_metadata_content += generate_custom_rpm_requires(module_rpm_meta[:requires], module_metadata)
298
+ rpm_metadata_content += generate_custom_rpm_requires(
299
+ module_rpm_meta[:requires],
300
+ module_metadata,
301
+ ignores
302
+ )
278
303
  else
279
- rpm_metadata_content += generate_module_rpm_requires(module_metadata)
304
+ rpm_metadata_content += generate_module_rpm_requires(module_metadata, ignores)
280
305
  end
281
306
 
282
307
  if module_rpm_meta and module_rpm_meta[:external_dependencies]
283
- rpm_metadata_content += generate_external_rpm_requires(module_rpm_meta[:external_dependencies])
308
+ rpm_metadata_content += generate_external_rpm_requires(
309
+ module_rpm_meta[:external_dependencies],
310
+ ignores
311
+ )
284
312
  end
285
313
 
286
314
  rpm_metadata_file = File.join(dir, 'build', 'rpm_metadata', 'requires')
@@ -2,5 +2,5 @@ module Simp; end
2
2
  module Simp::Rake; end
3
3
 
4
4
  class Simp::Rake::Helpers
5
- VERSION = '5.15.0'
5
+ VERSION = '5.17.0'
6
6
  end
@@ -56,7 +56,7 @@ class Simp::Rake::Pupmod::Helpers < ::Rake::TaskLib
56
56
  begin
57
57
  require 'puppet_blacksmith/rake_tasks'
58
58
  Blacksmith::RakeTask.new do |t|
59
- t.tag_pattern = "%s" # Use tage format "X.Y.Z" instead of "vX.Y.Z"
59
+ t.tag_pattern = "%s" # Use tag format "X.Y.Z" instead of "vX.Y.Z"
60
60
  end
61
61
  rescue LoadError
62
62
  end
@@ -20,7 +20,10 @@
20
20
  # does NOT include puppetlabs/apt
21
21
  - 'pupmod-puppetlabs-stdlib'
22
22
  - 'pupmod-ceritsc-yum'
23
+ - 'i-should-not-exist'
23
24
  - ['pupmod-richardc-datacat', '1.2.3', '<=3.4.5']
25
+ :ignores:
26
+ - 'i-should-not-exist'
24
27
  :release: '2017.0'
25
28
  :external_dependencies:
26
29
  'rubygem-puppetserver-toml':
@@ -194,7 +194,7 @@ EOM
194
194
  context 'dependency from dependencies.yaml not found in metadata.json' do
195
195
  it 'should fail when dep in depedencies.yaml is not found in metadata.json' do
196
196
  mod_dir = File.join(@tmp_dir, 'files', 'unknown_dep_mod')
197
- err_msg = "Could not find oops/unknown dependency in #{mod_dir}/metadata.json"
197
+ err_msg = "Could not find 'oops/unknown' dependency in #{mod_dir}/metadata.json"
198
198
  expect {
199
199
  Simp::Rake::Build::RpmDeps::generate_rpm_meta_files(mod_dir, rpm_metadata)
200
200
  }.to raise_error(err_msg)
@@ -204,7 +204,7 @@ EOM
204
204
  context 'malformed dependency version' do
205
205
  it 'should fail for managed component with invalid dep version in metadata.json' do
206
206
  mod_dir = File.join(@tmp_dir, 'files', 'malformed_dep_meta_mod')
207
- err_msg = "Unable to parse foo1/bar1 dependency version '1.0.0.1' in #{mod_dir}/metadata.json"
207
+ err_msg = "Unable to parse 'foo1/bar1' dependency version '1.0.0.1' in #{mod_dir}/metadata.json"
208
208
  expect {
209
209
  Simp::Rake::Build::RpmDeps::generate_rpm_meta_files(mod_dir, rpm_metadata)
210
210
  }.to raise_error(err_msg)
@@ -214,7 +214,7 @@ EOM
214
214
  rpm_meta = rpm_metadata.dup
215
215
  rpm_meta ['malformed_dep_meta_mod'] = nil
216
216
  mod_dir = File.join(@tmp_dir, 'files', 'malformed_dep_meta_mod')
217
- err_msg = "Unable to parse foo1/bar1 dependency version '1.0.0.1' in #{mod_dir}/metadata.json"
217
+ err_msg = "Unable to parse 'foo1/bar1' dependency version '1.0.0.1' in #{mod_dir}/metadata.json"
218
218
  expect {
219
219
  Simp::Rake::Build::RpmDeps::generate_rpm_meta_files(mod_dir, rpm_meta)
220
220
  }.to raise_error(err_msg)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simp-rake-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.15.0
4
+ version: 5.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Tessmer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-06-03 00:00:00.000000000 Z
12
+ date: 2022-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: simp-beaker-helpers
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.11'
20
+ version: '1.24'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.11'
27
+ version: '1.24'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -105,20 +105,40 @@ dependencies:
105
105
  - - "<"
106
106
  - !ruby/object:Gem::Version
107
107
  version: '3.0'
108
+ - !ruby/object:Gem::Dependency
109
+ name: puppet-lint-optional_default-check
110
+ requirement: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '1.0'
115
+ - - "<"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '1.0'
125
+ - - "<"
126
+ - !ruby/object:Gem::Version
127
+ version: '2.0'
108
128
  - !ruby/object:Gem::Dependency
109
129
  name: puppetlabs_spec_helper
110
130
  requirement: !ruby/object:Gem::Requirement
111
131
  requirements:
112
132
  - - "~>"
113
133
  - !ruby/object:Gem::Version
114
- version: '2.0'
134
+ version: '4.0'
115
135
  type: :runtime
116
136
  prerelease: false
117
137
  version_requirements: !ruby/object:Gem::Requirement
118
138
  requirements:
119
139
  - - "~>"
120
140
  - !ruby/object:Gem::Version
121
- version: '2.0'
141
+ version: '4.0'
122
142
  - !ruby/object:Gem::Dependency
123
143
  name: parallel
124
144
  requirement: !ruby/object:Gem::Requirement