simp-rake-helpers 5.16.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: 37092929f65e40c37650e9d14f8355dc1fddafd1355e05a08ac26ac033f3bb30
4
- data.tar.gz: 7dde697dd869d589a28b58e8503f7e69fbab85a33acdeb2d3213122b257fd4f1
3
+ metadata.gz: 6547ac015ab43e4ab18898ddddddecf10bc07d1f45fb03b44bd41c86f4cc5ef4
4
+ data.tar.gz: cc0c2474d430410ab54f5ad70620d0465099f322922ebbbdcc8fef46660dcda4
5
5
  SHA512:
6
- metadata.gz: a314be69fcde5bb3661abdccce49623d6a1fa93065bf32ac6e44a1db22cf5547808284cde80093cdbfd8d90e0b97e13f9b3489dbe62502ff3d9471fe55d24502
7
- data.tar.gz: 93658197582ab5a656751f5c1ddffcf971c204ce89478d4b3f8df753f792fe479653369213df4c00a053376035eb1582caeca21322bcd8df1a0c5e91ea7d7235
6
+ metadata.gz: c60b0c662f9db31c2923efffa06c3ca478194a701ff5bc4be1486086ecc14dc8a058dd3cb92dee596aa5df0e5efbc59f492f676b4a8086a99ff299d688594761
7
+ data.tar.gz: 450a2ba31bc7eac2f6158c629bc6c2f5cde6597ab4b3f42fec63f9c8ba97f96be0cc7ac144d8599ba44d4125da6257f3ad88d7f39a49ade2304d0a7e390befb2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
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
+
1
6
  ### 5.16.0 / 2022-06-24
2
7
  - Added
3
8
  - The `puppet-lint-optional_default-check` was added to prevent setting
@@ -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.16.0'
5
+ VERSION = '5.17.0'
6
6
  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.16.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-29 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