simp-rake-helpers 5.10.2 → 5.11.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: 79ad7ad7188d33672087722a247a56a145315e941ffa7e44fc26b7a847ef91f5
4
- data.tar.gz: 05ff2357f2615369f5e24f84be1aff9d7bb16d535c8b77f2126fdd2a7b2adced
3
+ metadata.gz: a8df4b35e000bb36b26db550e81337f96b2fa1dfa99646dc4d7fcbfe76e2ecdf
4
+ data.tar.gz: d3f6ea0a5ef4d1ac277b6447615305a118184c0e59f79d860ae9acc34439bf70
5
5
  SHA512:
6
- metadata.gz: 0fe5a161b357ef4777f58c28397a39622d061750a20c129effc80d4c61f2678f6846ccb710ee170ab4375290498e9cfcad500451c2f24233a1b172c49ec59daf
7
- data.tar.gz: 75c69637690c41f54545f7b977893b8b7b28ca038b2160f2a2a843b3caa2a26a81e10c0861104a75fd9c95ba8db962856e2a51119926b2bb946c74bf6877319d
6
+ metadata.gz: db7c733f928206a27e60a984b5b1b9bcb4fae865adbb57818803ff9f9738eefe976372ce5a14fab45be2cb836906798e33074068f4654b71b6733b2b85714fb8
7
+ data.tar.gz: 90408311e53eefc6b4d9714e63c39c325b66c7a5c1dd720b540014d59d00c067413a16f1940359d769feaa37d22705a13c06ab2540b7780b092f9142279b9d83
@@ -1,3 +1,6 @@
1
+ ### 5.11.0 / 2020-03-16
2
+ * Add SIMP optional dependencies to RPM requires list
3
+
1
4
  ### 5.10.2 / 2020-02-10
2
5
  * Allow v3 of simp-rspec-puppet-facts
3
6
  * Fix '~> 0' notation
@@ -103,6 +103,13 @@ module Simp::Rake::Build::RpmDeps
103
103
  short_names.include?(dep['name'])
104
104
  }
105
105
 
106
+ if dep_info.empty? && module_metadata['simp'] &&
107
+ module_metadata['simp']['optional_dependencies']
108
+ dep_info = module_metadata['simp']['optional_dependencies'].select{ |dep|
109
+ short_names.include?(dep['name'])
110
+ }
111
+ end
112
+
106
113
  if dep_info.empty?
107
114
  err_msg = "Could not find #{short_names.first} dependency"
108
115
  raise SIMPRpmDepException.new(err_msg)
@@ -145,7 +152,7 @@ module Simp::Rake::Build::RpmDeps
145
152
  end
146
153
 
147
154
  # Generate 'Requires' lines from each dependency specified in the
148
- # module_metadata hash
155
+ # module_metadata hash, including SIMP optional dependencies
149
156
  #
150
157
  # returns array of strings, each of which is a 'Requires' line for
151
158
  # use in an RPM spec file
@@ -157,20 +164,29 @@ module Simp::Rake::Build::RpmDeps
157
164
  # module's 'metadata.json' file
158
165
  def self.generate_module_rpm_requires(module_metadata)
159
166
  rpm_metadata_content = []
160
- # metadata.json should always contain dependencies list, even
161
- # if it is empty, but we'll safely handle that error case here
167
+
168
+ deps = []
162
169
  if module_metadata['dependencies']
163
- module_metadata['dependencies'].each do |dep|
164
- pkg = "pupmod-#{dep['name'].gsub('/', '-')}"
165
- dep_version = dep['version_requirement']
166
-
167
- begin
168
- rpm_metadata_content << get_version_requires(pkg, dep_version)
169
- rescue SIMPRpmDepVersionException
170
- err_msg = "Unable to parse #{dep['name']} dependency" +
171
- " version '#{dep_version}'"
172
- raise SIMPRpmDepException.new(err_msg)
173
- end
170
+ deps += module_metadata['dependencies']
171
+ end
172
+
173
+ if module_metadata['simp'] &&
174
+ module_metadata['simp']['optional_dependencies']
175
+
176
+ deps += module_metadata['simp']['optional_dependencies']
177
+ end
178
+
179
+ deps.sort! { |x,y| x['name'] <=> y['name'] }
180
+ deps.each do |dep|
181
+ pkg = "pupmod-#{dep['name'].gsub('/', '-')}"
182
+ dep_version = dep['version_requirement']
183
+
184
+ begin
185
+ rpm_metadata_content << get_version_requires(pkg, dep_version)
186
+ rescue SIMPRpmDepVersionException
187
+ err_msg = "Unable to parse #{dep['name']} dependency" +
188
+ " version '#{dep_version}'"
189
+ raise SIMPRpmDepException.new(err_msg)
174
190
  end
175
191
  end
176
192
 
@@ -202,8 +218,9 @@ module Simp::Rake::Build::RpmDeps
202
218
  # * 'Requires' line(s) for any external dependencies specified
