vanagon 0.15.18 → 0.15.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98826d92d0eb55918c4a5db6ef30e6216785cb567560ecf34e0254e72ae45336
4
- data.tar.gz: aec8e9bd65afafc3dd1b83bb5045e9159357d0d5c7c18037217bb61ac71730af
3
+ metadata.gz: b71ba52fd3a026248d25a3a10a0570960d552585a8cc3e114c2bb366583c2bbb
4
+ data.tar.gz: 726ddf77c6137b9f09adf974dd981eae1f654f063a32f56181c1ca630f3fd04b
5
5
  SHA512:
6
- metadata.gz: 8b52b708b61e3361fb37e085f11e5dcb4ce2426fac0ce1435b21a8872fba3772df72c1146c74cafe6f1bbb89bf92f6aafd1d3f71c2a4926e7d77a8762dc4a5e1
7
- data.tar.gz: 318ec2188ac994dd0c1086fd736d25a6d3dc3474111d7b33127e8fba43bb87e5f0bc6e88cec6cd1d63f6179dd9a8197a87e7362e9d27961d396fcb076ae70cd9
6
+ metadata.gz: 4afb19e20c1e81500c9ed9cde575ed93679dd2fca0407d86a9b67aa4bf0cbcadb65b3a74d0dc9e9439a5686e285792c571b6e2fa1faecb1a646409edbc527b48
7
+ data.tar.gz: 53b39a73763a1c30cde5cd75ff17356ace19390518cd4bb9d490a00316d72d91d7ecea9565ebf50c36f0cd48ebbc61c6e645922d0574e4b77b9c6d6bddd12fd2
@@ -6,6 +6,9 @@ require 'vanagon/utilities'
6
6
  require 'digest'
7
7
  require 'ostruct'
8
8
 
9
+ # Used to parse the vendor field into name and email
10
+ VENDOR_REGEX = /^(.*) <(.*)>$/
11
+
9
12
  class Vanagon
10
13
  class Project
11
14
  include Vanagon::Utilities
@@ -17,7 +20,7 @@ class Vanagon
17
20
  attr_accessor :release
18
21
  attr_accessor :license
19
22
  attr_accessor :homepage
20
- attr_accessor :vendor
23
+ attr_reader :vendor
21
24
  attr_accessor :description
22
25
  attr_accessor :components
23
26
  attr_accessor :conflicts
@@ -177,6 +180,31 @@ class Vanagon
177
180
  environment.merge(@platform.environment)
178
181
  end
179
182
 
183
+ # Setter for the vendor field.
184
+ #
185
+ # @param vend [String] name and email address of vendor
186
+ # @raise [Vanagon::Error] when `vend` does not include email address
187
+ def vendor=(vend)
188
+ raise Vanagon::Error, 'Project vendor field must include email address in angle brackets, e.g. "Puppet Inc. <release@puppet.com>"' unless vend.match(VENDOR_REGEX)
189
+ @vendor = vend
190
+ end
191
+
192
+ # Parses the vendor for the project by cutting off the email address
193
+ # field (e.g. `<email@example.com>`).
194
+ #
195
+ # @return [String] Vendor name without email address
196
+ def vendor_name_only
197
+ return @vendor.match(VENDOR_REGEX)[1]
198
+ end
199
+
200
+ # Parses the vendor for the project by taking only the email address field
201
+ # (e.g. `<email@example.com>`).
202
+ #
203
+ # @return [String] Vendor email address
204
+ def vendor_email_only
205
+ return @vendor.match(VENDOR_REGEX)[2]
206
+ end
207
+
180
208
  # Collects all sources and patches into the provided workdir
181
209
  #
182
210
  # @param workdir [String] directory to stage sources into
@@ -21,6 +21,11 @@
21
21
  %global __debug_package %{nil}
22
22
  # to resolve: "ERROR: No build ID note found"
23
23
  %undefine _missing_build_ids_terminate_build
24
+
25
+ <% @package_overrides.each do |var| %>
26
+ <%= var %>
27
+ <% end -%>
28
+
24
29
  # To avoid files installed but not packaged errors
25
30
  %global __os_install_post %{__os_install_post} \
26
31
  rm -rf %{buildroot}/usr/lib/debug
@@ -35,15 +40,11 @@
35
40
  %global __os_install_post %(echo '%{__os_install_post}' | <%= @platform.sed %> -e 's!/usr/lib[^[:space:]]*/brp-strip-static-archive[[:space:]].*$!!g')
36
41
  <% end -%>
37
42
 
38
- <% @package_overrides.each do |var| %>
39
- <%= var %>
40
- <% end -%>
41
-
42
43
  Name: <%= @name %>
