vanagon 0.15.37 → 0.15.38

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: d81f5bb7831c050aec5ea57db573fcca3f435ab17447809d237d463a43aeed9a
4
- data.tar.gz: cc4b94cacd02a497dd55ed6a8498a01784217adf03eef6fe28fa54e3a2cf9cc0
3
+ metadata.gz: 6ffa8bb7c327a5b46f5403c9fb77cf396c8a9e09fb8d7c7558927bd99830483b
4
+ data.tar.gz: 8bc7b97f25d0fa5405af34ecddc6e6b00d6c57605d85a16fe232c7477a3083a8
5
5
  SHA512:
6
- metadata.gz: 7288377a9292bb0a69d6ec996fbee1495c0f8ce729f33f0cbe16523b4f07fee736c63f2638c3a760e3ee09f0ffc4e8f4c11bcfc5cadfee2a35369c2a2e505e2a
7
- data.tar.gz: 51340339458db18882d99879774e2d89f36085d034d5935f2884d8dc91ff9938df55e717c98de49c96e7299a2e44216a089340ef198f0efb1936693750b6ba1f
6
+ metadata.gz: f63aa10d3742e370faaaaf2c7dd5d7720f6598e60944a4d4917cc1e19b761a606a44fac5809f801bbae99b23f3f0221c958b70e7afb2a619d6fe32c0110a052c
7
+ data.tar.gz: 4303abc3598c0558b349dee95ad81c1f6354845971323ccbaa73f24d841c4eab7e5df39225ea9f58ae305470ec143f849feb7e0adae296430873263729a536ff
@@ -140,7 +140,7 @@ class Vanagon
140
140
  @project.make_bill_of_materials(workdir)
141
141
  # Don't generate packaging artifacts if no_packaging is set
142
142
  @project.generate_packaging_artifacts(workdir) unless @project.no_packaging
143
- @project.save_manifest_json(@platform)
143
+ @project.save_manifest_json(@platform, workdir)
144
144
  @engine.ship_workdir(workdir)
145
145
  @engine.dispatch("(cd #{@engine.remote_workdir}; #{@platform.make} #{make_target})")
146
146
  @engine.retrieve_built_artifact(@project.artifacts_to_fetch, @project.no_packaging)
@@ -486,9 +486,9 @@ class Vanagon
486
486
  def generate_compiled_archive(project)
487
487
  name_and_version = "#{project.name}-#{project.version}"
488
488
  name_and_version_and_platform = "#{name_and_version}.#{name}"
489
+ name_and_platform = "#{project.name}.#{name}"
489
490
  final_archive = "output/#{name_and_version_and_platform}.tar.gz"
490
491
  archive_directory = "#{project.name}-archive"
491
- metadata = project.build_manifest_json(true)
492
492
 
493
493
  # previously, we weren't properly handling the case of custom BOM paths.
494
494
  # If we have a custom BOM path, during Makefile execution, the top-level
@@ -503,7 +503,6 @@ class Vanagon
503
503
  bill_of_materials_command = "mv .#{project.bill_of_materials.path}/bill-of-materials ../.."
504
504
  end
505
505
 
