omnibus 5.6.1 → 5.6.6

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.
Files changed (54) hide show
  1. checksums.yaml +5 -5
  2. data/.expeditor/config.yml +31 -0
  3. data/.expeditor/update_version.sh +12 -0
  4. data/.github/CODEOWNERS +3 -0
  5. data/.github/ISSUE_TEMPLATE.md +0 -2
  6. data/.github/PULL_REQUEST_TEMPLATE.md +0 -1
  7. data/.gitignore +1 -0
  8. data/.travis.yml +2 -2
  9. data/CHANGELOG.md +29 -3
  10. data/Gemfile +1 -1
  11. data/README.md +2 -2
  12. data/VERSION +1 -0
  13. data/appveyor.yml +3 -2
  14. data/docs/Building on Debian.md +6 -4
  15. data/docs/Building on OSX.md +2 -2
  16. data/docs/Building on RHEL.md +3 -3
  17. data/docs/Building on Windows.md +1 -1
  18. data/lib/omnibus.rb +1 -0
  19. data/lib/omnibus/build_version.rb +13 -4
  20. data/lib/omnibus/builder.rb +10 -5
  21. data/lib/omnibus/config.rb +40 -8
  22. data/lib/omnibus/fetcher.rb +2 -0
  23. data/lib/omnibus/fetchers/file_fetcher.rb +131 -0
  24. data/lib/omnibus/packagers/deb.rb +81 -0
  25. data/lib/omnibus/packagers/ips.rb +22 -7
  26. data/lib/omnibus/publishers/artifactory_publisher.rb +2 -6
  27. data/lib/omnibus/publishers/s3_publisher.rb +7 -5
  28. data/lib/omnibus/s3_cache.rb +1 -0
  29. data/lib/omnibus/s3_helpers.rb +2 -0
  30. data/lib/omnibus/sugarable.rb +1 -0
  31. data/lib/omnibus/version.rb +1 -1
  32. data/lib/omnibus/whitelist.rb +1 -0
  33. data/omnibus.gemspec +3 -3
  34. data/resources/msi/CustomActionFastMsi.CA.dll +0 -0
  35. data/resources/msi/source.wxs.erb +7 -0
  36. data/spec/functional/fetchers/file_fetcher_spec.rb +92 -0
  37. data/spec/spec_helper.rb +1 -1
  38. data/spec/unit/build_version_spec.rb +11 -1
  39. data/spec/unit/compressor_spec.rb +2 -2
  40. data/spec/unit/config_spec.rb +13 -3
  41. data/spec/unit/fetchers/file_fetcher_spec.rb +81 -0
  42. data/spec/unit/fetchers/net_fetcher_spec.rb +14 -3
  43. data/spec/unit/health_check_spec.rb +3 -3
  44. data/spec/unit/metadata_spec.rb +8 -8
  45. data/spec/unit/packager_spec.rb +10 -10
  46. data/spec/unit/packagers/bff_spec.rb +1 -1
  47. data/spec/unit/packagers/deb_spec.rb +40 -0
  48. data/spec/unit/packagers/ips_spec.rb +31 -5
  49. data/spec/unit/packagers/rpm_spec.rb +5 -5
  50. data/spec/unit/project_spec.rb +7 -7
  51. data/spec/unit/publishers/artifactory_publisher_spec.rb +16 -0
  52. data/spec/unit/publishers/s3_publisher_spec.rb +17 -0
  53. data/spec/unit/software_spec.rb +10 -8
  54. metadata +16 -7
@@ -193,6 +193,8 @@ module Omnibus
193
193
  GitFetcher
194
194
  elsif source[:path]
195
195
  PathFetcher
196
+ elsif source[:file]
197
+ FileFetcher
196
198
  end
197
199
  else
198
200
  NullFetcher