43
44
  Version: <%= @version %>
44
45
  Release: <%= @release %>%{?dist}
45
46
  Summary: <%= @description.lines.first.chomp %>
46
- Vendor: <%= @vendor.match(/^(.*) <.*>$/)[1] %>
47
+ Vendor: <%= vendor_name_only %>
47
48
  License: <%= @license %>
48
49
  Group: System Environment/Base
49
50
  URL: <%= @homepage %>
@@ -6,7 +6,7 @@ CLASSES=none
6
6
  CATEGORY=application
7
7
  VENDOR=<%= @vendor %>
8
8
  PSTAMP=<%= Time.now.strftime('%Y-%m-%d.%H%M%S') %>
9
- EMAIL=<%= @vendor.match(/<([^>]*)>/)[1] %>
9
+ EMAIL=<%= vendor_email_only %>
10
10
  ISTATES=S s 1 2 3
11
11
  RSTATES=S s 1 2 3
12
12
  BASEDIR=/
@@ -4,8 +4,8 @@
4
4
  <id><%= "#{@name}-#{@platform.architecture}" %></id>
5
5
  <version><%= @platform.nuget_package_version(@version, @release) %></version>
6
6
  <title><%= @name %></title>
7
- <authors><%= @vendor.match(/^(.*) <.*>$/)[1] %></authors>
8
- <owners><%= @vendor.match(/^(.*) <.*>$/)[1] %></owners>
7
+ <authors><%= vendor_name_only %></authors>
8
+ <owners><%= vendor_name_only %></owners>
9
9
  <projectUrl><%= @homepage %></projectUrl>
10
10
  <packageSourceUrl><%= @homepage %></packageSourceUrl>
11
11
  <projectSourceUrl><%= @homepage %></projectSourceUrl>
@@ -19,7 +19,7 @@
19
19
  </description>
20
20
  <summary><%= @description.lines.first.chomp %></summary>
21
21
  <releaseNotes><%= @homepage %></releaseNotes>
22
- <copyright><%= @vendor.match(/^(.*) <.*>$/)[1] %></copyright>
22
+ <copyright><%= vendor_name_only %></copyright>
23
23
  <tags>puppet configuration management infrastructure automation facter hiera mco mcollective marionette collective</tags>
24
24
  <provides><%= get_replaces.map { |replace| "#{replace.replacement}" }.join(" ") %></provides>
25
25
  <replaces><%= get_replaces.map { |replace| "#{replace.replacement}" }.join(" ") %></replaces>
@@ -55,6 +55,39 @@ describe 'Vanagon::Project' do
55
55
  plat._platform
56
56
  }
57
57
 
58
+ describe '#vendor=' do
59
+ dummy_platform = Vanagon::Platform.new('el-7-x86_64')
60
+ good_vendor = 'Puppet Inc. <release@puppet.com>'
61
+ bad_vendor = 'Puppet Inc.'
62
+
63
+ it 'fails if vendor field does not include email address' do
64
+ project = Vanagon::Project.new('vendor-test', dummy_platform)
65
+ expect { project.vendor = bad_vendor }.to raise_error(Vanagon::Error, /Project vendor field must include email address/)
66
+ end
67
+
68
+ it 'sets project vendor to the supplied value' do
69
+ project = Vanagon::Project.new('vendor-test', dummy_platform)
70
+ project.vendor = good_vendor
71
+ expect(project.vendor).to eq(good_vendor)
72
+ end
73
+ end
74
+
75
+ describe '#vendor_name_only' do
76
+ it 'returns just the name of the vendor' do
77
+ project = Vanagon::Project.new('vendor-test', Vanagon::Platform.new('el-7-x86_64'))
78
+ project.vendor = 'Puppet Inc. <release@puppet.com>'
79
+ expect(project.vendor_name_only).to eq('Puppet Inc.')
80
+ end
81
+ end
82
+
83
+ describe '#vendor_email_only' do
84
+ it 'returns just the email address of the vendor' do
85
+ project = Vanagon::Project.new('vendor-test', Vanagon::Platform.new('el-7-x86_64'))
86
+ project.vendor = 'Puppet Inc. <release@puppet.com>'
87
+ expect(project.vendor_email_only).to eq('release@puppet.com')
88
+ end
89
+ end
90
+
58
91
  describe '#get_root_directories' do
59
92
 
60
93
  before do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.18
4
+ version: 0.15.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-10 00:00:00.000000000 Z
11
+ date: 2018-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -266,41 +266,41 @@ signing_key:
266
266
  specification_version: 3
