omnibus 5.4.0 → 5.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -3
  3. data/CHANGELOG.md +21 -0
  4. data/Gemfile +8 -5
  5. data/README.md +3 -1
  6. data/Rakefile +20 -13
  7. data/appveyor.yml +4 -3
  8. data/bin/omnibus +3 -3
  9. data/features/commands/manifest.feature +19 -5
  10. data/features/step_definitions/generator_steps.rb +5 -6
  11. data/features/support/env.rb +4 -4
  12. data/lib/omnibus/build_version.rb +14 -14
  13. data/lib/omnibus/build_version_dsl.rb +3 -3
  14. data/lib/omnibus/builder.rb +50 -61
  15. data/lib/omnibus/changelog.rb +2 -2
  16. data/lib/omnibus/changelog_printer.rb +4 -4
  17. data/lib/omnibus/cleaner.rb +4 -4
  18. data/lib/omnibus/cli/base.rb +15 -15
  19. data/lib/omnibus/cli/cache.rb +13 -13
  20. data/lib/omnibus/cli/changelog.rb +8 -9
  21. data/lib/omnibus/cli/publish.rb +12 -13
  22. data/lib/omnibus/cli.rb +26 -27
  23. data/lib/omnibus/compressor.rb +6 -6
  24. data/lib/omnibus/compressors/base.rb +7 -2
  25. data/lib/omnibus/compressors/dmg.rb +12 -12
  26. data/lib/omnibus/compressors/null.rb +1 -1
  27. data/lib/omnibus/compressors/tgz.rb +8 -8
  28. data/lib/omnibus/config.rb +37 -26
  29. data/lib/omnibus/core_extensions/open_uri.rb +3 -3
  30. data/lib/omnibus/core_extensions.rb +1 -1
  31. data/lib/omnibus/digestable.rb +5 -4
  32. data/lib/omnibus/download_helpers.rb +7 -6
  33. data/lib/omnibus/exceptions.rb +29 -13
  34. data/lib/omnibus/fetcher.rb +0 -1
  35. data/lib/omnibus/fetchers/git_fetcher.rb +7 -7
  36. data/lib/omnibus/fetchers/net_fetcher.rb +19 -19
  37. data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
  38. data/lib/omnibus/file_syncer.rb +3 -3
  39. data/lib/omnibus/generator.rb +60 -47
  40. data/lib/omnibus/git_cache.rb +33 -22
  41. data/lib/omnibus/git_repository.rb +5 -5
  42. data/lib/omnibus/health_check.rb +122 -119
  43. data/lib/omnibus/instrumentation.rb +1 -1
  44. data/lib/omnibus/licensing.rb +348 -60
  45. data/lib/omnibus/logger.rb +12 -9
  46. data/lib/omnibus/logging.rb +1 -1
  47. data/lib/omnibus/manifest.rb +4 -4
  48. data/lib/omnibus/manifest_diff.rb +6 -7
  49. data/lib/omnibus/manifest_entry.rb +1 -1
  50. data/lib/omnibus/metadata.rb +36 -36
  51. data/lib/omnibus/ohai.rb +6 -7
  52. data/lib/omnibus/package.rb +1 -1
  53. data/lib/omnibus/packager.rb +37 -28
  54. data/lib/omnibus/packagers/appx.rb +86 -0
  55. data/lib/omnibus/packagers/base.rb +21 -18
  56. data/lib/omnibus/packagers/bff.rb +22 -24
  57. data/lib/omnibus/packagers/deb.rb +20 -20
  58. data/lib/omnibus/packagers/ips.rb +18 -17
  59. data/lib/omnibus/packagers/makeself.rb +7 -7
  60. data/lib/omnibus/packagers/msi.rb +38 -193
  61. data/lib/omnibus/packagers/pkg.rb +16 -16
  62. data/lib/omnibus/packagers/rpm.rb +53 -54
  63. data/lib/omnibus/packagers/solaris.rb +14 -14
  64. data/lib/omnibus/packagers/windows_base.rb +192 -0
  65. data/lib/omnibus/project.rb +45 -43
  66. data/lib/omnibus/publisher.rb +3 -3
  67. data/lib/omnibus/publishers/artifactory_publisher.rb +39 -39
  68. data/lib/omnibus/publishers/s3_publisher.rb +7 -7
  69. data/lib/omnibus/reports.rb +10 -10
  70. data/lib/omnibus/s3_cache.rb +7 -7
  71. data/lib/omnibus/s3_helpers.rb +8 -7
  72. data/lib/omnibus/semantic_version.rb +1 -1
  73. data/lib/omnibus/software.rb +131 -81
  74. data/lib/omnibus/sugarable.rb +10 -10
  75. data/lib/omnibus/templating.rb +5 -5
  76. data/lib/omnibus/thread_pool.rb +1 -1
  77. data/lib/omnibus/util.rb +5 -5
  78. data/lib/omnibus/version.rb +1 -1
  79. data/lib/omnibus.rb +65 -65
  80. data/omnibus.gemspec +34 -32
  81. data/resources/appx/AppxManifest.xml.erb +18 -0
  82. data/resources/appx/assets/clear.png +0 -0
  83. data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-bundler-audit-0.5.0-COPYING.txt +674 -0
  84. data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-inifile-3.0.0-README.md +215 -0
  85. data/spec/fixtures/licensing/license_scout/snoopy/snoopy-dependency-licenses.json +24 -0
  86. data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-inifile-3.0.0-README.md +215 -0
  87. data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mime-types-3.1-Licence.rdoc +25 -0
  88. data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mini_portile2-2.1.0-LICENSE.txt +20 -0
  89. data/spec/fixtures/licensing/license_scout/zlib/zlib-dependency-licenses.json +32 -0
  90. data/spec/functional/builder_spec.rb +149 -150
  91. data/spec/functional/fetchers/git_fetcher_spec.rb +69 -71
  92. data/spec/functional/fetchers/net_fetcher_spec.rb +79 -79
  93. data/spec/functional/fetchers/path_fetcher_spec.rb +19 -20
  94. data/spec/functional/file_syncer_spec.rb +74 -74
  95. data/spec/functional/licensing_spec.rb +344 -35
  96. data/spec/functional/templating_spec.rb +17 -17
  97. data/spec/spec_helper.rb +20 -20
  98. data/spec/support/examples.rb +21 -15
  99. data/spec/support/file_helpers.rb +1 -1
  100. data/spec/support/git_helpers.rb +37 -37
  101. data/spec/support/matchers.rb +3 -3
  102. data/spec/support/ohai_helpers.rb +4 -4
  103. data/spec/support/path_helpers.rb +2 -2
  104. data/spec/support/shell_helpers.rb +2 -2
  105. data/spec/unit/build_version_dsl_spec.rb +5 -5
  106. data/spec/unit/build_version_spec.rb +63 -63
  107. data/spec/unit/builder_spec.rb +86 -70
  108. data/spec/unit/changelog_spec.rb +4 -4
  109. data/spec/unit/changelogprinter_spec.rb +130 -0
  110. data/spec/unit/cleanroom_spec.rb +11 -11
  111. data/spec/unit/compressor_spec.rb +16 -16
  112. data/spec/unit/compressors/base_spec.rb +6 -6
  113. data/spec/unit/compressors/dmg_spec.rb +76 -76
  114. data/spec/unit/compressors/null_spec.rb +4 -4
  115. data/spec/unit/compressors/tgz_spec.rb +20 -20
  116. data/spec/unit/config_spec.rb +44 -43
  117. data/spec/unit/digestable_spec.rb +13 -13
  118. data/spec/unit/fetcher_spec.rb +11 -12
  119. data/spec/unit/fetchers/git_fetcher_spec.rb +31 -31
  120. data/spec/unit/fetchers/net_fetcher_spec.rb +172 -173
  121. data/spec/unit/fetchers/path_fetcher_spec.rb +18 -18
  122. data/spec/unit/generator_spec.rb +38 -38
  123. data/spec/unit/git_cache_spec.rb +56 -54
  124. data/spec/unit/git_repository_spec.rb +2 -2
  125. data/spec/unit/health_check_spec.rb +40 -40
  126. data/spec/unit/library_spec.rb +35 -35
  127. data/spec/unit/manifest_diff_spec.rb +10 -11
  128. data/spec/unit/manifest_spec.rb +17 -17
  129. data/spec/unit/metadata_spec.rb +152 -152
  130. data/spec/unit/ohai_spec.rb +5 -5
  131. data/spec/unit/omnibus_spec.rb +31 -31
  132. data/spec/unit/package_spec.rb +20 -20
  133. data/spec/unit/packager_spec.rb +48 -42
  134. data/spec/unit/packagers/appx_spec.rb +165 -0
  135. data/spec/unit/packagers/base_spec.rb +34 -34
  136. data/spec/unit/packagers/bff_spec.rb +60 -60
  137. data/spec/unit/packagers/deb_spec.rb +71 -71
  138. data/spec/unit/packagers/ips_spec.rb +45 -45
  139. data/spec/unit/packagers/makeself_spec.rb +22 -22
  140. data/spec/unit/packagers/msi_spec.rb +141 -147
  141. data/spec/unit/packagers/pkg_spec.rb +59 -60
  142. data/spec/unit/packagers/rpm_spec.rb +125 -126
  143. data/spec/unit/packagers/solaris_spec.rb +52 -52
  144. data/spec/unit/project_spec.rb +137 -135
  145. data/spec/unit/publisher_spec.rb +70 -70
  146. data/spec/unit/publishers/artifactory_publisher_spec.rb +85 -85
  147. data/spec/unit/publishers/s3_publisher_spec.rb +36 -36
  148. data/spec/unit/s3_cacher_spec.rb +34 -34
  149. data/spec/unit/s3_helpers_spec.rb +6 -6
  150. data/spec/unit/semantic_version_spec.rb +2 -2
  151. data/spec/unit/software_spec.rb +346 -384
  152. data/spec/unit/sugarable_spec.rb +10 -10
  153. data/spec/unit/util_spec.rb +60 -60
  154. metadata +54 -6
  155. data/.rubocop.yml +0 -48