@@ -0,0 +1,131 @@
1
+ #
2
+ # Copyright 2012-2014 Chef Software, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require "fileutils"
18
+
19
+ module Omnibus
20
+ class FileFetcher < Fetcher
21
+ #
22
+ # Fetch if the local file checksum is different than the path file
23
+ # checksum.
24
+ #
25
+ # @return [true, false]
26
+ #
27
+ def fetch_required?
28
+ target_shasum != destination_shasum
29
+ end
30
+
31
+ #
32
+ # The version identifier for this file. This is computed using the file
33
+ # on disk to the source and the shasum of that file on disk.
34
+ #
35
+ # @return [String]
36
+ #
37
+ def version_guid
38
+ "file:#{source_file}"
39
+ end
40
+
41
+ #
42
+ # Clean the given path by removing the project directory.
43
+ #
44
+ # @return [true, false]
45
+ # true if the directory was cleaned, false otherwise.
46
+ # Since we do not currently use the cache to sync files and
47
+ # always fetch from source, there is no need to clean anything.
48
+ # The fetch step (which needs to be called before clean) would
49
+ # have already removed anything extraneous.
50
+ #
51
+ def clean
52
+ true
53
+ end
54
+
55
+ #
56
+ # Fetch any new files by copying them to the +project_dir+.
57
+ #
58
+ # @return [void]
59
+ #
60
+ def fetch
61
+ log.info(log_key) { "Copying from `#{source_file}'" }
62
+
63
+ create_required_directories
64
+ FileUtils.cp(source_file, target_file)
65
+ # Reset target shasum on every fetch
66
+ @target_shasum = nil
67
+ target_shasum
68
+ end
69
+
70
+ #
71
+ # The version for this item in the cache. The is the shasum of the file
72
+ # on disk.
73
+ #
74
+ # This method is called *before* clean but *after* fetch. Since fetch
75
+ # automatically cleans, target vs. destination sha doesn't matter. Change this
76
+ # if that assumption changes.
77
+ #
78
+ # @return [String]
79
+ #
80
+ def version_for_cache
81
+ "file:#{source_file}|shasum:#{destination_shasum}"
82
+ end
83
+
84
+ #
85
+ # @return [String, nil]
86
+ #
87
+ def self.resolve_version(version, source)
88
+ version
89
+ end
90
+
91
+ private
92
+
93
+ #
94
+ # The path on disk to pull the file from.
95
+ #
96
+ # @return [String]
97
+ #
98
+ def source_file
99
+ source[:file]
100
+ end
101
+
102
+ #
103
+ # The path on disk where the file is stored.
104
+ #
105
+ # @return [String]
106
+ #
107
+ def target_file
108
+ File.join(project_dir, File.basename(source_file))
109
+ end
110
+
111
+ #
112
+ # The shasum of the file **inside** the project.
113
+ #
114
+ # @return [String, nil]
115
+ #
116
+ def target_shasum
117
+ @target_shasum ||= digest(target_file, :sha256)
118
+ rescue Errno::ENOENT
119
+ @target_shasum = nil
120
+ end
121
+
122
+ #
123
+ # The shasum of the file **outside** of the project.
124
+ #
125
+ # @return [String]
126
+ #
127
+ def destination_shasum
128
+ @destination_shasum ||= digest(source_file, :sha256)
129
+ end
130
+ end
131
+ end
@@ -60,12 +60,37 @@ module Omnibus
60
60
 
61
61
  # Create the deb
62
62
  create_deb_file
63
+
64
+ # Sign the deb
65
+ sign_deb_file
63
66
  end
64
67
 
65
68
  #
66
69
  # @!group DSL methods
67
70
  # --------------------------------------------------
68
71
 
72
+ #
73
+ # Set or return the signing passphrase. If this value is provided,
74
+ # Omnibus will attempt to sign the DEB.
75
+ #
76
+ # @example
77
+ # signing_passphrase "foo"
78
+ #
79
+ # @param [String] val
80
+ # the passphrase to use when signing the DEB
81
+ #
82
+ # @return [String]
83
+ # the DEB-signing passphrase
84
+ #
85
+ def signing_passphrase(val = NULL)
86
+ if null?(val)
87
+ @signing_passphrase
88
+ else
89
+ @signing_passphrase = val
90
+ end
91
+ end
92
+ expose :signing_passphrase
93
+
69
94
  #
70
95
  # Set or return the vendor who made this package.
71
96
  #
@@ -389,6 +414,62 @@ module Omnibus
389
414
  end
390
415
  end
391
416
 