267
267
  summary: All of your packages will fit into this van with this one simple trick.
268
268
  test_files:
269
- - spec/lib/git/rev_list_spec.rb
270
- - spec/lib/makefile_spec.rb
271
- - spec/lib/vanagon/common/pathname_spec.rb
272
- - spec/lib/vanagon/common/user_spec.rb
273
- - spec/lib/vanagon/component/dsl_spec.rb
274
- - spec/lib/vanagon/component/rules_spec.rb
275
- - spec/lib/vanagon/component/source/git_spec.rb
276
- - spec/lib/vanagon/component/source/http_spec.rb
277
- - spec/lib/vanagon/component/source/local_spec.rb
278
- - spec/lib/vanagon/component/source/rewrite_spec.rb
279
- - spec/lib/vanagon/component/source_spec.rb
280
269
  - spec/lib/vanagon/component_spec.rb
270
+ - spec/lib/vanagon/project_spec.rb
271
+ - spec/lib/vanagon/optparse_spec.rb
281
272
  - spec/lib/vanagon/driver_spec.rb
282
- - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
283
- - spec/lib/vanagon/engine/base_spec.rb
284
- - spec/lib/vanagon/engine/docker_spec.rb
285
- - spec/lib/vanagon/engine/ec2_spec.rb
286
- - spec/lib/vanagon/engine/hardware_spec.rb
287
- - spec/lib/vanagon/engine/local_spec.rb
288
- - spec/lib/vanagon/engine/pooler_spec.rb
289
273
  - spec/lib/vanagon/environment_spec.rb
290
- - spec/lib/vanagon/extensions/ostruct/json_spec.rb
291
- - spec/lib/vanagon/extensions/set/json_spec.rb
292
- - spec/lib/vanagon/extensions/string_spec.rb
293
- - spec/lib/vanagon/optparse_spec.rb
294
- - spec/lib/vanagon/platform/deb_spec.rb
274
+ - spec/lib/vanagon/platform/windows_spec.rb
275
+ - spec/lib/vanagon/platform/solaris_11_spec.rb
276
+ - spec/lib/vanagon/platform/solaris_10_spec.rb
295
277
  - spec/lib/vanagon/platform/dsl_spec.rb
296
278
  - spec/lib/vanagon/platform/osx_spec.rb
297
- - spec/lib/vanagon/platform/rpm/aix_spec.rb
279
+ - spec/lib/vanagon/platform/deb_spec.rb
298
280
  - spec/lib/vanagon/platform/rpm_spec.rb
299
- - spec/lib/vanagon/platform/solaris_10_spec.rb
300
- - spec/lib/vanagon/platform/solaris_11_spec.rb
301
- - spec/lib/vanagon/platform/windows_spec.rb
302
- - spec/lib/vanagon/platform_spec.rb
281
+ - spec/lib/vanagon/platform/rpm/aix_spec.rb
282
+ - spec/lib/vanagon/component/source/rewrite_spec.rb
283
+ - spec/lib/vanagon/component/source/git_spec.rb
284
+ - spec/lib/vanagon/component/source/local_spec.rb
285
+ - spec/lib/vanagon/component/source/http_spec.rb
286
+ - spec/lib/vanagon/component/dsl_spec.rb
287
+ - spec/lib/vanagon/component/source_spec.rb
288
+ - spec/lib/vanagon/component/rules_spec.rb
289
+ - spec/lib/vanagon/extensions/string_spec.rb
290
+ - spec/lib/vanagon/extensions/set/json_spec.rb
291
+ - spec/lib/vanagon/extensions/ostruct/json_spec.rb
303
292
  - spec/lib/vanagon/project/dsl_spec.rb
304
- - spec/lib/vanagon/project_spec.rb
305
293
  - spec/lib/vanagon/utilities/shell_utilities_spec.rb
306
294
  - spec/lib/vanagon/utilities_spec.rb
295
+ - spec/lib/vanagon/common/pathname_spec.rb
296
+ - spec/lib/vanagon/common/user_spec.rb
297
+ - spec/lib/vanagon/platform_spec.rb
298
+ - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
299
+ - spec/lib/vanagon/engine/docker_spec.rb
300
+ - spec/lib/vanagon/engine/ec2_spec.rb
301
+ - spec/lib/vanagon/engine/hardware_spec.rb
302
+ - spec/lib/vanagon/engine/local_spec.rb
303
+ - spec/lib/vanagon/engine/base_spec.rb
304
+ - spec/lib/vanagon/engine/pooler_spec.rb
305
+ - spec/lib/makefile_spec.rb
306
+ - spec/lib/git/rev_list_spec.rb