506
- metadata.gsub!(/\n/, '\n')
507
506
  [
508
507
  "mkdir output",
509
508
  "mkdir #{archive_directory}",
@@ -511,7 +510,7 @@ class Vanagon
511
510
  "rm #{name_and_version}.tar.gz",
512
511
  "cd #{archive_directory}/#{name_and_version}; #{bill_of_materials_command}; #{tar} cf ../../#{name_and_version_and_platform}.tar *",
513
512
  "gzip -9c #{name_and_version_and_platform}.tar > #{name_and_version_and_platform}.tar.gz",
514
- "echo -e \"#{metadata}\" > output/#{name_and_version_and_platform}.json",
513
+ "cp build_metadata.#{name_and_platform}.json output/#{name_and_version_and_platform}.json",
515
514
  "cp bill-of-materials output/#{name_and_version_and_platform}-bill-of-materials ||:",
516
515
  "cp #{name_and_version_and_platform}.tar.gz output",
517
516
  "#{shasum} #{final_archive} > #{final_archive}.sha1"
@@ -140,7 +140,7 @@ class Vanagon
140
140
  @tar = "tar"
141
141
  @patch = "/usr/bin/patch"
142
142
  @num_cores = "/usr/bin/nproc"
143
- @curl = "curl --silent --show-error --fail"
143
+ @curl = "curl --silent --show-error --fail --location"
144
144
  @valid_operators = ['<', '>', '<=', '>=', '=', '<<', '>>']
145
145
  super(name)
146
146
  end
@@ -103,7 +103,7 @@ class Vanagon
103
103
  @patch ||= "/usr/bin/patch"
104
104
  @num_cores ||= "/bin/grep -c 'processor' /proc/cpuinfo"
105
105
  @rpmbuild ||= "/usr/bin/rpmbuild"
106
- @curl = "curl --silent --show-error --fail"
106
+ @curl = "curl --silent --show-error --fail --location"
107
107
  super(name)
108
108
  end
109
109
  end
@@ -205,11 +205,36 @@ class Vanagon
205
205
  # "Misc Dir for versions.txt, License file and Icon file"
206
206
  misc_dir = "SourceDir/#{project.settings[:base_dir]}/#{project.settings[:company_id]}/#{project.settings[:product_id]}/misc"
207
207
  # Actual array of commands to be written to the Makefile
208
- [
208
+ make_commands = [
209
209
  "mkdir -p output/#{target_dir}",
210
210
  "mkdir -p $(tempdir)/{SourceDir,wix/wixobj}",
211
211
  "#{@copy} -r wix/* $(tempdir)/wix/",
212
- "gunzip -c #{project.name}-#{project.version}.tar.gz | '#{@tar}' -C '$(tempdir)/SourceDir' --strip-components 1 -xf -",
212
+ "gunzip -c #{project.name}-#{project.version}.tar.gz | '#{@tar}' -C '$(tempdir)/SourceDir' --strip-components 1 -xf -"
213
+ ]
214
+
215
+ unless project.extra_files_to_sign.empty?
216
+ begin
217
+ tempdir = nil
218
+ # Skip signing extra files if logging into the signing_host fails
219
+ # This enables things like CI being able to sign the additional files,
220
+ # but locally triggered builds by developers who don't have access to
221
+ # the signing host just print a message and skip the signing.
222
+ Vanagon::Utilities.retry_with_timeout(3, 5) do
223
+ tempdir = Vanagon::Utilities::remote_ssh_command("#{project.signing_username}@#{project.signing_hostname}", "#{@mktemp} 2>/dev/null", return_command_output: true)
224
+ end
225
+ project.extra_files_to_sign.each do |file|
226
+ file_location = File.join(tempdir, File.basename(file))
227
+ make_commands << [
228
+ "rsync -e '#{Vanagon::Utilities.ssh_command}' -rHlv --no-perms --no-owner --no-group #{File.join('$(tempdir)', 'SourceDir', file)} #{project.signing_username}@#{project.signing_hostname}:#{tempdir}",
229
+ "#{Vanagon::Utilities.ssh_command} #{project.signing_username}@#{project.signing_hostname} #{project.signing_command} #{file_location}",
230
+ "rsync -e '#{Vanagon::Utilities.ssh_command}' -rHlv -O --no-perms --no-owner --no-group #{project.signing_username}@#{project.signing_hostname}:#{file_location} #{File.join('$(tempdir)', 'SourceDir', file)}"
231
+ ]
232
+ end
233
+ rescue RuntimeError
234
+ warn "Unable to connect to #{project.signing_username}@#{project.signing_hostname}, skipping signing extra files: #{project.extra_files_to_sign.join(',')}"
235
+ end
236
+ end
237
+ make_commands << [
213
238
  "mkdir -p $(tempdir)/#{misc_dir}",
214
239
  # Need to use awk here to convert to DOS format so that notepad can display file correctly.
215
240
  "awk 'sub(\"$$\", \"\\r\")' $(tempdir)/SourceDir/bill-of-materials > $(tempdir)/#{misc_dir}/versions.txt",
@@ -225,6 +250,8 @@ class Vanagon
225
250
  # -loc is required for the UI localization it points to the actual localization .wxl
226
251
  "cd $(tempdir)/wix/wixobj; \"$$WIX/bin/light.exe\" #{light_flags} -b $$(cygpath -aw $(tempdir)) -loc $$(cygpath -aw $(tempdir)/wix/localization/puppet_en-us.wxl) -out $$(cygpath -aw $(workdir)/output/#{target_dir}/#{msi_package_name(project)}) *.wixobj",
227
252
  ]
253
+
254
+ make_commands.flatten
228
255
  end
229
256
 
230
257
  # Method to derive the msi (Windows Installer) package name for the project.
@@ -108,6 +108,14 @@ class Vanagon
108
108
  # you just want to perform installation and pull down a file.
109
109
  attr_accessor :no_packaging
110
110
 
111
+ # Extra files to sign
112
+ # Right now just supported on windows, useful for signing powershell scripts
113
+ # that need to be signed between build and MSI creation
114
+ attr_accessor :extra_files_to_sign
115
+ attr_accessor :signing_hostname
116
+ attr_accessor :signing_username
117
+ attr_accessor :signing_command
118
+
111
119
  # Loads a given project from the configdir
112
120
  #
113
121
  # @param name [String] the name of the project
@@ -156,6 +164,10 @@ class Vanagon
156
164
  @upstream_metadata = {}
157
165
  @no_packaging = false
158
166
  @artifacts_to_fetch = []
167
+ @extra_files_to_sign = []
168
+ @signing_hostname = ''
169
+ @signing_username = ''
170
+ @signing_command = ''
159
171
  end
160
172
 
161
173
  # Magic getter to retrieve settings in the project
@@ -714,20 +726,27 @@ class Vanagon
714
726
  # Writes a json file at `ext/build_metadata.<project>.<platform>.json` containing information
715
727
  # about what went into a built artifact
716
728
  #
717
- # @return [Hash] of build information
718
- def save_manifest_json(platform)
729
+ # @param platform [String] platform we're writing metadata for
730
+ # @param additional_directories [String|Array[String]] additional
731
+ # directories to write build_metadata.<project>.<platform>.json to
732
+ def save_manifest_json(platform, additional_directories = nil) # rubocop:disable Metrics/AbcSize
719
733
  manifest = build_manifest_json
720
734
  metadata = metadata_merge(manifest, @upstream_metadata)
721
735
 
722
736
  ext_directory = 'ext'
723
737
  FileUtils.mkdir_p ext_directory
724
738
 
739
+ directories = [ext_directory, additional_directories].compact
725
740
  metadata_file_name = "build_metadata.#{name}.#{platform.name}.json"
726
- File.open(File.join(ext_directory, metadata_file_name), 'w') do |f|
727
- f.write(JSON.pretty_generate(metadata))
741
+ directories.each do |directory|
742
+ File.open(File.join(directory, metadata_file_name), 'w') do |f|
743
+ f.write(JSON.pretty_generate(metadata))
744
+ end
728
745
  end
729
746
 
730
747
  ## VANAGON-132 Backwards compatibility: make a 'build_metadata.json' file
748
+ # No need to propagate this backwards compatibility to the new additional
749
+ # directories
731
750
  File.open(File.join(ext_directory, 'build_metadata.json'), 'w') do |f|
732
751
  f.write(JSON.pretty_generate(metadata))
733
752
  end
@@ -363,6 +363,39 @@ class Vanagon
363
363
  def no_packaging(var)
364
364
  @project.no_packaging = var
365
365
  end
366
+
367
+ # Set to sign additional files during buildtime. Only implemented for
368
+ # windows. Can be specified more than once
369
+ #
370
+ # @param [String] file to sign
371
+ def extra_file_to_sign(file)
372
+ @project.extra_files_to_sign << file
373
+ end
374
+
375
+ # The hostname to sign additional files on. Only does anything when there
376
+ # are extra files to sign
377
+ #
378
+ # @param [String] hostname of the machine to run the extra file signing on
379
+ def signing_hostname(hostname)
380
+ @project.signing_hostname = hostname
381
+ end
382
+
383
+ # The username to log in to the signing_hostname as. Only does anything
384
+ # when there are extra files to sign
385
+ #
386
+ # @param [String] the username to log in to `signing_hostname` as
387
+ def signing_username(username)
388
+ @project.signing_username = username
389
+ end
390
+
391
+ # The command to run to sign additional files. The command should assume
392
+ # it will have the file path appended to the end of the command, since
393
+ # files end up in a temp directory.
394
+ #
395
+ # @param [String] the command to sign additional files
396
+ def signing_command(command)
397
+ @project.signing_command = command
398
+ end
366
399
  end
367
400
  end
368
401
  end
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.37
4
+ version: 0.15.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-06 00:00:00.000000000 Z
11
+ date: 2020-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -265,41 +265,41 @@ signing_key:
265
265
  specification_version: 3
266
266
  summary: All of your packages will fit into this van with this one simple trick.
267
267
  test_files:
268
- - spec/lib/makefile_spec.rb
269
- - spec/lib/vanagon/utilities/shell_utilities_spec.rb
270
- - spec/lib/vanagon/platform_spec.rb
268
+ - spec/lib/git/rev_list_spec.rb
269
+ - spec/lib/vanagon/driver_spec.rb
271
270
  - spec/lib/vanagon/project_spec.rb
272
- - spec/lib/vanagon/component_spec.rb
273
- - spec/lib/vanagon/extensions/set/json_spec.rb
274
- - spec/lib/vanagon/extensions/string_spec.rb
275
- - spec/lib/vanagon/extensions/ostruct/json_spec.rb
276
- - spec/lib/vanagon/engine/ec2_spec.rb
277
- - spec/lib/vanagon/engine/hardware_spec.rb
278
- - spec/lib/vanagon/engine/pooler_spec.rb
279
- - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
280
- - spec/lib/vanagon/engine/docker_spec.rb
281
- - spec/lib/vanagon/engine/base_spec.rb
282
- - spec/lib/vanagon/engine/local_spec.rb
283
- - spec/lib/vanagon/environment_spec.rb
271
+ - spec/lib/vanagon/utilities/shell_utilities_spec.rb
284
272
  - spec/lib/vanagon/utilities_spec.rb
285
- - spec/lib/vanagon/driver_spec.rb
286
- - spec/lib/vanagon/component/rules_spec.rb
273
+ - spec/lib/vanagon/platform/solaris_10_spec.rb
274
+ - spec/lib/vanagon/platform/rpm_spec.rb
275
+ - spec/lib/vanagon/platform/solaris_11_spec.rb
276
+ - spec/lib/vanagon/platform/dsl_spec.rb
277
+ - spec/lib/vanagon/platform/deb_spec.rb
278
+ - spec/lib/vanagon/platform/windows_spec.rb
279
+ - spec/lib/vanagon/platform/osx_spec.rb
280
+ - spec/lib/vanagon/platform/rpm/aix_spec.rb
281
+ - spec/lib/vanagon/component/source_spec.rb
287
282
  - spec/lib/vanagon/component/dsl_spec.rb
288
- - spec/lib/vanagon/component/source/rewrite_spec.rb
289
- - spec/lib/vanagon/component/source/git_spec.rb
283
+ - spec/lib/vanagon/component/rules_spec.rb
290
284
  - spec/lib/vanagon/component/source/http_spec.rb
291
285
  - spec/lib/vanagon/component/source/local_spec.rb
292
- - spec/lib/vanagon/component/source_spec.rb
286
+ - spec/lib/vanagon/component/source/rewrite_spec.rb
287
+ - spec/lib/vanagon/component/source/git_spec.rb
288
+ - spec/lib/vanagon/engine/docker_spec.rb
289
+ - spec/lib/vanagon/engine/hardware_spec.rb
290
+ - spec/lib/vanagon/engine/ec2_spec.rb
291
+ - spec/lib/vanagon/engine/base_spec.rb
292
+ - spec/lib/vanagon/engine/local_spec.rb
293
+ - spec/lib/vanagon/engine/pooler_spec.rb
294
+ - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
295
+ - spec/lib/vanagon/platform_spec.rb
293
296
  - spec/lib/vanagon/project/dsl_spec.rb
294
297
  - spec/lib/vanagon/optparse_spec.rb
298
+ - spec/lib/vanagon/component_spec.rb
299
+ - spec/lib/vanagon/extensions/ostruct/json_spec.rb
300
+ - spec/lib/vanagon/extensions/string_spec.rb
301
+ - spec/lib/vanagon/extensions/set/json_spec.rb
295
302
  - spec/lib/vanagon/common/user_spec.rb
296
303
  - spec/lib/vanagon/common/pathname_spec.rb
297
- - spec/lib/vanagon/platform/dsl_spec.rb
298
- - spec/lib/vanagon/platform/windows_spec.rb
299
- - spec/lib/vanagon/platform/solaris_10_spec.rb
300
- - spec/lib/vanagon/platform/deb_spec.rb
301
- - spec/lib/vanagon/platform/solaris_11_spec.rb
302
- - spec/lib/vanagon/platform/rpm/aix_spec.rb
303
- - spec/lib/vanagon/platform/osx_spec.rb
304
- - spec/lib/vanagon/platform/rpm_spec.rb
305
- - spec/lib/git/rev_list_spec.rb
304
+ - spec/lib/vanagon/environment_spec.rb
305
+ - spec/lib/makefile_spec.rb