417
+ #
418
+ # Sign the +.deb+ file with gpg. This has to be done as separate steps
419
+ # from creating the +.deb+ file. See +debsigs+ source for behavior
420
+ # replicated here. +https://gitlab.com/debsigs/debsigs/blob/master/debsigs.txt#L103-124+
421
+ #
422
+ # @return [void]
423
+ def sign_deb_file
424
+ if !signing_passphrase
425
+ log.info(log_key) { "Signing not enabled for .deb file" }
426
+ return
427
+ end
428
+
429
+ log.info(log_key) { "Signing enabled for .deb file" }
430
+
431
+ # Check our dependencies and determine command for GnuPG. +Omnibus.which+ returns the path, or nil.
432
+ gpg = nil
433
+ if Omnibus.which("gpg2")
434
+ gpg = "gpg2"
435
+ elsif Omnibus.which("gpg")
436
+ gpg = "gpg"
437
+ end
438
+
439
+ if gpg && Omnibus.which("ar")
440
+ # Create a directory that will be cleaned when we leave the block
441
+ Dir.mktmpdir do |tmp_dir|
442
+ Dir.chdir(tmp_dir) do
443
+ # Extract the deb file contents
444
+ shellout!("ar x #{Config.package_dir}/#{package_name}")
445
+ # Concatenate contents, in order per +debsigs+ documentation.
446
+ shellout!("cat debian-binary control.tar.* data.tar.* > complete")
447
+ # Create signature (as +root+)
448
+ gpg_command = "#{gpg} --armor --sign --detach-sign"
449
+ gpg_command << " --local-user '#{project.maintainer}'"
450
+ gpg_command << " --homedir #{ENV['HOME']}/.gnupg" # TODO: Make this configurable
451
+ ## pass the +signing_passphrase+ via +STDIN+
452
+ gpg_command << " --batch --no-tty"
453
+ ## Check `gpg` for the compatibility/need of pinentry-mode
454
+ # - We're calling gpg with the +--pinentry-mode+ argument, and +STDIN+ of +/dev/null+
455
+ # - This _will_ fail with exit code 2 no matter what. We want to check the +STDERR+
456
+ # for the error message about the parameter. If it is _not present_ in the
457
+ # output, then we _do_ want to add it. (If +grep -q+ is +1+, add parameter)
458
+ if shellout("#{gpg} --pinentry-mode loopback </dev/null 2>&1 | grep -q pinentry-mode").exitstatus == 1
459
+ gpg_command << " --pinentry-mode loopback"
460
+ end
461
+ gpg_command << " --passphrase-fd 0"
462
+ gpg_command << " -o _gpgorigin complete"
463
+ shellout!("fakeroot #{gpg_command}", input: signing_passphrase)
464
+ # Append +_gpgorigin+ to the +.deb+ file (as +root+)
465
+ shellout!("fakeroot ar rc #{Config.package_dir}/#{package_name} _gpgorigin")
466
+ end
467
+ end
468
+ else
469
+ log.info(log_key) { "Signing not possible. Ensure that GnuPG and GNU AR are available" }
470
+ end
471
+ end
472
+
392
473
  #
393
474
  # The size of this Debian package. This is dynamically calculated.
394
475
  #
@@ -213,18 +213,33 @@ module Omnibus
213
213
  )
214
214
  end
215
215
 
216
+ #
217
+ # The name of the project specific template if it exists
218
+ # The resource exists locally. For example for project omnibus-toolchain
219
+ # resource_path("#{safe_base_package_name}-symlinks.erb") #=>
220
+ # {"/path/to/omnibus-toolchain/resources/omnibus-toolchain/ips/omnibus-toolchain-symlinks.erb"}
221
+ # OR {"/path/to/omnibus-toolchain/resources/omnibus-toolchain/ips/symlinks.erb"}
222
+ #
223
+ # @return [String]
224
+ #
225
+ def symlinks_file
226
+ if File.exists?(resource_path("#{safe_base_package_name}-symlinks.erb"))
227
+ "#{safe_base_package_name}-symlinks.erb"
228
+ elsif File.exists?(resource_path("symlinks.erb"))
229
+ "symlinks.erb"
230
+ end
231
+ end
232
+
216
233
  #
217
234
  # A set of symbolic links to installed commands that
218
235
  #`pkgmogrify' will apply to the package manifest. Is called only when
219
- # symlinks.erb template exists
220
- # The resource exists locally. For example for project omnibus-toolchain
221
- # resource_path("symlinks.erb") #=>
222
- # {"/path/to/omnibus-toolchain/resources/omnibus-toolchain/ips/symlinks.erb"}
236
+ # "#{safe_base_package_name}-symlinks.erb" or "symlinks.erb" template resource
237
+ # exists locally
223
238
  #
224
239
  # @return [String]
225
240
  #
226
241
  def render_symlinks
227
- render_template_content(resource_path("symlinks.erb"),
242
+ render_template_content(resource_path(symlinks_file),
228
243
  {
229
244
  projectdir: project.install_dir,
230
245
  }
@@ -250,8 +265,8 @@ module Omnibus
250
265
  }
251
266
  )
252
267
 