203
219
  # in the module_rpm_meta hash.
204
220
  #
205
- # Otherwise, the generated 'requires' file will contain
206
- # "Requires" lines for each dependency specified module_metadata.
221
+ # Otherwise, the generated 'requires' file will contain "Requires"
222
+ # lines for each dependency and each SIMP optional dependency
223
+ # specified in module_metadata.
207
224
  #
208
225
  # raises SIMPRpmDepException if any 'metadata.json' dependency
209
226
  # version string from module_metadata cannot be parsed or a
@@ -2,5 +2,5 @@ module Simp; end
2
2
  module Simp::Rake; end
3
3
 
4
4
  class Simp::Rake::Helpers
5
- VERSION = '5.10.2'
5
+ VERSION = '5.11.0'
6
6
  end
@@ -24,16 +24,20 @@
24
24
  {
25
25
  "name": "foo4/bar4",
26
26
  "version_requirement": ">= 4.0.0 < 5.0.0"
27
- },
28
- {
29
- "name": "foo5/bar5",
30
- "version_requirement": "5.x"
31
- },
32
- {
33
- "name": "foo6/bar6",
34
- "version_requirement": "6.4.x"
35
27
  }
36
28
  ],
29
+ "simp": {
30
+ "optional_dependencies": [
31
+ {
32
+ "name": "foo5/bar5",
33
+ "version_requirement": "5.x"
34
+ },
35
+ {
36
+ "name": "foo6/bar6",
37
+ "version_requirement": "6.4.x"
38
+ }
39
+ ]
40
+ },
37
41
  "operatingsystem_support": [
38
42
  {
39
43
  "operatingsystem": "RedHat",
@@ -12,19 +12,23 @@
12
12
  "name": "puppetlabs/inifile",
13
13
  "version_requirement": ">= 1.6.0 < 2.0.0"
14
14
  },
15
- {
16
- "name": "puppetlabs/puppetdb",
17
- "version_requirement": ">= 5.1.2 < 6.0.0"
18
- },
19
- {
20
- "name": "puppetlabs/postgresql",
21
- "version_requirement": ">= 4.8.0 < 5.0.0"
22
- },
23
15
  {
24
16
  "name": "puppetlabs/stdlib",
25
17
  "version_requirement": ">= 4.13.1 < 5.0.0"
26
18
  }
27
19
  ],
20
+ "simp": {
21
+ "optional_dependencies": [
22
+ {
23
+ "name": "puppetlabs/puppetdb",
24
+ "version_requirement": ">= 5.1.2 < 6.0.0"
25
+ },
26
+ {
27
+ "name": "puppetlabs/postgresql",
28
+ "version_requirement": ">= 4.8.0 < 5.0.0"
29
+ }
30
+ ]
31
+ },
28
32
  "requirements": [
29
33
  {
30
34
  "name": "puppet",
@@ -40,6 +40,14 @@ describe 'Simp::Rake::Build::RpmDeps#get_version_requires' do
40
40
  end
41
41
  end
42
42
 
43
+ # In the tests below, a 'managed' component is one with an entry in the
44
+ # simp-core/build/rpm/dependencies.yaml. It is a module, whose RPM
45
+ # dependencies, obsoletes, and/or release qualifier need to be managed.
46
+ #
47
+ # An 'unmanaged' component is a module that has no special packaging needs.
48
+ # It has no obsoletes, can use the default release qualifier of 0, and needs
49
+ # no adjustments to the dependencies it advertises in its metadata.json file.
50
+ #
43
51
  describe 'Simp::Rake::Build::RpmDeps#generate_rpm_meta_files' do
44
52
  let(:files_dir) { File.join(File.dirname(__FILE__), 'files') }
45
53
  let(:rpm_metadata) {
@@ -143,10 +151,10 @@ EOM
143
151
  expected = <<EOM
144
152
  Requires: pupmod-puppetlabs-inifile >= 1.6.0
145
153
  Requires: pupmod-puppetlabs-inifile < 2.0.0
146
- Requires: pupmod-puppetlabs-puppetdb >= 5.1.2
147
- Requires: pupmod-puppetlabs-puppetdb < 6.0.0
148
154
  Requires: pupmod-puppetlabs-postgresql >= 4.8.0
149
155
  Requires: pupmod-puppetlabs-postgresql < 5.0.0
156
+ Requires: pupmod-puppetlabs-puppetdb >= 5.1.2
157
+ Requires: pupmod-puppetlabs-puppetdb < 6.0.0
150
158
  Requires: pupmod-puppetlabs-stdlib >= 4.13.1
151
159
  Requires: pupmod-puppetlabs-stdlib < 5.0.0
152
160
  EOM
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.10.2
4
+ version: 5.11.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: 2020-02-11 00:00:00.000000000 Z
12
+ date: 2020-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: simp-beaker-helpers