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/builder.rb
CHANGED
@@ -14,10 +14,10 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
17
|
+
require "fileutils"
|
18
|
+
require "mixlib/shellout"
|
19
|
+
require "ostruct"
|
20
|
+
require "pathname"
|
21
21
|
|
22
22
|
module Omnibus
|
23
23
|
class Builder
|
@@ -111,37 +111,41 @@ module Omnibus
|
|
111
111
|
|
112
112
|
make = options.delete(:bin) ||
|
113
113
|
# Prefer gmake on non-windows environments.
|
114
|
-
if !windows? && Omnibus.which(
|
114
|
+
if !windows? && Omnibus.which("gmake")
|
115
115
|
env = options.delete(:env) || {}
|
116
|
-
env = {
|
116
|
+
env = { "MAKE" => "gmake" }.merge(env)
|
117
117
|
options[:env] = env
|
118
|
-
|
118
|
+
"gmake"
|
119
119
|
else
|
120
|
-
|
120
|
+
"make"
|
121
121
|
end
|
122
122
|
|
123
123
|
options[:in_msys_bash] = true
|
124
|
-
make_cmd = ([make] + args).join(
|
124
|
+
make_cmd = ([make] + args).join(" ").strip
|
125
125
|
command(make_cmd, options)
|
126
126
|
end
|
127
127
|
expose :make
|
128
128
|
|
129
129
|
# Run a prexisting "./configure" script that was generated by autotools.
|
130
130
|
# On windows, this will run configure within an msys bash shell with
|
131
|
-
# the given arguments. --
|
131
|
+
# the given arguments. --build is also set on your behalf based on
|
132
132
|
# windows_arch. A default prefix of "#{install_bin}/embedded" is
|
133
|
-
# appended.
|
133
|
+
# appended. It is important to set --build rather than --host because
|
134
|
+
# by default, --build also sets --host but it doesn't trigger
|
135
|
+
# "cross-compilation" mode in most configure scripts. Triggering this mode
|
136
|
+
# can confuse certain software projects like Ruby which depend on the
|
137
|
+
# build platform in its mkmf scripts.
|
134
138
|
#
|
135
139
|
# @example With no arguments
|
136
140
|
# configure
|
137
141
|
# On POSIX systems, this results in:
|
138
142
|
# ./configure --prefix=/path/to/embedded
|
139
143
|
# On Windows 64-bit, this results in:
|
140
|
-
# ./configure --
|
144
|
+
# ./configure --build=x86_64-w64-mingw32 --prefix=C:/path/to/embedded
|
141
145
|
# Note that the windows case uses a windows compabile path with forward
|
142
146
|
# slashes - not an msys path. Ensure that the final Makefile is happy
|
143
147
|
# with this and doesn't perform path gymnastics on it. Don't pass
|
144
|
-
# \\ paths unless you particularly enjoy discovering exactly
|
148
|
+
# \\ paths unless you particularly enjoy discovering exactly how many
|
145
149
|
# times configure and the Makefile it generates sends your path back
|
146
150
|
# and forth through bash/sh, mingw32 native binaries and msys binaries
|
147
151
|
# and how many backslashes it takes for you to quit software development.
|
@@ -162,20 +166,25 @@ module Omnibus
|
|
162
166
|
def configure(*args)
|
163
167
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
164
168
|
|
165
|
-
configure = options.delete(:bin) ||
|
169
|
+
configure = options.delete(:bin) || "./configure"
|
166
170
|
configure_cmd = [configure]
|
167
171
|
|
168
|
-
# Pass the host platform as well.
|
169
|
-
#
|
170
|
-
|
172
|
+
# Pass the host platform as well. Different versions of config.guess
|
173
|
+
# arrive at differently terrible wild ass guesses for what MSYSTEM=MINGW64
|
174
|
+
# means. This can be anything from x86_64-pc-mingw64 to i686-pc-mingw32
|
175
|
+
# which doesn't even make any sense...
|
176
|
+
if windows?
|
177
|
+
platform = windows_arch_i386? ? "i686-w64-mingw32" : "x86_64-w64-mingw32"
|
178
|
+
configure_cmd << "--build=#{platform}"
|
179
|
+
end
|
171
180
|
|
172
181
|
# Accept a prefix override if provided. Can be set to '' to suppress
|
173
182
|
# this functionality.
|
174
183
|
prefix = options.delete(:prefix) || "#{install_dir}/embedded"
|
175
|
-
configure_cmd << "--prefix=#{prefix}" if prefix && prefix !=
|
184
|
+
configure_cmd << "--prefix=#{prefix}" if prefix && prefix != ""
|
176
185
|
|
177
186
|
configure_cmd.concat args
|
178
|
-
configure_cmd = configure_cmd.join(
|
187
|
+
configure_cmd = configure_cmd.join(" ").strip
|
179
188
|
|
180
189
|
options[:in_msys_bash] = true
|
181
190
|
command(configure_cmd, options)
|
@@ -212,7 +221,7 @@ module Omnibus
|
|
212
221
|
plevel = options.delete(:plevel) || 1
|
213
222
|
target = options.delete(:target)
|
214
223
|
|
215
|
-
locations, patch_path = find_file(
|
224
|
+
locations, patch_path = find_file("config/patches", source)
|
216
225
|
|
217
226
|
unless patch_path
|
218
227
|
raise MissingPatch.new(source, locations)
|
@@ -288,7 +297,7 @@ module Omnibus
|
|
288
297
|
#
|
289
298
|
def ruby(command, options = {})
|
290
299
|
build_commands << BuildCommand.new("ruby `#{command}'") do
|
291
|
-
bin = embedded_bin(
|
300
|
+
bin = embedded_bin("ruby")
|
292
301
|
shellout!("#{bin} #{command}", options)
|
293
302
|
end
|
294
303
|
end
|
@@ -305,7 +314,7 @@ module Omnibus
|
|
305
314
|
#
|
306
315
|
def gem(command, options = {})
|
307
316
|
build_commands << BuildCommand.new("gem `#{command}'") do
|
308
|
-
bin = embedded_bin(
|
317
|
+
bin = embedded_bin("gem")
|
309
318
|
shellout!("#{bin} #{command}", options)
|
310
319
|
end
|
311
320
|
end
|
@@ -325,7 +334,7 @@ module Omnibus
|
|
325
334
|
#
|
326
335
|
def bundle(command, options = {})
|
327
336
|
build_commands << BuildCommand.new("bundle `#{command}'") do
|
328
|
-
bin = embedded_bin(
|
337
|
+
bin = embedded_bin("bundle")
|
329
338
|
shellout!("#{bin} #{command}", options)
|
330
339
|
end
|
331
340
|
end
|
@@ -354,7 +363,7 @@ module Omnibus
|
|
354
363
|
end
|
355
364
|
|
356
365
|
bin_dir = "#{install_dir}/bin"
|
357
|
-
appbundler_bin = embedded_bin(
|
366
|
+
appbundler_bin = embedded_bin("appbundler")
|
358
367
|
|
359
368
|
# Ensure the main bin dir exists
|
360
369
|
FileUtils.mkdir_p(bin_dir)
|
@@ -376,7 +385,7 @@ module Omnibus
|
|
376
385
|
#
|
377
386
|
def rake(command, options = {})
|
378
387
|
build_commands << BuildCommand.new("rake `#{command}'") do
|
379
|
-
bin = embedded_bin(
|
388
|
+
bin = embedded_bin("rake")
|
380
389
|
shellout!("#{bin} #{command}", options)
|
381
390
|
end
|
382
391
|
end
|
@@ -400,7 +409,7 @@ module Omnibus
|
|
400
409
|
# @param (see #command)
|
401
410
|
# @return (see #command)
|
402
411
|
#
|
403
|
-
def block(name =
|
412
|
+
def block(name = "<Dynamic Ruby block>", &proc)
|
404
413
|
build_commands << BuildCommand.new(name, &proc)
|
405
414
|
end
|
406
415
|
expose :block
|
@@ -442,7 +451,7 @@ module Omnibus
|
|
442
451
|
raise "Missing required option `:source'!" unless source
|
443
452
|
raise "Missing required option `:dest'!" unless dest
|
444
453
|
|
445
|
-
locations, source_path = find_file(
|
454
|
+
locations, source_path = find_file("config/templates", source)
|
446
455
|
|
447
456
|
unless source_path
|
448
457
|
raise MissingTemplate.new(source, locations)
|
@@ -454,7 +463,7 @@ module Omnibus
|
|
454
463
|
render_template(source_path,
|
455
464
|
destination: dest,
|
456
465
|
mode: mode,
|
457
|
-
variables: vars
|
466
|
+
variables: vars
|
458
467
|
)
|
459
468
|
end
|
460
469
|
end
|
@@ -556,7 +565,7 @@ module Omnibus
|
|
556
565
|
Dir.chdir(software.project_dir) do
|
557
566
|
files = FileSyncer.glob(source)
|
558
567
|
if files.empty?
|
559
|
-
log.warn(log_key) {"no matched files for glob #{command}"}
|
568
|
+
log.warn(log_key) { "no matched files for glob #{command}" }
|
560
569
|
else
|
561
570
|
files.each do |file|
|
562
571
|
FileUtils.cp_r(file, destination, options)
|
@@ -585,7 +594,7 @@ module Omnibus
|
|
585
594
|
Dir.chdir(software.project_dir) do
|
586
595
|
files = FileSyncer.glob(source)
|
587
596
|
if files.empty?
|
588
|
-
log.warn(log_key) {"no matched files for glob #{command}"}
|
597
|
+
log.warn(log_key) { "no matched files for glob #{command}" }
|
589
598
|
else
|
590
599
|
files.each do |file|
|
591
600
|
FileUtils.mv(file, destination, options)
|
@@ -614,7 +623,7 @@ module Omnibus
|
|
614
623
|
Dir.chdir(software.project_dir) do
|
615
624
|
files = FileSyncer.glob(source)
|
616
625
|
if files.empty?
|
617
|
-
log.warn(log_key) {"no matched files for glob #{command}"}
|
626
|
+
log.warn(log_key) { "no matched files for glob #{command}" }
|
618
627
|
else
|
619
628
|
files.each do |file|
|
620
629
|
FileUtils.ln_s(file, destination, options)
|
@@ -689,9 +698,9 @@ module Omnibus
|
|
689
698
|
# @return [void]
|
690
699
|
#
|
691
700
|
def build
|
692
|
-
log.info(log_key) {
|
701
|
+
log.info(log_key) { "Starting build" }
|
693
702
|
shasum # ensure shashum is calculated before build since the build can alter the shasum
|
694
|
-
log.internal(log_key) { "Cached builder checksum before build: #{shasum}"}
|
703
|
+
log.internal(log_key) { "Cached builder checksum before build: #{shasum}" }
|
695
704
|
if software.overridden?
|
696
705
|
log.info(log_key) do
|
697
706
|
"Version overridden from #{software.default_version} to "\
|
@@ -705,7 +714,7 @@ module Omnibus
|
|
705
714
|
end
|
706
715
|
end
|
707
716
|
|
708
|
-
log.info(log_key) {
|
717
|
+
log.info(log_key) { "Finished build" }
|
709
718
|
end
|
710
719
|
|
711
720
|
#
|
@@ -744,14 +753,6 @@ module Omnibus
|
|
744
753
|
|
745
754
|
private
|
746
755
|
|
747
|
-
def embedded_bin(bin)
|
748
|
-
windows_safe_path("#{install_dir}/embedded/bin/#{bin}")
|
749
|
-
end
|
750
|
-
|
751
|
-
def embedded_msys_bin(bin)
|
752
|
-
windows_safe_path("#{install_dir}/embedded/msys/1.0/bin/#{bin}")
|
753
|
-
end
|
754
|
-
|
755
756
|
#
|
756
757
|
# The **in-order** list of {BuildCommand} for this builder.
|
757
758
|
#
|
@@ -796,23 +797,11 @@ module Omnibus
|
|
796
797
|
options = { cwd: software.project_dir }.merge(options)
|
797
798
|
|
798
799
|
if options.delete(:in_msys_bash) && windows?
|
799
|
-
# The command needs to be run within an msys bash environment.
|
800
|
-
# TODO: Eventually, have command search through "build time dependencies"
|
801
|
-
# for bash instead.
|
802
|
-
bash_bin = embedded_msys_bin('bash.exe')
|
803
|
-
unless File.exist?(bash_bin)
|
804
|
-
# Fallback to just looking at the embedded_bin directory in case
|
805
|
-
# we're using devkit or older chef-dk.
|
806
|
-
bash_bin = embedded_bin('bash.exe')
|
807
|
-
unless File.exist?(bash_bin)
|
808
|
-
bash_bin = "bash.exe"
|
809
|
-
end
|
810
|
-
end
|
811
800
|
# Mixlib will handle escaping characters for cmd but our command might
|
812
801
|
# contain '. For now, assume that won't happen because I don't know
|
813
802
|
# whether this command is going to be played via cmd or through
|
814
803
|
# ProcessCreate.
|
815
|
-
command_string = "
|
804
|
+
command_string = "bash -c \'#{command_string}\'"
|
816
805
|
end
|
817
806
|
|
818
807
|
# Set the log level to :info so users will see build commands
|
@@ -862,7 +851,7 @@ module Omnibus
|
|
862
851
|
exceptions = [CommandFailed, CommandTimeout]
|
863
852
|
|
864
853
|
begin
|
865
|
-
|
854
|
+
yield
|
866
855
|
rescue *exceptions => e
|
867
856
|
if tries <= 0
|
868
857
|
raise e
|
@@ -907,12 +896,12 @@ module Omnibus
|
|
907
896
|
def with_clean_env(&block)
|
908
897
|
original = ENV.to_hash
|
909
898
|
|
910
|
-
ENV.delete(
|
911
|
-
ENV.delete_if { |k,_| k.start_with?(
|
912
|
-
ENV.delete_if { |k,_| k.start_with?(
|
913
|
-
ENV.delete_if { |k,_| k.start_with?(
|
899
|
+
ENV.delete("_ORIGINAL_GEM_PATH")
|
900
|
+
ENV.delete_if { |k, _| k.start_with?("BUNDLE_") }
|
901
|
+
ENV.delete_if { |k, _| k.start_with?("GEM_") }
|
902
|
+
ENV.delete_if { |k, _| k.start_with?("RUBY") }
|
914
903
|
|
915
|
-
|
904
|
+
yield
|
916
905
|
ensure
|
917
906
|
ENV.replace(original.to_hash)
|
918
907
|
end
|
data/lib/omnibus/changelog.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require "omnibus/git_repository"
|
2
2
|
|
3
3
|
module Omnibus
|
4
4
|
class ChangeLog
|
5
5
|
CHANGELOG_TAG = "ChangeLog-Entry"
|
6
6
|
|
7
7
|
attr_reader :end_ref
|
8
|
-
def initialize(start_ref=nil, end_ref="HEAD", git_repo=GitRepository.new(
|
8
|
+
def initialize(start_ref = nil, end_ref = "HEAD", git_repo = GitRepository.new("./"))
|
9
9
|
@start_ref = start_ref
|
10
10
|
@end_ref = end_ref
|
11
11
|
@git_repo = git_repo
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Omnibus
|
2
2
|
class ChangeLogPrinter
|
3
3
|
|
4
|
-
def initialize(changelog, diff, source_path="../")
|
4
|
+
def initialize(changelog, diff, source_path = "../")
|
5
5
|
@changelog = changelog
|
6
6
|
@diff = diff
|
7
7
|
@source_path = source_path
|
@@ -21,7 +21,7 @@ module Omnibus
|
|
21
21
|
|
22
22
|
attr_reader :changelog, :diff, :source_path
|
23
23
|
|
24
|
-
def print_changelog(cl=changelog, indent=0)
|
24
|
+
def print_changelog(cl = changelog, indent = 0)
|
25
25
|
cl.changelog_entries.each do |entry|
|
26
26
|
puts "#{' ' * indent}* #{entry.sub("\n", "\n #{' ' * indent}")}\n"
|
27
27
|
end
|
@@ -49,8 +49,8 @@ module Omnibus
|
|
49
49
|
diff.updated.each do |entry|
|
50
50
|
puts sprintf("* %s (%.8s -> %.8s)",
|
51
51
|
entry[:name], entry[:old_version], entry[:new_version])
|
52
|
-
repo_path = ::File.join(source_path, entry[:name])
|
53
|
-
if entry[:source_type] ==
|
52
|
+
repo_path = ::File.join(source_path, entry[:name].to_s)
|
53
|
+
if entry[:source_type] == :git && ::File.directory?("#{repo_path}/.git")
|
54
54
|
cl = ChangeLog.new(entry[:old_version], entry[:new_version], GitRepository.new("#{repo_path}"))
|
55
55
|
print_changelog(cl, 2)
|
56
56
|
end
|
data/lib/omnibus/cleaner.rb
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require
|
17
|
+
require "thor"
|
18
18
|
|
19
19
|
module Omnibus
|
20
20
|
class Cleaner < Thor::Group
|
@@ -23,13 +23,13 @@ module Omnibus
|
|
23
23
|
namespace :clean
|
24
24
|
|
25
25
|
argument :name,
|
26
|
-
banner:
|
27
|
-
desc:
|
26
|
+
banner: "NAME",
|
27
|
+
desc: "The name of the Omnibus project",
|
28
28
|
type: :string,
|
29
29
|
required: true
|
30
30
|
|
31
31
|
class_option :purge,
|
32
|
-
desc:
|
32
|
+
desc: "Purge the packages and caches",
|
33
33
|
type: :boolean,
|
34
34
|
default: false
|
35
35
|
|
data/lib/omnibus/cli/base.rb
CHANGED
@@ -27,7 +27,7 @@ module Omnibus
|
|
27
27
|
# argument and blows up...
|
28
28
|
if args.length > 1 && !(args & Thor::HELP_MAPPINGS).empty?
|
29
29
|
args = args - Thor::HELP_MAPPINGS
|
30
|
-
args.insert(-2,
|
30
|
+
args.insert(-2, "help")
|
31
31
|
end
|
32
32
|
|
33
33
|
super
|
@@ -45,8 +45,8 @@ module Omnibus
|
|
45
45
|
end
|
46
46
|
|
47
47
|
# Do not load the Omnibus config if we are asking for help or the version
|
48
|
-
if %w
|
49
|
-
log.debug(log_key) {
|
48
|
+
if %w{help version}.include?(config[:current_command].name)
|
49
|
+
log.debug(log_key) { "Skipping Omnibus loading (detected help or version)" }
|
50
50
|
return
|
51
51
|
end
|
52
52
|
|
@@ -55,16 +55,16 @@ module Omnibus
|
|
55
55
|
Omnibus.load_configuration(@options[:config])
|
56
56
|
else
|
57
57
|
if @options[:config] == Omnibus::DEFAULT_CONFIG
|
58
|
-
log.debug(log_key) {
|
58
|
+
log.debug(log_key) { "Config file not given - using defaults" }
|
59
59
|
else
|
60
60
|
raise "The given config file '#{@options[:config]}' does not exist!"
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
@options[:override].each do |key, value|
|
65
|
-
if %w
|
65
|
+
if %w{true false nil}.include?(value)
|
66
66
|
log.debug(log_key) { "Detected #{value.inspect} should be an object" }
|
67
|
-
value = {
|
67
|
+
value = { "true" => true, "false" => false, "nil" => nil }[value]
|
68
68
|
end
|
69
69
|
|
70
70
|
if value =~ /\A[[:digit:]]+\Z/
|
@@ -76,25 +76,25 @@ module Omnibus
|
|
76
76
|
log.debug(log_key) { "Setting Config.#{key} = #{value.inspect}" }
|
77
77
|
Config.send(key, value)
|
78
78
|
else
|
79
|
-
log.debug (log_key){ "Skipping option '#{key}' - not a config option" }
|
79
|
+
log.debug (log_key) { "Skipping option '#{key}' - not a config option" }
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
84
|
class_option :config,
|
85
|
-
desc:
|
86
|
-
aliases:
|
85
|
+
desc: "Path to the Omnibus config file",
|
86
|
+
aliases: "-c",
|
87
87
|
type: :string,
|
88
88
|
default: Omnibus::DEFAULT_CONFIG
|
89
89
|
class_option :log_level,
|
90
|
-
desc:
|
91
|
-
aliases:
|
90
|
+
desc: "The log level",
|
91
|
+
aliases: "-l",
|
92
92
|
type: :string,
|
93
93
|
enum: Logger::LEVELS.map(&:downcase),
|
94
|
-
default:
|
94
|
+
default: "info"
|
95
95
|
class_option :override,
|
96
|
-
desc:
|
97
|
-
aliases:
|
96
|
+
desc: "Override one or more Omnibus config options",
|
97
|
+
aliases: "-o",
|
98
98
|
type: :hash,
|
99
99
|
default: {}
|
100
100
|
|
@@ -102,7 +102,7 @@ module Omnibus
|
|
102
102
|
# Hide the default help task to encourage people to use +-h+ instead of
|
103
103
|
# Thor's dumb way of asking for help.
|
104
104
|
#
|
105
|
-
desc
|
105
|
+
desc "help [COMMAND]", "Show help output", hide: true
|
106
106
|
def help(*)
|
107
107
|
super
|
108
108
|
end
|
data/lib/omnibus/cli/cache.rb
CHANGED
@@ -23,14 +23,14 @@ module Omnibus
|
|
23
23
|
#
|
24
24
|
# $ omnibus cache existing
|
25
25
|
#
|
26
|
-
desc
|
26
|
+
desc "existing", "List software packages which exist in the cache"
|
27
27
|
def existing
|
28
28
|
result = S3Cache.list
|
29
29
|
|
30
30
|
if result.empty?
|
31
|
-
say(
|
31
|
+
say("There are no packages in the cache!")
|
32
32
|
else
|
33
|
-
say(
|
33
|
+
say("The following packages are in the cache:")
|
34
34
|
result.each do |software|
|
35
35
|
say(" * #{software.name}-#{software.version}")
|
36
36
|
end
|
@@ -42,14 +42,14 @@ module Omnibus
|
|
42
42
|
#
|
43
43
|
# $ omnibus cache list
|
44
44
|
#
|
45
|
-
desc
|
45
|
+
desc "list", "List all cached files (by S3 key)"
|
46
46
|
def list
|
47
47
|
result = S3Cache.keys
|
48
48
|
|
49
49
|
if result.empty?
|
50
|
-
say(
|
50
|
+
say("There is nothing in the cache!")
|
51
51
|
else
|
52
|
-
say(
|
52
|
+
say("Cached files (by S3 key):")
|
53
53
|
result.each do |key|
|
54
54
|
say(" * #{key}")
|
55
55
|
end
|
@@ -61,14 +61,14 @@ module Omnibus
|
|
61
61
|
#
|
62
62
|
# $ omnibus cache missing
|
63
63
|
#
|
64
|
-
desc
|
64
|
+
desc "missing", "Lists software packages that are required but not yet cached"
|
65
65
|
def missing
|
66
66
|
result = S3Cache.missing
|
67
67
|
|
68
68
|
if result.empty?
|
69
|
-
say(
|
69
|
+
say("There are no missing packages in the cache.")
|
70
70
|
else
|
71
|
-
say(
|
71
|
+
say("The following packages are missing from the cache:")
|
72
72
|
result.each do |software|
|
73
73
|
say(" * #{software.name}-#{software.version}")
|
74
74
|
end
|
@@ -80,9 +80,9 @@ module Omnibus
|
|
80
80
|
#
|
81
81
|
# $ omnibus cache fetch
|
82
82
|
#
|
83
|
-
desc
|
83
|
+
desc "fetch", "Fetches missing software packages locally"
|
84
84
|
def fetch
|
85
|
-
say(
|
85
|
+
say("Fetching missing packages...")
|
86
86
|
S3Cache.fetch_missing
|
87
87
|
end
|
88
88
|
|
@@ -91,9 +91,9 @@ module Omnibus
|
|
91
91
|
#
|
92
92
|
# $ omnibus cache populate
|
93
93
|
#
|
94
|
-
desc
|
94
|
+
desc "populate", "Populate the S3 Cache"
|
95
95
|
def populate
|
96
|
-
say(
|
96
|
+
say("Populating the cache...")
|
97
97
|
S3Cache.populate
|
98
98
|
end
|
99
99
|
end
|
@@ -14,11 +14,11 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
17
|
+
require "omnibus/changelog"
|
18
|
+
require "omnibus/changelog_printer"
|
19
|
+
require "omnibus/manifest_diff"
|
20
|
+
require "omnibus/semantic_version"
|
21
|
+
require "ffi_yajl"
|
22
22
|
|
23
23
|
module Omnibus
|
24
24
|
class Command::ChangeLog < Command::Base
|
@@ -67,8 +67,8 @@ module Omnibus
|
|
67
67
|
desc: "Explicit version for this changelog",
|
68
68
|
type: :string
|
69
69
|
|
70
|
-
desc
|
71
|
-
def generate(start_ref=nil, end_ref=nil)
|
70
|
+
desc "generate [START] [END]", "Generate a changelog for a new release"
|
71
|
+
def generate(start_ref = nil, end_ref = nil)
|
72
72
|
@start_ref = start_ref
|
73
73
|
@end_ref = end_ref
|
74
74
|
diff = if @options[:skip_components]
|
@@ -108,7 +108,6 @@ module Omnibus
|
|
108
108
|
Omnibus::Manifest.from_hash(FFI_Yajl::Parser.parse(local_git_repo.file_at_revision("version-manifest.json", rev)))
|
109
109
|
end
|
110
110
|
|
111
|
-
|
112
111
|
def new_version
|
113
112
|
if @options[:version]
|
114
113
|
@options[:version]
|
@@ -143,7 +142,7 @@ module Omnibus
|
|
143
142
|
@end_ref ||= if @options[:ending_manifest]
|
144
143
|
new_manifest.build_git_revision
|
145
144
|
else
|
146
|
-
|
145
|
+
"HEAD"
|
147
146
|
end
|
148
147
|
end
|
149
148
|
end
|
data/lib/omnibus/cli/publish.rb
CHANGED
@@ -34,11 +34,11 @@ module Omnibus
|
|
34
34
|
# }
|
35
35
|
#
|
36
36
|
class_option :platform_mappings,
|
37
|
-
desc:
|
37
|
+
desc: "The optional platform mappings JSON file to publish with",
|
38
38
|
type: :string
|
39
39
|
|
40
40
|
class_option :version_manifest,
|
41
|
-
desc:
|
41
|
+
desc: "Path to the version-manifest.json file to publish with",
|
42
42
|
type: :string
|
43
43
|
|
44
44
|
#
|
@@ -48,14 +48,14 @@ module Omnibus
|
|
48
48
|
#
|
49
49
|
method_option :acl,
|
50
50
|
type: :string,
|
51
|
-
desc:
|
52
|
-
enum: %w
|
53
|
-
default:
|
51
|
+
desc: "The accessibility of the uploaded packages",
|
52
|
+
enum: %w{public private},
|
53
|
+
default: "private"
|
54
54
|
method_option :region,
|
55
55
|
type: :string,
|
56
|
-
desc:
|
57
|
-
default:
|
58
|
-
desc
|
56
|
+
desc: "The region in which the bucket is located",
|
57
|
+
default: "us-east-1"
|
58
|
+
desc "s3 BUCKET PATTERN", "Publish to an S3 bucket"
|
59
59
|
def s3(bucket, pattern)
|
60
60
|
options[:bucket] = bucket
|
61
61
|
publish(S3Publisher, pattern, options)
|
@@ -68,16 +68,15 @@ module Omnibus
|
|
68
68
|
#
|
69
69
|
method_option :build_record,
|
70
70
|
type: :boolean,
|
71
|
-
desc:
|
71
|
+
desc: "Optionally create an Artifactory build record for the published artifacts",
|
72
72
|
default: true
|
73
73
|
method_option :properties,
|
74
74
|
type: :hash,
|
75
|
-
desc:
|
75
|
+
desc: "Properites to attach to published artifacts",
|
76
76
|
default: {}
|
77
|
-
desc
|
77
|
+
desc "artifactory REPOSITORY PATTERN", "Publish to an Artifactory instance"
|
78
78
|
def artifactory(repository, pattern)
|
79
|
-
|
80
|
-
Omnibus.logger.deprecated('ArtifactoryPublisher') do
|
79
|
+
Omnibus.logger.deprecated("ArtifactoryPublisher") do
|
81
80
|
"The `--version-manifest' option has been deprecated. Version manifest data is now part of the `*.metadata.json' file"
|
82
81
|
end if options[:version_manifest]
|
83
82
|
|