253
- # Append the contents of symlinks.erb if it exists
254
- if File.exists?(resource_path("symlinks.erb"))
268
+ # Append the contents of symlinks_file if it exists
269
+ if symlinks_file
255
270
  File.open(pkg_metadata_file, "a") do |symlink|
256
271
  symlink.write(render_symlinks)
257
272
  end
@@ -260,7 +260,7 @@ module Omnibus
260
260
  # and the package metadata.
261
261
  #
262
262
  # @example
263
- # chef/11.6.0/chef-11.6.0-1.el6.x86_64.rpm
263
+ # com/getchef/chef/11.6.0/ubuntu/14.04/chef-11.6.0-1.el6.x86_64.rpm
264
264
  #
265
265
  # @param [Package] package
266
266
  # the package to generate the remote path for
@@ -270,11 +270,7 @@ module Omnibus
270
270
  def remote_path_for(package)
271
271
  File.join(
272
272
  Config.artifactory_base_path,
273
- package.metadata[:name],
274
- package.metadata[:version],
275
- package.metadata[:platform],
276
- package.metadata[:platform_version],
277
- package.metadata[:basename]
273
+ Config.artifactory_publish_pattern % package.metadata
278
274
  )
279
275
  end
280
276
  end
@@ -57,25 +57,27 @@ module Omnibus
57
57
  config[:access_key_id] = Config.publish_s3_access_key
58
58
  config[:secret_access_key] = Config.publish_s3_secret_key
59
59
  end
60
+
61
+ config
60
62
  end
61
63
 
62
64
  #
63
65
  # The unique upload key for this package. The additional "stuff" is
64
66
  # postfixed to the end of the path.
65
67
  #
68
+ # @example
69
+ # 'el/6/x86_64/chef-11.6.0-1.el6.x86_64.rpm/chef-11.6.0-1.el6.x86_64.rpm'
70
+ #
66
71
  # @param [Package] package
67
72
  # the package this key is for
68
73
  # @param [Array<String>] stuff
69
- # the additional things to prepend
74
+ # the additional things to append
70
75
  #
71
76
  # @return [String]
72
77
  #
73
78
  def key_for(package, *stuff)
74
79
  File.join(
75
- package.metadata[:platform],
76
- package.metadata[:platform_version],
77
- package.metadata[:arch],
78
- package.name,
80
+ Config.s3_publish_pattern % package.metadata,
79
81
  *stuff
80
82
  )
81
83
  end
@@ -144,6 +144,7 @@ module Omnibus
144
144
  bucket_name: Config.s3_bucket,
145
145
  endpoint: Config.s3_endpoint,
146
146
  use_accelerate_endpoint: Config.s3_accelerate,
147
+ force_path_style: Config.s3_force_path_style,
147
148
  }
148
149
 
149
150
  if Config.s3_profile
@@ -38,6 +38,7 @@ module Omnibus
38
38
  # bucket_name: Config.s3_bucket,
39
39
  # endpoint: Config.s3_endpoint,
40
40
  # use_accelerate_endpoint: Config.s3_accelerate
41
+ # force_path_style: Config.s3_force_path_style
41
42
  # }
42
43
  #
43
44
  # @return [Hash<String, String>]
@@ -68,6 +69,7 @@ module Omnibus
68
69
  def resource_params
69
70
  params = {
70
71
  use_accelerate_endpoint: s3_configuration[:use_accelerate_endpoint],
72
+ force_path_style: s3_configuration[:force_path_style],
71
73
  }
72
74
 
73
75
  if s3_configuration[:use_accelerate_endpoint]
@@ -18,6 +18,7 @@ require "chef/sugar/architecture"
18
18
  require "chef/sugar/cloud"
19
19
  require "chef/sugar/constraints"
20
20
  require "chef/sugar/ip"
21
+ require "chef/sugar/init"
21
22
  require "chef/sugar/platform"
22
23
  require "chef/sugar/platform_family"
23
24
  require "chef/sugar/ruby"
@@ -15,5 +15,5 @@
15
15
  #
16
16
 
17
17
  module Omnibus
18
- VERSION = "5.6.1"
18
+ VERSION = "5.6.6"
19
19
  end
