omnibus 5.4.0 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/CHANGELOG.md +21 -0
- data/Gemfile +8 -5
- data/README.md +3 -1
- data/Rakefile +20 -13
- data/appveyor.yml +4 -3
- data/bin/omnibus +3 -3
- data/features/commands/manifest.feature +19 -5
- data/features/step_definitions/generator_steps.rb +5 -6
- data/features/support/env.rb +4 -4
- data/lib/omnibus/build_version.rb +14 -14
- data/lib/omnibus/build_version_dsl.rb +3 -3
- data/lib/omnibus/builder.rb +50 -61
- data/lib/omnibus/changelog.rb +2 -2
- data/lib/omnibus/changelog_printer.rb +4 -4
- data/lib/omnibus/cleaner.rb +4 -4
- data/lib/omnibus/cli/base.rb +15 -15
- data/lib/omnibus/cli/cache.rb +13 -13
- data/lib/omnibus/cli/changelog.rb +8 -9
- data/lib/omnibus/cli/publish.rb +12 -13
- data/lib/omnibus/cli.rb +26 -27
- data/lib/omnibus/compressor.rb +6 -6
- data/lib/omnibus/compressors/base.rb +7 -2
- data/lib/omnibus/compressors/dmg.rb +12 -12
- data/lib/omnibus/compressors/null.rb +1 -1
- data/lib/omnibus/compressors/tgz.rb +8 -8
- data/lib/omnibus/config.rb +37 -26
- data/lib/omnibus/core_extensions/open_uri.rb +3 -3
- data/lib/omnibus/core_extensions.rb +1 -1
- data/lib/omnibus/digestable.rb +5 -4
- data/lib/omnibus/download_helpers.rb +7 -6
- data/lib/omnibus/exceptions.rb +29 -13
- data/lib/omnibus/fetcher.rb +0 -1
- data/lib/omnibus/fetchers/git_fetcher.rb +7 -7
- data/lib/omnibus/fetchers/net_fetcher.rb +19 -19
- data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
- data/lib/omnibus/file_syncer.rb +3 -3
- data/lib/omnibus/generator.rb +60 -47
- data/lib/omnibus/git_cache.rb +33 -22
- data/lib/omnibus/git_repository.rb +5 -5
- data/lib/omnibus/health_check.rb +122 -119
- data/lib/omnibus/instrumentation.rb +1 -1
- data/lib/omnibus/licensing.rb +348 -60
- data/lib/omnibus/logger.rb +12 -9
- data/lib/omnibus/logging.rb +1 -1
- data/lib/omnibus/manifest.rb +4 -4
- data/lib/omnibus/manifest_diff.rb +6 -7
- data/lib/omnibus/manifest_entry.rb +1 -1
- data/lib/omnibus/metadata.rb +36 -36
- data/lib/omnibus/ohai.rb +6 -7
- data/lib/omnibus/package.rb +1 -1
- data/lib/omnibus/packager.rb +37 -28
- data/lib/omnibus/packagers/appx.rb +86 -0
- data/lib/omnibus/packagers/base.rb +21 -18
- data/lib/omnibus/packagers/bff.rb +22 -24
- data/lib/omnibus/packagers/deb.rb +20 -20
- data/lib/omnibus/packagers/ips.rb +18 -17
- data/lib/omnibus/packagers/makeself.rb +7 -7
- data/lib/omnibus/packagers/msi.rb +38 -193
- data/lib/omnibus/packagers/pkg.rb +16 -16
- data/lib/omnibus/packagers/rpm.rb +53 -54
- data/lib/omnibus/packagers/solaris.rb +14 -14
- data/lib/omnibus/packagers/windows_base.rb +192 -0
- data/lib/omnibus/project.rb +45 -43
- data/lib/omnibus/publisher.rb +3 -3
- data/lib/omnibus/publishers/artifactory_publisher.rb +39 -39
- data/lib/omnibus/publishers/s3_publisher.rb +7 -7
- data/lib/omnibus/reports.rb +10 -10
- data/lib/omnibus/s3_cache.rb +7 -7
- data/lib/omnibus/s3_helpers.rb +8 -7
- data/lib/omnibus/semantic_version.rb +1 -1
- data/lib/omnibus/software.rb +131 -81
- data/lib/omnibus/sugarable.rb +10 -10
- data/lib/omnibus/templating.rb +5 -5
- data/lib/omnibus/thread_pool.rb +1 -1
- data/lib/omnibus/util.rb +5 -5
- data/lib/omnibus/version.rb +1 -1
- data/lib/omnibus.rb +65 -65
- data/omnibus.gemspec +34 -32
- data/resources/appx/AppxManifest.xml.erb +18 -0
- data/resources/appx/assets/clear.png +0 -0
- data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-bundler-audit-0.5.0-COPYING.txt +674 -0
- data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-inifile-3.0.0-README.md +215 -0
- data/spec/fixtures/licensing/license_scout/snoopy/snoopy-dependency-licenses.json +24 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-inifile-3.0.0-README.md +215 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mime-types-3.1-Licence.rdoc +25 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mini_portile2-2.1.0-LICENSE.txt +20 -0
- data/spec/fixtures/licensing/license_scout/zlib/zlib-dependency-licenses.json +32 -0
- data/spec/functional/builder_spec.rb +149 -150
- data/spec/functional/fetchers/git_fetcher_spec.rb +69 -71
- data/spec/functional/fetchers/net_fetcher_spec.rb +79 -79
- data/spec/functional/fetchers/path_fetcher_spec.rb +19 -20
- data/spec/functional/file_syncer_spec.rb +74 -74
- data/spec/functional/licensing_spec.rb +344 -35
- data/spec/functional/templating_spec.rb +17 -17
- data/spec/spec_helper.rb +20 -20
- data/spec/support/examples.rb +21 -15
- data/spec/support/file_helpers.rb +1 -1
- data/spec/support/git_helpers.rb +37 -37
- data/spec/support/matchers.rb +3 -3
- data/spec/support/ohai_helpers.rb +4 -4
- data/spec/support/path_helpers.rb +2 -2
- data/spec/support/shell_helpers.rb +2 -2
- data/spec/unit/build_version_dsl_spec.rb +5 -5
- data/spec/unit/build_version_spec.rb +63 -63
- data/spec/unit/builder_spec.rb +86 -70
- data/spec/unit/changelog_spec.rb +4 -4
- data/spec/unit/changelogprinter_spec.rb +130 -0
- data/spec/unit/cleanroom_spec.rb +11 -11
- data/spec/unit/compressor_spec.rb +16 -16
- data/spec/unit/compressors/base_spec.rb +6 -6
- data/spec/unit/compressors/dmg_spec.rb +76 -76
- data/spec/unit/compressors/null_spec.rb +4 -4
- data/spec/unit/compressors/tgz_spec.rb +20 -20
- data/spec/unit/config_spec.rb +44 -43
- data/spec/unit/digestable_spec.rb +13 -13
- data/spec/unit/fetcher_spec.rb +11 -12
- data/spec/unit/fetchers/git_fetcher_spec.rb +31 -31
- data/spec/unit/fetchers/net_fetcher_spec.rb +172 -173
- data/spec/unit/fetchers/path_fetcher_spec.rb +18 -18
- data/spec/unit/generator_spec.rb +38 -38
- data/spec/unit/git_cache_spec.rb +56 -54
- data/spec/unit/git_repository_spec.rb +2 -2
- data/spec/unit/health_check_spec.rb +40 -40
- data/spec/unit/library_spec.rb +35 -35
- data/spec/unit/manifest_diff_spec.rb +10 -11
- data/spec/unit/manifest_spec.rb +17 -17
- data/spec/unit/metadata_spec.rb +152 -152
- data/spec/unit/ohai_spec.rb +5 -5
- data/spec/unit/omnibus_spec.rb +31 -31
- data/spec/unit/package_spec.rb +20 -20
- data/spec/unit/packager_spec.rb +48 -42
- data/spec/unit/packagers/appx_spec.rb +165 -0
- data/spec/unit/packagers/base_spec.rb +34 -34
- data/spec/unit/packagers/bff_spec.rb +60 -60
- data/spec/unit/packagers/deb_spec.rb +71 -71
- data/spec/unit/packagers/ips_spec.rb +45 -45
- data/spec/unit/packagers/makeself_spec.rb +22 -22
- data/spec/unit/packagers/msi_spec.rb +141 -147
- data/spec/unit/packagers/pkg_spec.rb +59 -60
- data/spec/unit/packagers/rpm_spec.rb +125 -126
- data/spec/unit/packagers/solaris_spec.rb +52 -52
- data/spec/unit/project_spec.rb +137 -135
- data/spec/unit/publisher_spec.rb +70 -70
- data/spec/unit/publishers/artifactory_publisher_spec.rb +85 -85
- data/spec/unit/publishers/s3_publisher_spec.rb +36 -36
- data/spec/unit/s3_cacher_spec.rb +34 -34
- data/spec/unit/s3_helpers_spec.rb +6 -6
- data/spec/unit/semantic_version_spec.rb +2 -2
- data/spec/unit/software_spec.rb +346 -384
- data/spec/unit/sugarable_spec.rb +10 -10
- data/spec/unit/util_spec.rb +60 -60
- metadata +54 -6
- data/.rubocop.yml +0 -48
data/lib/omnibus/cli.rb
CHANGED
@@ -14,8 +14,8 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require
|
18
|
-
require
|
17
|
+
require "thor"
|
18
|
+
require "omnibus"
|
19
19
|
require "ffi_yajl"
|
20
20
|
|
21
21
|
module Omnibus
|
@@ -55,7 +55,7 @@ module Omnibus
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
map %w
|
58
|
+
map %w{-v --version} => "version"
|
59
59
|
|
60
60
|
#
|
61
61
|
# Build an Omnibus project or software definition.
|
@@ -70,7 +70,7 @@ module Omnibus
|
|
70
70
|
desc: "Use the given manifest when downloading software sources.",
|
71
71
|
type: :string,
|
72
72
|
default: nil
|
73
|
-
desc
|
73
|
+
desc "build PROJECT", "Build the given Omnibus project"
|
74
74
|
def build(name)
|
75
75
|
manifest = if @options[:use_manifest]
|
76
76
|
Omnibus::Manifest.from_file(@options[:use_manifest])
|
@@ -84,16 +84,15 @@ module Omnibus
|
|
84
84
|
project.build
|
85
85
|
|
86
86
|
if @options[:output_manifest]
|
87
|
-
FileUtils.mkdir_p(
|
88
|
-
File.open(::File.join(
|
87
|
+
FileUtils.mkdir_p("pkg")
|
88
|
+
File.open(::File.join("pkg", "version-manifest.json"), "w") do |f|
|
89
89
|
f.write(FFI_Yajl::Encoder.encode(project.built_manifest.to_hash))
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
|
95
|
-
|
96
|
-
CLI.tasks['changelog'].options = Command::ChangeLog.class_options
|
94
|
+
register(Command::ChangeLog, "changelog", "changelog [COMMAND]", "Create and view changelogs")
|
95
|
+
CLI.tasks["changelog"].options = Command::ChangeLog.class_options
|
97
96
|
|
98
97
|
#
|
99
98
|
# Generate a version manifest for the given project definition
|
@@ -114,14 +113,14 @@ module Omnibus
|
|
114
113
|
type: :string
|
115
114
|
method_option :architecture,
|
116
115
|
desc: "The target architecture: x86, x64, powerpc. Defaults to the current architecture."
|
117
|
-
desc
|
116
|
+
desc "manifest PROJECT", "Print a manifest for the given Omnibus project"
|
118
117
|
def manifest(name)
|
119
118
|
# Override ohai information
|
120
|
-
Ohai[
|
121
|
-
Ohai[
|
122
|
-
Ohai[
|
123
|
-
Ohai[
|
124
|
-
Ohai[
|
119
|
+
Ohai["os"] = @options[:os] if @options[:os]
|
120
|
+
Ohai["platform_family"] = @options[:platform_family] if @options[:platform_family]
|
121
|
+
Ohai["platform"] = @options[:platform] if @options[:platform]
|
122
|
+
Ohai["platform_version"] = @options[:platform_version] if @options[:platform_version]
|
123
|
+
Ohai["kernel"]["machine"] = @options[:architecture] if @options[:architecture]
|
125
124
|
puts FFI_Yajl::Encoder.encode(Project.load(name).built_manifest.to_hash, pretty: true)
|
126
125
|
end
|
127
126
|
|
@@ -130,36 +129,36 @@ module Omnibus
|
|
130
129
|
#
|
131
130
|
# $ omnibus cache list
|
132
131
|
#
|
133
|
-
register(Command::Cache,
|
134
|
-
CLI.tasks[
|
132
|
+
register(Command::Cache, "cache", "cache [COMMAND]", "Manage the cache")
|
133
|
+
CLI.tasks["cache"].options = Command::Cache.class_options
|
135
134
|
|
136
135
|
#
|
137
136
|
# Clean the Omnibus project.
|
138
137
|
#
|
139
138
|
# $ omnibus clean chefdk
|
140
139
|
#
|
141
|
-
register(Cleaner,
|
142
|
-
CLI.tasks[
|
140
|
+
register(Cleaner, "clean", "clean PROJECT", "Clean the Omnibus project")
|
141
|
+
CLI.tasks["clean"].options = Cleaner.class_options
|
143
142
|
|
144
143
|
#
|
145
144
|
# Initialize a new Omnibus project.
|
146
145
|
#
|
147
146
|
# $ omnibus new NAME
|
148
147
|
#
|
149
|
-
register(Generator,
|
150
|
-
CLI.tasks[
|
148
|
+
register(Generator, "new", "new NAME", "Initialize a new Omnibus project")
|
149
|
+
CLI.tasks["new"].options = Generator.class_options
|
151
150
|
|
152
151
|
#
|
153
152
|
# List the Omnibus projects available from "here".
|
154
153
|
#
|
155
154
|
# $ omnibus list
|
156
155
|
#
|
157
|
-
desc
|
156
|
+
desc "list", "List the Omnibus projects"
|
158
157
|
def list
|
159
158
|
if Omnibus.projects.empty?
|
160
|
-
say(
|
159
|
+
say("There are no Omnibus projects!")
|
161
160
|
else
|
162
|
-
say(
|
161
|
+
say("Omnibus projects:")
|
163
162
|
Omnibus.projects.sort.each do |project|
|
164
163
|
say(" * #{project.name} (#{project.build_version})")
|
165
164
|
end
|
@@ -171,15 +170,15 @@ module Omnibus
|
|
171
170
|
#
|
172
171
|
# $ omnibus publish s3 pkg/*chef*
|
173
172
|
#
|
174
|
-
register(Command::Publish,
|
175
|
-
CLI.tasks[
|
173
|
+
register(Command::Publish, "publish", "publish [COMMAND]", "Publish Omnibus packages to a backend")
|
174
|
+
CLI.tasks["publish"].options = Command::Publish.class_options
|
176
175
|
|
177
176
|
#
|
178
177
|
# Display version information.
|
179
178
|
#
|
180
179
|
# $ omnibus version
|
181
180
|
#
|
182
|
-
desc
|
181
|
+
desc "version", "Display version information", hide: true
|
183
182
|
def version
|
184
183
|
say("Omnibus v#{Omnibus::VERSION}")
|
185
184
|
end
|
data/lib/omnibus/compressor.rb
CHANGED
@@ -18,10 +18,10 @@ module Omnibus
|
|
18
18
|
module Compressor
|
19
19
|
include Logging
|
20
20
|
|
21
|
-
autoload :Base,
|
22
|
-
autoload :DMG,
|
23
|
-
autoload :Null,
|
24
|
-
autoload :TGZ,
|
21
|
+
autoload :Base, "omnibus/compressors/base"
|
22
|
+
autoload :DMG, "omnibus/compressors/dmg"
|
23
|
+
autoload :Null, "omnibus/compressors/null"
|
24
|
+
autoload :TGZ, "omnibus/compressors/tgz"
|
25
25
|
|
26
26
|
#
|
27
27
|
# Determine the best compressor for the current system. This method returns
|
@@ -36,9 +36,9 @@ module Omnibus
|
|
36
36
|
# @return [~Compressor::Base]
|
37
37
|
#
|
38
38
|
def for_current_system(compressors)
|
39
|
-
family = Ohai[
|
39
|
+
family = Ohai["platform_family"]
|
40
40
|
|
41
|
-
if family ==
|
41
|
+
if family == "mac_os_x"
|
42
42
|
if compressors.include?(:dmg)
|
43
43
|
return DMG
|
44
44
|
end
|
@@ -14,7 +14,7 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require
|
17
|
+
require "fileutils"
|
18
18
|
|
19
19
|
module Omnibus
|
20
20
|
class Compressor::Base < Packager::Base
|
@@ -31,7 +31,12 @@ module Omnibus
|
|
31
31
|
#
|
32
32
|
def initialize(project)
|
33
33
|
@project = project
|
34
|
-
|
34
|
+
|
35
|
+
# There can now be multiple packagers per platform
|
36
|
+
# but windows is the only platform that uses multiple
|
37
|
+
# packagers and it does not use a compressor. So for now,
|
38
|
+
# we ignore this multi packaging reality in compressors
|
39
|
+
@packager = project.packagers_for_system[0]
|
35
40
|
end
|
36
41
|
end
|
37
42
|
end
|
@@ -30,7 +30,7 @@ module Omnibus
|
|
30
30
|
|
31
31
|
# Copy support files
|
32
32
|
support = create_directory("#{resources_dir}/.support")
|
33
|
-
copy_file(resource_path(
|
33
|
+
copy_file(resource_path("background.png"), "#{support}/background.png")
|
34
34
|
end
|
35
35
|
|
36
36
|
build do
|
@@ -63,7 +63,7 @@ module Omnibus
|
|
63
63
|
#
|
64
64
|
def window_bounds(val = NULL)
|
65
65
|
if null?(val)
|
66
|
-
@window_bounds ||
|
66
|
+
@window_bounds || "100, 100, 750, 600"
|
67
67
|
else
|
68
68
|
@window_bounds = val
|
69
69
|
end
|
@@ -85,7 +85,7 @@ module Omnibus
|
|
85
85
|
#
|
86
86
|
def pkg_position(val = NULL)
|
87
87
|
if null?(val)
|
88
|
-
@pkg_position ||
|
88
|
+
@pkg_position || "535, 50"
|
89
89
|
else
|
90
90
|
@pkg_position = val
|
91
91
|
end
|
@@ -136,7 +136,7 @@ module Omnibus
|
|
136
136
|
def create_writable_dmg
|
137
137
|
log.info(log_key) { "Creating writable dmg" }
|
138
138
|
|
139
|
-
shellout! <<-EOH.gsub(/^ {8}/,
|
139
|
+
shellout! <<-EOH.gsub(/^ {8}/, "")
|
140
140
|
hdiutil create \\
|
141
141
|
-srcfolder "#{resources_dir}" \\
|
142
142
|
-volname "#{volume_name}" \\
|
@@ -158,7 +158,7 @@ module Omnibus
|
|
158
158
|
@device ||= Dir.chdir(staging_dir) do
|
159
159
|
log.info(log_key) { "Attaching dmg as disk" }
|
160
160
|
|
161
|
-
cmd = shellout! <<-EOH.gsub(/^ {10}/,
|
161
|
+
cmd = shellout! <<-EOH.gsub(/^ {10}/, "")
|
162
162
|
hdiutil attach \\
|
163
163
|
-readwrite \\
|
164
164
|
-noverify \\
|
@@ -178,10 +178,10 @@ module Omnibus
|
|
178
178
|
def set_volume_icon
|
179
179
|
log.info(log_key) { "Setting volume icon" }
|
180
180
|
|
181
|
-
icon = resource_path(
|
181
|
+
icon = resource_path("icon.png")
|
182
182
|
|
183
183
|
Dir.chdir(staging_dir) do
|
184
|
-
shellout! <<-EOH.gsub(/^ {10}/,
|
184
|
+
shellout! <<-EOH.gsub(/^ {10}/, "")
|
185
185
|
# Generate the icns
|
186
186
|
mkdir tmp.iconset
|
187
187
|
sips -z 16 16 #{icon} --out tmp.iconset/icon_16x16.png
|
@@ -213,7 +213,7 @@ module Omnibus
|
|
213
213
|
def prettify_dmg
|
214
214
|
log.info(log_key) { "Making the dmg all pretty and stuff" }
|
215
215
|
|
216
|
-
render_template(resource_path(
|
216
|
+
render_template(resource_path("create_dmg.osascript.erb"),
|
217
217
|
destination: "#{staging_dir}/create_dmg.osascript",
|
218
218
|
variables: {
|
219
219
|
volume_name: volume_name,
|
@@ -224,7 +224,7 @@ module Omnibus
|
|
224
224
|
)
|
225
225
|
|
226
226
|
Dir.chdir(staging_dir) do
|
227
|
-
shellout! <<-EOH.gsub(/^ {10}/,
|
227
|
+
shellout! <<-EOH.gsub(/^ {10}/, "")
|
228
228
|
osascript "#{staging_dir}/create_dmg.osascript"
|
229
229
|
EOH
|
230
230
|
end
|
@@ -239,7 +239,7 @@ module Omnibus
|
|
239
239
|
log.info(log_key) { "Compressing dmg" }
|
240
240
|
|
241
241
|
Dir.chdir(staging_dir) do
|
242
|
-
shellout! <<-EOH.gsub(/^ {10}/,
|
242
|
+
shellout! <<-EOH.gsub(/^ {10}/, "")
|
243
243
|
chmod -Rf go-w /Volumes/#{volume_name}
|
244
244
|
sync
|
245
245
|
hdiutil detach "#{@device}"
|
@@ -263,7 +263,7 @@ module Omnibus
|
|
263
263
|
log.info(log_key) { "Setting dmg icon" }
|
264
264
|
|
265
265
|
Dir.chdir(staging_dir) do
|
266
|
-
shellout! <<-EOH.gsub(/^ {10}/,
|
266
|
+
shellout! <<-EOH.gsub(/^ {10}/, "")
|
267
267
|
# Convert the png to an icon
|
268
268
|
sips -i "#{resource_path('icon.png')}"
|
269
269
|
|
@@ -282,7 +282,7 @@ module Omnibus
|
|
282
282
|
# @see Base#package_name
|
283
283
|
def package_name
|
284
284
|
extname = File.extname(packager.package_name)
|
285
|
-
packager.package_name.sub(extname,
|
285
|
+
packager.package_name.sub(extname, ".dmg")
|
286
286
|
end
|
287
287
|
|
288
288
|
# The path to the writable dmg on disk.
|
@@ -14,8 +14,8 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require
|
18
|
-
require
|
17
|
+
require "rubygems/package"
|
18
|
+
require "zlib"
|
19
19
|
|
20
20
|
module Omnibus
|
21
21
|
class Compressor::TGZ < Compressor::Base
|
@@ -51,11 +51,11 @@ module Omnibus
|
|
51
51
|
@compression_level || Zlib::BEST_COMPRESSION
|
52
52
|
else
|
53
53
|
unless val.is_a?(Integer)
|
54
|
-
raise InvalidValue.new(:compression_level,
|
54
|
+
raise InvalidValue.new(:compression_level, "be an Integer")
|
55
55
|
end
|
56
56
|
|
57
57
|
unless val.between?(1, 9)
|
58
|
-
raise InvalidValue.new(:compression_level,
|
58
|
+
raise InvalidValue.new(:compression_level, "be between 1-9")
|
59
59
|
end
|
60
60
|
|
61
61
|
@compression_level = val
|
@@ -85,7 +85,7 @@ module Omnibus
|
|
85
85
|
contents = gzipped_tarball
|
86
86
|
|
87
87
|
# Write the .tar.gz into the staging directory
|
88
|
-
File.open("#{staging_dir}/#{package_name}",
|
88
|
+
File.open("#{staging_dir}/#{package_name}", "wb") do |tgz|
|
89
89
|
while chunk = contents.read(1024)
|
90
90
|
tgz.write(chunk)
|
91
91
|
end
|
@@ -103,14 +103,14 @@ module Omnibus
|
|
103
103
|
# @return [StringIO]
|
104
104
|
#
|
105
105
|
def tarball
|
106
|
-
tarfile = StringIO.new(
|
106
|
+
tarfile = StringIO.new("")
|
107
107
|
Gem::Package::TarWriter.new(tarfile) do |tar|
|
108
108
|
path = "#{staging_dir}/#{packager.package_name}"
|
109
109
|
name = packager.package_name
|
110
110
|
mode = File.stat(path).mode
|
111
111
|
|
112
112
|
tar.add_file(name, mode) do |tf|
|
113
|
-
File.open(path,
|
113
|
+
File.open(path, "rb") do |file|
|
114
114
|
tf.write(file.read)
|
115
115
|
end
|
116
116
|
end
|
@@ -128,7 +128,7 @@ module Omnibus
|
|
128
128
|
# @return [StringIO]
|
129
129
|
#
|
130
130
|
def gzipped_tarball
|
131
|
-
gz = StringIO.new(
|
131
|
+
gz = StringIO.new("")
|
132
132
|
z = Zlib::GzipWriter.new(gz, compression_level)
|
133
133
|
z.write(tarball.string)
|
134
134
|
z.close
|
data/lib/omnibus/config.rb
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require
|
17
|
+
require "singleton"
|
18
18
|
|
19
19
|
module Omnibus
|
20
20
|
class Config
|
@@ -100,10 +100,10 @@ module Omnibus
|
|
100
100
|
#
|
101
101
|
# @return [String]
|
102
102
|
default(:base_dir) do
|
103
|
-
if Ohai[
|
104
|
-
|
103
|
+
if Ohai["platform"] == "windows"
|
104
|
+
"C:/omnibus-ruby"
|
105
105
|
else
|
106
|
-
|
106
|
+
"/var/cache/omnibus"
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
@@ -111,39 +111,39 @@ module Omnibus
|
|
111
111
|
# code will be cached.
|
112
112
|
#
|
113
113
|
# @return [String]
|
114
|
-
default(:cache_dir) { File.join(base_dir,
|
114
|
+
default(:cache_dir) { File.join(base_dir, "cache") }
|
115
115
|
|
116
116
|
# The absolute path to the directory on the virtual machine where
|
117
117
|
# git caching will occur and software's will be progressively cached.
|
118
118
|
#
|
119
119
|
# @return [String]
|
120
120
|
default(:git_cache_dir) do
|
121
|
-
File.join(base_dir,
|
121
|
+
File.join(base_dir, "cache", "git_cache")
|
122
122
|
end
|
123
123
|
|
124
124
|
# The absolute path to the directory on the virtual machine where
|
125
125
|
# source code will be downloaded.
|
126
126
|
#
|
127
127
|
# @return [String]
|
128
|
-
default(:source_dir) { File.join(base_dir,
|
128
|
+
default(:source_dir) { File.join(base_dir, "src") }
|
129
129
|
|
130
130
|
# The absolute path to the directory on the virtual machine where
|
131
131
|
# software will be built.
|
132
132
|
#
|
133
133
|
# @return [String]
|
134
|
-
default(:build_dir) { File.join(base_dir,
|
134
|
+
default(:build_dir) { File.join(base_dir, "build") }
|
135
135
|
|
136
136
|
# The absolute path to the directory on the virtual machine where
|
137
137
|
# packages will be constructed.
|
138
138
|
#
|
139
139
|
# @return [String]
|
140
|
-
default(:package_dir) { File.join(base_dir,
|
140
|
+
default(:package_dir) { File.join(base_dir, "pkg") }
|
141
141
|
|
142
142
|
# @deprecated Do not use this method.
|
143
143
|
#
|
144
144
|
# @return [String]
|
145
145
|
default(:package_tmp) do
|
146
|
-
Omnibus.logger.deprecated(
|
146
|
+
Omnibus.logger.deprecated("Config") do
|
147
147
|
"Config.package_tmp. This value is no longer used."
|
148
148
|
end
|
149
149
|
end
|
@@ -152,13 +152,13 @@ module Omnibus
|
|
152
152
|
# DSL files. This is relative to {#project_root}.
|
153
153
|
#
|
154
154
|
# @return [String]
|
155
|
-
default(:project_dir,
|
155
|
+
default(:project_dir, "config/projects")
|
156
156
|
|
157
157
|
# The relative path of the directory containing {Omnibus::Software}
|
158
158
|
# DSL files. This is relative {#project_root}.
|
159
159
|
#
|
160
160
|
# @return [String]
|
161
|
-
default(:software_dir,
|
161
|
+
default(:software_dir, "config/software")
|
162
162
|
|
163
163
|
# The root directory in which to look for {Omnibus::Project} and
|
164
164
|
# {Omnibus::Software} DSL files.
|
@@ -178,7 +178,7 @@ module Omnibus
|
|
178
178
|
#
|
179
179
|
# @return [true, false]
|
180
180
|
default(:build_dmg) do
|
181
|
-
Omnibus.logger.deprecated(
|
181
|
+
Omnibus.logger.deprecated("Config") do
|
182
182
|
"Config.build_dmg. This value is no longer part of the " \
|
183
183
|
"config and is implied when defining a `compressor' block in the project."
|
184
184
|
end
|
@@ -188,7 +188,7 @@ module Omnibus
|
|
188
188
|
#
|
189
189
|
# @return [String]
|
190
190
|
default(:dmg_window_bounds) do
|
191
|
-
Omnibus.logger.deprecated(
|
191
|
+
Omnibus.logger.deprecated("Config") do
|
192
192
|
"Config.dmg_window_bounds. This value is no longer part of the " \
|
193
193
|
"config and should be defined in the `compressor' block in the project."
|
194
194
|
end
|
@@ -199,7 +199,7 @@ module Omnibus
|
|
199
199
|
#
|
200
200
|
# @return [String]
|
201
201
|
default(:dmg_pkg_position) do
|
202
|
-
Omnibus.logger.deprecated(
|
202
|
+
Omnibus.logger.deprecated("Config") do
|
203
203
|
"Config.dmg_pkg_position. This value is no longer part of the " \
|
204
204
|
"config and should be defined in the `compressor' block in the project."
|
205
205
|
end
|
@@ -209,7 +209,7 @@ module Omnibus
|
|
209
209
|
#
|
210
210
|
# @return [true, false]
|
211
211
|
default(:sign_pkg) do
|
212
|
-
Omnibus.logger.deprecated(
|
212
|
+
Omnibus.logger.deprecated("Config") do
|
213
213
|
"Config.sign_pkg. This value is no longer part of the config and " \
|
214
214
|
"should be defined in the `package' block in the project."
|
215
215
|
end
|
@@ -219,7 +219,7 @@ module Omnibus
|
|
219
219
|
#
|
220
220
|
# @return [String]
|
221
221
|
default(:signing_identity) do
|
222
|
-
Omnibus.logger.deprecated(
|
222
|
+
Omnibus.logger.deprecated("Config") do
|
223
223
|
"Config.signing_identity. This value is no longer part of the " \
|
224
224
|
"config and should be defined in the `package' block in the project."
|
225
225
|
end
|
@@ -237,7 +237,7 @@ module Omnibus
|
|
237
237
|
#
|
238
238
|
# @return [true, false]
|
239
239
|
default(:sign_rpm) do
|
240
|
-
Omnibus.logger.deprecated(
|
240
|
+
Omnibus.logger.deprecated("Config") do
|
241
241
|
"Config.sign_rpm. This value is no longer part of the config and " \
|
242
242
|
"should be defined in the `package' block in the project."
|
243
243
|
end
|
@@ -247,7 +247,7 @@ module Omnibus
|
|
247
247
|
#
|
248
248
|
# @return [String]
|
249
249
|
default(:rpm_signing_passphrase) do
|
250
|
-
Omnibus.logger.deprecated(
|
250
|
+
Omnibus.logger.deprecated("Config") do
|
251
251
|
"Config.rpm_signing_passphrase. This value is no longer part of the " \
|
252
252
|
"config and should be defined in the `package' block in the project."
|
253
253
|
end
|
@@ -294,7 +294,7 @@ module Omnibus
|
|
294
294
|
#
|
295
295
|
# @return [String]
|
296
296
|
default(:s3_region) do
|
297
|
-
|
297
|
+
"us-east-1"
|
298
298
|
end
|
299
299
|
|
300
300
|
# --------------------------------------------------
|
@@ -437,7 +437,7 @@ module Omnibus
|
|
437
437
|
#
|
438
438
|
# @return [Array<String>]
|
439
439
|
default(:software_gems) do
|
440
|
-
[
|
440
|
+
["omnibus-software"]
|
441
441
|
end
|
442
442
|
|
443
443
|
# Solaris linker mapfile to use, if needed
|
@@ -446,7 +446,7 @@ module Omnibus
|
|
446
446
|
#
|
447
447
|
# For example:
|
448
448
|
#
|
449
|
-
# /PATH/files/my_map_file
|
449
|
+
# /PATH/files/my_map_file
|
450
450
|
#
|
451
451
|
# @return [String, nil]
|
452
452
|
default(:solaris_linker_mapfile, "files/mapfiles/solaris")
|
@@ -460,8 +460,8 @@ module Omnibus
|
|
460
460
|
#
|
461
461
|
# @return [:x86, :x64]
|
462
462
|
default(:windows_arch) do
|
463
|
-
if Ohai[
|
464
|
-
Omnibus.logger.deprecated(
|
463
|
+
if Ohai["kernel"]["machine"] == "x86_64"
|
464
|
+
Omnibus.logger.deprecated("Config") do
|
465
465
|
"windows_arch is defaulting to :x86. In Omnibus 5, it will " \
|
466
466
|
"default to :x64 if the machine architecture is x86_64. " \
|
467
467
|
"If you would like to continue building 32 bit packages, please "\
|
@@ -502,13 +502,24 @@ module Omnibus
|
|
502
502
|
#
|
503
503
|
# @return [Integer]
|
504
504
|
default(:workers) do
|
505
|
-
if Ohai[
|
506
|
-
Ohai[
|
505
|
+
if Ohai["cpu"] && Ohai["cpu"]["total"]
|
506
|
+
Ohai["cpu"]["total"].to_i + 1
|
507
507
|
else
|
508
508
|
3
|
509
509
|
end
|
510
510
|
end
|
511
511
|
|
512
|
+
# Fail the build or warn when build encounters a licensing warning.
|
513
|
+
#
|
514
|
+
# @return [true, false]
|
515
|
+
default(:fatal_licensing_warnings, false)
|
516
|
+
|
517
|
+
# Fail the build or warn when build encounters a transitive dependency
|
518
|
+
# licensing warning.
|
519
|
+
#
|
520
|
+
# @return [true, false]
|
521
|
+
default(:fatal_transitive_dependency_licensing_warnings, false)
|
522
|
+
|
512
523
|
# --------------------------------------------------
|
513
524
|
# @!endgroup
|
514
525
|
#
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "open-uri"
|
2
2
|
|
3
3
|
module OpenURI
|
4
4
|
class << self
|
@@ -13,7 +13,7 @@ module OpenURI
|
|
13
13
|
def default_redirectable?(uri1, uri2)
|
14
14
|
a, b = uri1.scheme.downcase, uri2.scheme.downcase
|
15
15
|
|
16
|
-
a == b || (a ==
|
16
|
+
a == b || (a == "http" && b == "https")
|
17
17
|
end
|
18
18
|
alias_method :redirectable?, :default_redirectable?
|
19
19
|
|
@@ -28,7 +28,7 @@ module OpenURI
|
|
28
28
|
def unsafe_redirectable?(uri1, uri2)
|
29
29
|
a, b = uri1.scheme.downcase, uri2.scheme.downcase
|
30
30
|
|
31
|
-
a == b || (a ==
|
31
|
+
a == b || (a == "http" && b == "https") || (a == "https" && b == "http")
|
32
32
|
end
|
33
33
|
|
34
34
|
#
|
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require "omnibus/core_extensions/open_uri"
|
data/lib/omnibus/digestable.rb
CHANGED
@@ -14,9 +14,9 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
17
|
+
require "openssl"
|
18
|
+
require "pathname"
|
19
|
+
require "omnibus/logging"
|
20
20
|
|
21
21
|
module Omnibus
|
22
22
|
module Digestable
|
@@ -24,6 +24,7 @@ module Omnibus
|
|
24
24
|
def self.included(other)
|
25
25
|
other.send(:include, Logging)
|
26
26
|
end
|
27
|
+
|
27
28
|
#
|
28
29
|
# Calculate the digest of the file at the given path. Files are read in
|
29
30
|
# binary chunks to prevent Ruby from exploding.
|
@@ -78,7 +79,7 @@ module Omnibus
|
|
78
79
|
relative = Pathname.new(filename).relative_path_from(Pathname.new(path))
|
79
80
|
|
80
81
|
case ftype = File.ftype(filename)
|
81
|
-
when
|
82
|
+
when "file"
|
82
83
|
update_with_string(digest, "#{ftype} #{relative}")
|
83
84
|
update_with_file_contents(digest, filename)
|
84
85
|
else
|
@@ -14,8 +14,8 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require
|
18
|
-
require
|
17
|
+
require "open-uri"
|
18
|
+
require "ruby-progressbar"
|
19
19
|
|
20
20
|
module Omnibus
|
21
21
|
module DownloadHelpers
|
@@ -25,6 +25,7 @@ module Omnibus
|
|
25
25
|
|
26
26
|
module InstanceMethods
|
27
27
|
private
|
28
|
+
|
28
29
|
#
|
29
30
|
# Downloads a from a given url to a given path using Ruby's
|
30
31
|
# +OpenURI+ implementation.
|
@@ -62,8 +63,8 @@ module Omnibus
|
|
62
63
|
if enable_progress_bar
|
63
64
|
progress_bar = ProgressBar.create(
|
64
65
|
output: $stdout,
|
65
|
-
format:
|
66
|
-
rate_scale: ->(rate) { rate / 1024 }
|
66
|
+
format: "%e %B %p%% (%r KB/sec)",
|
67
|
+
rate_scale: ->(rate) { rate / 1024 }
|
67
68
|
)
|
68
69
|
|
69
70
|
options[:content_length_proc] = ->(total) {
|
@@ -71,7 +72,7 @@ module Omnibus
|
|
71
72
|
progress_bar.total = total
|
72
73
|
}
|
73
74
|
options[:progress_proc] = ->(step) {
|
74
|
-
downloaded_amount = [step, reported_total].min
|
75
|
+
downloaded_amount = reported_total ? [step, reported_total].min : step
|
75
76
|
progress_bar.progress = downloaded_amount
|
76
77
|
}
|
77
78
|
end
|
@@ -129,7 +130,7 @@ module Omnibus
|
|
129
130
|
#
|
130
131
|
# TL;DR - Do not let Ruby ungzip our file
|
131
132
|
#
|
132
|
-
h[
|
133
|
+
h["Accept-Encoding"] = "identity"
|
133
134
|
end
|
134
135
|
end
|
135
136
|
end
|