@@ -80,10 +80,10 @@ module Omnibus
80
80
  #
81
81
  def vendor(val = NULL)
82
82
  if null?(val)
83
- @vendor || 'Omnibus <omnibus@getchef.com>'
83
+ @vendor || "Omnibus <omnibus@getchef.com>"
84
84
  else
85
85
  unless val.is_a?(String)
86
- raise InvalidValue.new(:vendor, 'be a String')
86
+ raise InvalidValue.new(:vendor, "be a String")
87
87
  end
88
88
 
89
89
  @vendor = val
@@ -108,7 +108,7 @@ module Omnibus
108
108
  @license || project.license
109
109
  else
110
110
  unless val.is_a?(String)
111
- raise InvalidValue.new(:license, 'be a String')
111
+ raise InvalidValue.new(:license, "be a String")
112
112
  end
113
113
 
114
114
  @license = val
@@ -130,10 +130,10 @@ module Omnibus
130
130
  #
131
131
  def priority(val = NULL)
132
132
  if null?(val)
133
- @priority || 'extra'
133
+ @priority || "extra"
134
134
  else
135
135
  unless val.is_a?(String)
136
- raise InvalidValue.new(:priority, 'be a String')
136
+ raise InvalidValue.new(:priority, "be a String")
137
137
  end