@@ -126,6 +126,7 @@ MAC_WHITELIST_LIBS = [
126
126
  /Tcl$/,
127
127
  /Cocoa$/,
128
128
  /Carbon$/,
129
+ /Foundation/,
129
130
  /IOKit$/,
130
131
  /Tk$/,
131
132
  /libutil\.dylib/,
@@ -8,10 +8,10 @@ Gem::Specification.new do |gem|
8
8
  gem.version = Omnibus::VERSION
9
9
  gem.license = "Apache 2.0"
10
10
  gem.author = "Chef Software, Inc."
11
- gem.email = "releng@getchef.com"
11
+ gem.email = "releng@chef.io"
12
12
  gem.summary = "Omnibus is a framework for building self-installing, full-stack software builds."
13
13
  gem.description = gem.summary
14
- gem.homepage = "https://github.com/opscode/omnibus"
14
+ gem.homepage = "https://github.com/chef/omnibus"
15
15
 
16
16
  gem.required_ruby_version = ">= 2.2"
17
17
 
@@ -40,7 +40,7 @@ Gem::Specification.new do |gem|
40
40
  gem.add_development_dependency "artifactory", "~> 2.0"
41
41
  gem.add_development_dependency "aruba", "~> 0.5"
42
42
  gem.add_development_dependency "chefstyle"
43
- gem.add_development_dependency "fauxhai", "~> 3.2"
43
+ gem.add_development_dependency "fauxhai", "~> 5.2"
44
44
  gem.add_development_dependency "rspec", "~> 3.0"
45
45
  gem.add_development_dependency "rspec-json_expectations"
46
46
  gem.add_development_dependency "rspec-its"
@@ -20,6 +20,13 @@
20
20
 
21
21
  <Media Id="1" Cabinet="Project.cab" EmbedCab="yes" CompressionLevel="high" />
22
22
 
23
+ <!--
24
+ Take advantage of Windows Installer 5.0 feature (if available) to disable
25
+ checkpointing and other costings that take significant amounts of time
26
+ ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd408005(v=vs.85).aspx
27
+ -->
28
+ <Property Id="MSIFASTINSTALL" Value="7" />
29
+
23
30
  <!--
24
31
  Uncomment launch condition below to check for minimum OS
25
32
  601 = Windows 7/Server 2008R2.
@@ -0,0 +1,92 @@
1
+ require "spec_helper"
2
+
3
+ module Omnibus
4
+ describe FileFetcher do
5
+ include_examples "a software"
6
+
7
+ let(:source_file) { File.join(tmp_path, "t", "software") }
8
+ let(:target_file) { File.join(project_dir, "software") }
9
+
10
+ let(:source) do
11
+ { file: source_file }
12
+ end
13
+
14
+ let(:manifest_entry) do
15
+ double(Omnibus::ManifestEntry,
16
+ name: "pathelogical",
17
+ locked_version: nil,
18
+ described_version: nil,
19
+ locked_source: source)
20
+ end
21
+
22
+ subject { described_class.new(manifest_entry, project_dir, build_dir) }
23
+
24
+ describe "#fetch_required?" do
25
+ context "when the files have different hashes" do
26
+ before do
27
+ create_file(source_file) { "different" }
28
+ create_file(target_file) { "same" }
29
+ end
30
+
31
+ it "return true" do
32
+ expect(subject.fetch_required?).to be_truthy
33
+ end
34
+ end
35
+
36
+ context "when the files have the same hash" do
37
+ before do
38
+ create_file(source_file) { "same" }
39
+ create_file(target_file) { "same" }
40
+ end
41
+
42
+ it "returns false" do
43
+ expect(subject.fetch_required?).to be(false)
44
+ end
45
+ end
46
+ end
47
+
48
+ describe "#version_guid" do
49
+ it "includes the source file" do
50
+ expect(subject.version_guid).to eq("file:#{source_file}")
51
+ end
52
+ end
53
+
54
+ describe "#fetch" do
55
+ before do
56
+ create_file(source_file)
57
+
58
+ remove_file(target_file)
59
+ end
60
+
61
+ it "fetches new files" do
62
+ subject.fetch
63
+
64
+ expect(target_file).to be_a_file
65
+ end
66
+ end
67
+
68
+ describe "#clean" do
69
+ it "returns true" do
70
+ expect(subject.clean).to be_truthy
71
+ end
72
+ end
73
+
74
+ describe "#version_for_cache" do
75
+ before do
76
+ create_file(source_file)
77
+ end
78
+
79
+ let(:sha) { "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }
80
+
81
+ it "includes the source_file and shasum" do
82
+ expect(subject.version_for_cache).to eq("file:#{source_file}|shasum:#{sha}")
83
+ end
84
+ end
85
+
86
+ describe "#resolve_version" do
87
+ it "just returns the version" do
88
+ expect(NetFetcher.resolve_version("1.2.3", source)).to eq("1.2.3")
89
+ end
90
+ end
91
+ end
92
+ end