138
138
 
139
139
  @priority = val
@@ -155,10 +155,10 @@ module Omnibus
155
155
  #
156
156
  def section(val = NULL)
157
157
  if null?(val)
158
- @section || 'misc'
158
+ @section || "misc"
159
159
  else
160
160
  unless val.is_a?(String)
161
- raise InvalidValue.new(:section, 'be a String')
161
+ raise InvalidValue.new(:section, "be a String")
162
162
  end
163
163
 
164
164
  @section = val
@@ -187,7 +187,7 @@ module Omnibus
187
187
  # @return [String]
188
188
  #
189
189
  def debian_dir
190
- @debian_dir ||= File.join(staging_dir, 'DEBIAN')
190
+ @debian_dir ||= File.join(staging_dir, "DEBIAN")
191
191
  end
192
192
 
193
193
  #
@@ -197,8 +197,8 @@ module Omnibus
197
197
  # @return [void]
198
198
  #
199
199
  def write_control_file
200
- render_template(resource_path('control.erb'),
201
- destination: File.join(debian_dir, 'control'),
200
+ render_template(resource_path("control.erb"),
201
+ destination: File.join(debian_dir, "control"),
202
202
  variables: {
203
203
  name: safe_base_package_name,
204
204
  version: safe_version,
@@ -227,8 +227,8 @@ module Omnibus
227
227
  def write_conffiles_file
228
228
  return if project.config_files.empty?
229
229
 
230
- render_template(resource_path('conffiles.erb'),
231
- destination: File.join(debian_dir, 'conffiles'),
230
+ render_template(resource_path("conffiles.erb"),
231
+ destination: File.join(debian_dir, "conffiles"),
232
232
  variables: {
233
233
  config_files: project.config_files,
234
234
  }
@@ -242,13 +242,13 @@ module Omnibus
242
242
  # @return [void]
243
243
  #
244
244
  def write_scripts
245
- %w(preinst postinst prerm postrm).each do |script|
245
+ %w{preinst postinst prerm postrm}.each do |script|
246
246
  path = File.join(project.package_scripts_path, script)
247
247
 
248
248
  if File.file?(path)
249
249
  log.debug(log_key) { "Adding script `#{script}' to `#{debian_dir}' from #{path}" }
250
250
  copy_file(path, debian_dir)
251
- log.debug(log_key) { "SCRIPT FILE: #{debian_dir}/#{script}" }
251
+ log.debug(log_key) { "SCRIPT FILE: #{debian_dir}/#{script}" }
252
252
  FileUtils.chmod(0755, File.join(debian_dir, script))
253
253
  end
254
254
  end
@@ -264,15 +264,15 @@ module Omnibus
264
264
  path = "#{staging_dir}/**/*"
265
265
  hash = FileSyncer.glob(path).inject({}) do |hash, path|
266
266
  if File.file?(path) && !File.symlink?(path) && !(File.dirname(path) == debian_dir)
267
- relative_path = path.gsub("#{staging_dir}/", '')
267
+ relative_path = path.gsub("#{staging_dir}/", "")
268
268
  hash[relative_path] = digest(path, :md5)
269
269
  end
270
270
 
271
271
  hash
272
272
  end
273
273
 
274
- render_template(resource_path('md5sums.erb'),
275
- destination: File.join(debian_dir, 'md5sums'),
274
+ render_template(resource_path("md5sums.erb"),
275
+ destination: File.join(debian_dir, "md5sums"),
276
276
  variables: {
277
277
  md5sums: hash,
278
278
  }
@@ -328,7 +328,7 @@ module Omnibus
328
328
  if project.package_name =~ /\A[a-z0-9\.\+\-]+\z/
329
329
  project.package_name.dup
330
330
  else
331
- converted = project.package_name.downcase.gsub(/[^a-z0-9\.\+\-]+/, '-')
331
+ converted = project.package_name.downcase.gsub(/[^a-z0-9\.\+\-]+/, "-")
332
332
 
333
333
  log.warn(log_key) do
334
334
  "The `name' component of Debian package names can only include " \
@@ -361,7 +361,7 @@ module Omnibus
361
361
  version = project.build_version.dup
362
362
 
363
363
  if version =~ /\-/
364
- converted = version.gsub('-', '~')
364
+ converted = version.tr("-", "~")
365
365
 
366
366
  log.warn(log_key) do
367
367
  "Dashes hold special significance in the Debian package versions. " \
@@ -378,7 +378,7 @@ module Omnibus
378
378
  if version =~ /\A[a-zA-Z0-9\.\+\:\~]+\z/
379
379
  version
380
380
  else
381
- converted = version.gsub(/[^a-zA-Z0-9\.\+\:\~]+/, '_')
381
+ converted = version.gsub(/[^a-zA-Z0-9\.\+\:\~]+/, "_")
382
382
 
383
383
  log.warn(log_key) do
384
384
  "The `version' component of Debian package names can only include " \
@@ -66,7 +66,7 @@ module Omnibus
66
66
  #
67
67
  def publisher_prefix(val = NULL)
68
68
  if null?(val)
69
- @publisher_prefix || 'Omnibus'
69
+ @publisher_prefix || "Omnibus"
70
70
  else
71
71
  @publisher_prefix = val
72
72
  end
@@ -81,7 +81,8 @@ module Omnibus
81
81
  # @see Base#package_name
82
82
  #
83
83
  def package_name
84
- "#{safe_base_package_name}.p5p"
84
+ version = project.build_version.split(/[^\d]/)[0..2].join(".")
85
+ "#{safe_base_package_name}-#{version}-#{project.build_iteration}.#{safe_architecture}.p5p"
85
86
  end
86
87
 
87
88
  #
@@ -90,8 +91,8 @@ module Omnibus
90
91
  # http://docs.oracle.com/cd/E23824_01/html/E21796/pkg-5.html
91
92
  #
92
93
  def fmri_package_name
93
- version = project.build_version.split(/[^\d]/)[0..2].join('.')
94
- platform = Ohai['platform_version']
94
+ version = project.build_version.split(/[^\d]/)[0..2].join(".")
95
+ platform = Ohai["platform_version"]
95
96
  "#{safe_base_package_name}@#{version},#{platform}-#{project.build_iteration}"
96
97
  end
97
98
 
@@ -101,7 +102,7 @@ module Omnibus
101
102
  # @return [String]
102
103
  #
103
104
  def transform_file
104
- @transform_file ||= File.join(staging_dir, 'doc-transform')
105
+ @transform_file ||= File.join(staging_dir, "doc-transform")
105
106
  end
106
107
 
107
108
  #
@@ -110,7 +111,7 @@ module Omnibus
110
111
  # @return [String]
111
112
  #
112
113
  def pkg_metadata_file
113
- @pkg_metadata_file ||= File.join(staging_dir, 'gen.manifestfile')
114
+ @pkg_metadata_file ||= File.join(staging_dir, "gen.manifestfile")
114
115
  end
115
116
 
116
117
  #
@@ -128,7 +129,7 @@ module Omnibus
128
129
  # @return [String]
129
130
  #
130
131
  def repo_dir
131
- @repo_dir ||= File.join(staging_dir, 'publish', 'repo')
132
+ @repo_dir ||= File.join(staging_dir, "publish", "repo")
132
133
  end
133
134
 
134
135
  #
@@ -137,7 +138,7 @@ module Omnibus
137
138
  # @return [String]
138
139
  #
139
140
  def source_dir
140
- @source_dir ||= File.join(staging_dir, 'proto_install')
141
+ @source_dir ||= File.join(staging_dir, "proto_install")
141
142
  end
142
143
 
143
144
  #
@@ -150,7 +151,7 @@ module Omnibus
150
151
  if project.package_name =~ /\A[a-z0-9\.\+\-]+\z/
151
152
  project.package_name.dup
152
153
  else
153
- converted = project.package_name.downcase.gsub(/[^a-z0-9\.\+\-]+/, '-')
154
+ converted = project.package_name.downcase.gsub(/[^a-z0-9\.\+\-]+/, "-")
154
155
 
155
156
  log.warn(log_key) do
156
157
  "The `name' component of IPS package names can only include " \
@@ -169,11 +170,11 @@ module Omnibus
169
170
  #
170
171
  def safe_architecture
171
172
  if intel?
172
- 'i386'
173
+ "i386"
173
174
  elsif sparc?
174
- 'sparc'
175
+ "sparc"
175
176
  else
176
- Ohai['kernel']['machine']
177
+ Ohai["kernel"]["machine"]
177
178
  end
178
179
  end
179
180
 
@@ -184,10 +185,10 @@ module Omnibus
184
185
  # @return [void]
185
186
  #
186
187
  def write_transform_file
187
- render_template(resource_path('doc-transform.erb'),
188
+ render_template(resource_path("doc-transform.erb"),
188
189
  destination: transform_file,
189
190
  variables: {
190
- pathdir: project.install_dir.split('/')[1],
191
+ pathdir: project.install_dir.split("/")[1],
191
192
  }
192
193
  )
193
194
  end
@@ -200,7 +201,7 @@ module Omnibus
200
201
  # @return [void]
201
202
  #
202
203
  def write_pkg_metadata
203
- render_template(resource_path('gen.manifestfile.erb'),
204
+ render_template(resource_path("gen.manifestfile.erb"),
204
205
  destination: pkg_metadata_file,
205
206
  variables: {
206
207
  name: safe_base_package_name,
@@ -264,7 +265,7 @@ module Omnibus
264
265
  def publish_ips_pkg
265
266
  shellout!("pkgrepo -s #{repo_dir} set publisher/prefix=#{publisher_prefix}")
266
267
  shellout!("pkgsend publish -s #{repo_dir} -d #{source_dir} #{pkg_manifest_file}.4.res")
267
- log.info(log_key) { "Published IPS package to repo: #{repo_dir}"}
268
+ log.info(log_key) { "Published IPS package to repo: #{repo_dir}" }
268
269
 
269
270
  repo_info = shellout("pkg list -afv -g #{repo_dir}").stdout
270
271
  log.debug(log_key) do
@@ -286,7 +287,7 @@ module Omnibus
286
287
  # The destination file cannot already exist
287
288
  File.delete(package_path) if File.exist?(package_path)
288
289
  shellout!("pkgrecv -s #{repo_dir} -a -d #{package_path} #{safe_base_package_name}")
289
- log.info(log_key) { "Exported IPS package archive: #{package_path}"}
290
+ log.info(log_key) { "Exported IPS package archive: #{package_path}" }
290
291
 
291
292
  list_pkgarchive = shellout("pkgrepo list -s #{package_path} '*@latest'").stdout
292
293
  log.debug(log_key) do
@@ -19,7 +19,7 @@ module Omnibus
19
19
  # @return [Hash]
20
20
  SCRIPT_MAP = {
21
21
  # Default Omnibus naming
22
- postinst: 'postinst',
22
+ postinst: "postinst",
23
23
  }.freeze
24
24
 
25
25
  id :makeself
@@ -55,7 +55,7 @@ module Omnibus
55
55
  # @return [String]
56
56
  #
57
57
  def makeself
58
- resource_path('makeself.sh')
58
+ resource_path("makeself.sh")
59
59
  end
60
60
 
61
61
  #
@@ -65,7 +65,7 @@ module Omnibus
65
65
  # @return [String]
66
66
  #
67
67
  def makeself_header
68
- resource_path('makeself-header.sh')
68
+ resource_path("makeself-header.sh")
69
69
  end
70
70
 
71
71
  #
@@ -76,8 +76,8 @@ module Omnibus
76
76
  # @return [void]
77
77
  #
78
78
  def write_makeselfinst
79
- makeselfinst_staging_path = File.join(staging_dir, 'makeselfinst')
80
- render_template(resource_path('makeselfinst.erb'),
79
+ makeselfinst_staging_path = File.join(staging_dir, "makeselfinst")
80
+ render_template(resource_path("makeselfinst.erb"),
81
81
  destination: makeselfinst_staging_path,
82
82
  variables: {
83
83
  install_dir: project.install_dir,
@@ -113,7 +113,7 @@ module Omnibus
113
113
  log.info(log_key) { "Creating makeself package" }
114
114
 
115
115
  Dir.chdir(staging_dir) do
116
- shellout! <<-EOH.gsub(/^ {10}/, '')
116
+ shellout! <<-EOH.gsub(/^ {10}/, "")
117
117
  #{makeself} \\
118
118
  --header "#{makeself_header}" \\
119
119
  --gzip \\
@@ -135,7 +135,7 @@ module Omnibus
135
135
  # @return [String]
136
136
  #
137
137
  def safe_architecture
138
- Ohai['kernel']['machine']
138
+ Ohai["kernel"]["machine"]
139
139
  end
140
140
  end
141
141
  end