omnibus 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +17 -1
- data/.travis.yml +11 -3
- data/CHANGELOG.md +39 -1
- data/Gemfile +0 -4
- data/README.md +10 -8
- data/Rakefile +18 -7
- data/bin/omnibus +3 -3
- data/docs/Building on Windows.md +98 -0
- data/features/commands/_deprecated.feature +46 -0
- data/features/commands/build.feature +9 -0
- data/features/commands/clean.feature +21 -0
- data/features/commands/list.feature +16 -0
- data/features/commands/new.feature +8 -0
- data/features/commands/version.feature +12 -0
- data/features/step_definitions/generator_steps.rb +28 -0
- data/features/support/env.rb +13 -0
- data/lib/omnibus.rb +319 -240
- data/lib/omnibus/artifact.rb +16 -0
- data/lib/omnibus/build_version.rb +39 -20
- data/lib/omnibus/build_version_dsl.rb +136 -0
- data/lib/omnibus/builder.rb +28 -23
- data/lib/omnibus/cleaner.rb +72 -0
- data/lib/omnibus/cli.rb +115 -11
- data/lib/omnibus/cli/base.rb +82 -81
- data/lib/omnibus/cli/cache.rb +80 -32
- data/lib/omnibus/cli/deprecated.rb +79 -0
- data/lib/omnibus/cli/release.rb +17 -21
- data/lib/omnibus/config.rb +38 -13
- data/lib/omnibus/exceptions.rb +70 -18
- data/lib/omnibus/fetcher.rb +18 -11
- data/lib/omnibus/fetchers/git_fetcher.rb +48 -53
- data/lib/omnibus/fetchers/net_fetcher.rb +29 -27
- data/lib/omnibus/fetchers/path_fetcher.rb +9 -12
- data/lib/omnibus/fetchers/s3_cache_fetcher.rb +5 -8
- data/lib/omnibus/generator.rb +131 -0
- data/lib/omnibus/{templates → generator_files}/.kitchen.local.yml.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/.kitchen.yml.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/Berksfile.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/Gemfile.erb +2 -2
- data/lib/omnibus/{templates → generator_files}/README.md.erb +6 -7
- data/lib/omnibus/{templates → generator_files}/Vagrantfile.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/gitignore.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/mac_dmg/background.png +0 -0
- data/lib/omnibus/{templates → generator_files}/mac_dmg/icon.png +0 -0
- data/lib/omnibus/{templates → generator_files}/mac_pkg/background.png +0 -0
- data/lib/omnibus/{templates → generator_files}/mac_pkg/license.html.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/mac_pkg/welcome.html.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/omnibus.rb.example.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/package_scripts/makeselfinst.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/package_scripts/postinst.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/package_scripts/postrm.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/package_scripts/preinst.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/package_scripts/prerm.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/project.rb.erb +0 -1
- data/lib/omnibus/{templates → generator_files}/software/c-example.rb.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/software/erlang-example.rb.erb +0 -0
- data/lib/omnibus/{templates → generator_files}/software/ruby-example.rb.erb +0 -0
- data/lib/omnibus/generator_files/windows_msi/assets/LICENSE.rtf +8 -0
- data/lib/omnibus/generator_files/windows_msi/assets/banner_background.bmp +0 -0
- data/lib/omnibus/generator_files/windows_msi/assets/dialog_background.bmp +0 -0
- data/lib/omnibus/generator_files/windows_msi/assets/project.ico +0 -0
- data/lib/omnibus/generator_files/windows_msi/assets/project_16x16.ico +0 -0
- data/lib/omnibus/generator_files/windows_msi/assets/project_32x32.ico +0 -0
- data/lib/omnibus/generator_files/windows_msi/localization-en-us.wxl.erb +20 -0
- data/lib/omnibus/generator_files/windows_msi/parameters.wxi.erb +9 -0
- data/lib/omnibus/generator_files/windows_msi/source.wxs.erb +74 -0
- data/lib/omnibus/health_check.rb +80 -40
- data/lib/omnibus/install_path_cache.rb +11 -12
- data/lib/omnibus/library.rb +30 -3
- data/lib/omnibus/logger.rb +47 -0
- data/lib/omnibus/logging.rb +60 -0
- data/lib/omnibus/null_builder.rb +23 -0
- data/lib/omnibus/ohai.rb +70 -0
- data/lib/omnibus/overrides.rb +69 -48
- data/lib/omnibus/package_release.rb +7 -14
- data/lib/omnibus/packagers/base.rb +66 -13
- data/lib/omnibus/packagers/mac_dmg.rb +23 -3
- data/lib/omnibus/packagers/mac_pkg.rb +20 -10
- data/lib/omnibus/packagers/windows_msi.rb +109 -0
- data/lib/omnibus/project.rb +136 -79
- data/lib/omnibus/reports.rb +1 -2
- data/lib/omnibus/{s3_cacher.rb → s3_cache.rb} +15 -37
- data/lib/omnibus/software.rb +77 -27
- data/lib/omnibus/software_s3_urls.rb +50 -0
- data/lib/omnibus/sugar.rb +1 -3
- data/lib/omnibus/util.rb +45 -18
- data/lib/omnibus/version.rb +2 -3
- data/omnibus.gemspec +5 -3
- data/spec/data/complicated/config/patches/bzip2/makefile_take_env_vars.patch +15 -0
- data/spec/data/complicated/config/patches/couchdb/patch_for_couchjs_stack.patch +19 -0
- data/spec/data/complicated/config/patches/gd/gd-2.0.33-configure-libpng.patch +100 -0
- data/spec/data/complicated/config/patches/keepalived/keepalived-1.2.9_opscode_centos_5.patch +15 -0
- data/spec/data/complicated/config/patches/libedit/freebsd-vi-fix.patch +24 -0
- data/spec/data/complicated/config/patches/libiconv/libiconv-1.14_srclib_stdio.in.h-remove-gets-declarations.patch +29 -0
- data/spec/data/complicated/config/patches/libwrap/tcp_wrappers-7.6-makefile-dest-fix.patch +35 -0
- data/spec/data/complicated/config/patches/libwrap/tcp_wrappers-7.6-malloc-fix.patch +13 -0
- data/spec/data/complicated/config/patches/libwrap/tcp_wrappers-7.6-shared_lib_plus_plus-1.patch +1035 -0
- data/spec/data/complicated/config/patches/logrotate/logrotate_basedir_override.patch +12 -0
- data/spec/data/complicated/config/patches/ncurses/ncurses-5.9-solaris-xopen_source_extended-detection.patch +11 -0
- data/spec/data/complicated/config/patches/ncurses/ncurses-clang.patch +42 -0
- data/spec/data/complicated/config/patches/ncurses/patch-aa +23 -0
- data/spec/data/complicated/config/patches/ncurses/patch-ab +44 -0
- data/spec/data/complicated/config/patches/ncurses/patch-ac +40 -0
- data/spec/data/complicated/config/patches/ncurses/patch-ad +12 -0
- data/spec/data/complicated/config/patches/ncurses/patch-aix-configure +23 -0
- data/spec/data/complicated/config/patches/ncurses/patch-cxx_cursesf.h +22 -0
- data/spec/data/complicated/config/patches/ncurses/patch-cxx_cursesm.h +22 -0
- data/spec/data/complicated/config/patches/nrpe/fix_for_runit.patch +64 -0
- data/spec/data/complicated/config/patches/openssl/openssl-1.0.1f-do-not-build-docs.patch +101 -0
- data/spec/data/complicated/config/patches/postgresql/postgresql-9.1.2-configure-ncurses-fix.patch +12 -0
- data/spec/data/complicated/config/patches/ruby/patch-configure +103 -0
- data/spec/data/complicated/config/patches/ruby/ruby-aix-configure.patch +10 -0
- data/spec/data/complicated/config/patches/ruby/ruby-openssl-1.0.1c.patch +42 -0
- data/spec/data/complicated/config/patches/ruby/ruby_aix_1_9_3_448_ssl_EAGAIN.patch +57 -0
- data/spec/data/complicated/config/patches/ruby/rvm-cflags.patch +27 -0
- data/spec/data/complicated/config/projects/angrychef.rb +32 -0
- data/spec/data/complicated/config/projects/chef-windows.rb +32 -0
- data/spec/data/complicated/config/projects/chef.rb +32 -0
- data/spec/data/complicated/config/projects/chefdk-windows.rb +41 -0
- data/spec/data/complicated/config/projects/chefdk.rb +44 -0
- data/spec/data/complicated/config/software/appbundler.rb +25 -0
- data/spec/data/complicated/config/software/autoconf.rb +35 -0
- data/spec/data/complicated/config/software/automake.rb +39 -0
- data/spec/data/complicated/config/software/berkshelf.rb +44 -0
- data/{lib/omnibus/fetchers.rb → spec/data/complicated/config/software/bundler.rb} +8 -5
- data/spec/data/complicated/config/software/bzip2.rb +46 -0
- data/spec/data/complicated/config/software/cacerts.rb +44 -0
- data/spec/data/complicated/config/software/chef-client-msi.rb +88 -0
- data/spec/data/complicated/config/software/chef-gem.rb +26 -0
- data/spec/data/complicated/config/software/chef-vault.rb +43 -0
- data/spec/data/complicated/config/software/chef-windows.rb +158 -0
- data/spec/data/complicated/config/software/chef.rb +170 -0
- data/spec/data/complicated/config/software/chefdk.rb +103 -0
- data/spec/data/complicated/config/software/couchdb.rb +53 -0
- data/spec/data/complicated/config/software/curl.rb +48 -0
- data/spec/data/complicated/config/software/erlang.rb +65 -0
- data/spec/data/complicated/config/software/expat.rb +21 -0
- data/spec/data/complicated/config/software/fcgi.rb +56 -0
- data/spec/data/complicated/config/software/fcgiwrap.rb +41 -0
- data/spec/data/complicated/config/software/gd.rb +56 -0
- data/spec/data/complicated/config/software/gdbm.rb +40 -0
- data/spec/data/complicated/config/software/gecode.rb +48 -0
- data/spec/data/complicated/config/software/git.rb +40 -0
- data/spec/data/complicated/config/software/help2man.rb +30 -0
- data/spec/data/complicated/config/software/icu.rb +40 -0
- data/spec/data/complicated/config/software/jre.rb +48 -0
- data/spec/data/complicated/config/software/keepalived.rb +43 -0
- data/spec/data/complicated/config/software/libarchive.rb +50 -0
- data/spec/data/complicated/config/software/libedit.rb +69 -0
- data/spec/data/complicated/config/software/libffi.rb +71 -0
- data/spec/data/complicated/config/software/libgcc.rb +39 -0
- data/spec/data/complicated/config/software/libiconv.rb +66 -0
- data/spec/data/complicated/config/software/libjpeg.rb +39 -0
- data/spec/data/complicated/config/software/libpng.rb +38 -0
- data/spec/data/complicated/config/software/libtool.rb +52 -0
- data/spec/data/complicated/config/software/libwrap.rb +50 -0
- data/spec/data/complicated/config/software/libxml2.rb +51 -0
- data/spec/data/complicated/config/software/libxslt.rb +52 -0
- data/spec/data/complicated/config/software/libyaml-windows.rb +43 -0
- data/spec/data/complicated/config/software/libyaml.rb +62 -0
- data/spec/data/complicated/config/software/logrotate.rb +41 -0
- data/spec/data/complicated/config/software/makedepend.rb +73 -0
- data/spec/data/complicated/config/software/mysql2.rb +42 -0
- data/spec/data/complicated/config/software/nagios-plugins.rb +53 -0
- data/spec/data/complicated/config/software/nagios.rb +66 -0
- data/spec/data/complicated/config/software/ncurses.rb +149 -0
- data/spec/data/complicated/config/software/nginx.rb +40 -0
- data/spec/data/complicated/config/software/nodejs.rb +44 -0
- data/spec/data/complicated/config/software/nokogiri.rb +55 -0
- data/spec/data/complicated/config/software/nrpe.rb +61 -0
- data/spec/data/complicated/config/software/ohai.rb +64 -0
- data/spec/data/complicated/config/software/omnibus-ctl.rb +34 -0
- data/spec/data/complicated/config/software/openresty.rb +67 -0
- data/spec/data/complicated/config/software/openssl.rb +158 -0
- data/spec/data/complicated/config/software/pcre.rb +42 -0
- data/spec/data/complicated/config/software/perl-extutils-embed.rb +15 -0
- data/spec/data/complicated/config/software/perl-extutils-makemaker.rb +15 -0
- data/spec/data/complicated/config/software/perl.rb +48 -0
- data/spec/data/complicated/config/software/perl_pg_driver.rb +12 -0
- data/spec/data/complicated/config/software/php.rb +41 -0
- data/spec/data/complicated/config/software/pip.rb +30 -0
- data/spec/data/complicated/config/software/pkg-config.rb +66 -0
- data/spec/data/complicated/config/software/popt.rb +47 -0
- data/spec/data/complicated/config/software/postgresql.rb +51 -0
- data/spec/data/complicated/config/software/preparation.rb +30 -0
- data/spec/data/complicated/config/software/pygments.rb +25 -0
- data/spec/data/complicated/config/software/python.rb +49 -0
- data/spec/data/complicated/config/software/rabbitmq.rb +36 -0
- data/spec/data/complicated/config/software/rebar.rb +36 -0
- data/spec/data/complicated/config/software/redis.rb +33 -0
- data/spec/data/complicated/config/software/rsync.rb +48 -0
- data/spec/data/complicated/config/software/ruby-windows-devkit.rb +30 -0
- data/spec/data/complicated/config/software/ruby-windows.rb +30 -0
- data/spec/data/complicated/config/software/ruby.rb +162 -0
- data/spec/data/complicated/config/software/rubygems-customization.rb +57 -0
- data/spec/data/complicated/config/software/rubygems.rb +37 -0
- data/spec/data/complicated/config/software/runit.rb +118 -0
- data/spec/data/complicated/config/software/server-jre.rb +46 -0
- data/spec/data/complicated/config/software/setuptools.rb +30 -0
- data/spec/data/complicated/config/software/spawn-fcgi.rb +40 -0
- data/spec/data/complicated/config/software/sphinx.rb +26 -0
- data/spec/data/complicated/config/software/spidermonkey.rb +60 -0
- data/spec/data/complicated/config/software/sqitch.rb +24 -0
- data/spec/data/complicated/config/software/test-kitchen.rb +39 -0
- data/spec/data/complicated/config/software/unicorn.rb +27 -0
- data/spec/data/complicated/config/software/util-macros.rb +46 -0
- data/spec/data/complicated/config/software/version-manifest.rb +32 -0
- data/spec/data/complicated/config/software/xproto.rb +46 -0
- data/spec/data/complicated/config/software/yajl.rb +30 -0
- data/spec/data/complicated/config/software/zlib.rb +67 -0
- data/spec/data/projects/chefdk.rb +4 -4
- data/spec/data/projects/sample.rb +3 -0
- data/spec/data/software/erchef.rb +1 -1
- data/spec/fixtures/sample/files/windows_msi/Resources/assets/LICENSE.rtf +8 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/assets/banner_background.bmp +0 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/assets/dialog_background.bmp +0 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/assets/project.ico +0 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/assets/project_16x16.ico +0 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/assets/project_32x32.ico +0 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/localization-en-us.wxl +20 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/parameters.wxi.erb +9 -0
- data/spec/fixtures/sample/files/windows_msi/Resources/source.wxs +74 -0
- data/spec/functional/packagers/mac_spec.rb +3 -20
- data/spec/functional/packagers/windows_spec.rb +69 -0
- data/spec/spec_helper.rb +79 -1
- data/spec/unit/artifact_spec.rb +0 -18
- data/spec/unit/build_version_dsl_spec.rb +136 -0
- data/spec/unit/build_version_spec.rb +185 -198
- data/spec/unit/config_spec.rb +18 -1
- data/spec/unit/fetchers/git_fetcher_spec.rb +55 -80
- data/spec/unit/fetchers/net_fetcher_spec.rb +11 -21
- data/spec/unit/install_path_cache_spec.rb +164 -136
- data/spec/unit/library_spec.rb +125 -5
- data/spec/unit/omnibus_spec.rb +25 -9
- data/spec/unit/overrides_spec.rb +2 -14
- data/spec/unit/package_release_spec.rb +0 -18
- data/spec/unit/packagers/base_spec.rb +84 -21
- data/spec/unit/packagers/mac_pkg_spec.rb +34 -24
- data/spec/unit/project_spec.rb +100 -102
- data/spec/unit/s3_cacher_spec.rb +0 -18
- data/spec/unit/software_spec.rb +152 -6
- data/spec/{sugar_spec.rb → unit/sugar_spec.rb} +0 -3
- metadata +365 -38
- data/lib/omnibus/cli/application.rb +0 -147
- data/lib/omnibus/cli/build.rb +0 -64
data/lib/omnibus/reports.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright
|
3
|
-
# License:: Apache License, Version 2.0
|
2
|
+
# Copyright 2012-2014 Chef Software, Inc.
|
4
3
|
#
|
5
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
5
|
# you may not use this file except in compliance with the License.
|
@@ -1,6 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright
|
3
|
-
# License:: Apache License, Version 2.0
|
2
|
+
# Copyright 2012-2014 Chef Software, Inc.
|
4
3
|
#
|
5
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
5
|
# you may not use this file except in compliance with the License.
|
@@ -17,37 +16,15 @@
|
|
17
16
|
|
18
17
|
require 'fileutils'
|
19
18
|
require 'uber-s3'
|
20
|
-
require 'omnibus/fetchers'
|
21
19
|
|
22
20
|
module Omnibus
|
23
|
-
module SoftwareS3URLs
|
24
|
-
class InsufficientSpecification < ArgumentError
|
25
|
-
end
|
26
|
-
|
27
|
-
def config
|
28
|
-
Omnibus.config
|
29
|
-
end
|
30
|
-
|
31
|
-
def url_for(software)
|
32
|
-
"http://#{config.s3_bucket}.s3.amazonaws.com/#{key_for_package(software)}"
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def key_for_package(package)
|
38
|
-
package.name || fail(InsufficientSpecification, "Software must have a name to cache it in S3 (#{package.inspect})")
|
39
|
-
package.version || fail(InsufficientSpecification, "Software must set a version to cache it in S3 (#{package.inspect})")
|
40
|
-
package.checksum || fail(InsufficientSpecification, "Software must specify a checksum (md5) to cache it in S3 (#{package.inspect})")
|
41
|
-
"#{package.name}-#{package.version}-#{package.checksum}"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
21
|
class S3Cache
|
22
|
+
include Logging
|
46
23
|
include SoftwareS3URLs
|
47
24
|
|
48
25
|
def initialize
|
49
26
|
unless config.s3_bucket && config.s3_access_key && config.s3_secret_key
|
50
|
-
|
27
|
+
raise InvalidS3Configuration.new(config.s3_bucket, config.s3_access_key, config.s3_secret_key)
|
51
28
|
end
|
52
29
|
@client = UberS3.new(
|
53
30
|
access_key: config.s3_access_key,
|
@@ -57,10 +34,6 @@ module Omnibus
|
|
57
34
|
)
|
58
35
|
end
|
59
36
|
|
60
|
-
def log(msg)
|
61
|
-
puts "[S3 Cacher] #{msg}"
|
62
|
-
end
|
63
|
-
|
64
37
|
def config
|
65
38
|
Omnibus.config
|
66
39
|
end
|
@@ -92,7 +65,10 @@ module Omnibus
|
|
92
65
|
key = key_for_package(software)
|
93
66
|
content = IO.read(software.project_file)
|
94
67
|
|
95
|
-
log
|
68
|
+
log.info(log_key) do
|
69
|
+
"Uploading #{software.project_file} as #{config.s3_bucket}/#{key}"
|
70
|
+
end
|
71
|
+
|
96
72
|
@client.store(key, content, access: :public_read, content_md5: software.checksum)
|
97
73
|
end
|
98
74
|
end
|
@@ -110,22 +86,24 @@ module Omnibus
|
|
110
86
|
end
|
111
87
|
|
112
88
|
def fetch(software)
|
113
|
-
log "Fetching #{software.name}"
|
89
|
+
log.info(log_key) { "Fetching #{software.name}" }
|
114
90
|
fetcher = Fetcher.without_caching_for(software)
|
115
91
|
if fetcher.fetch_required?
|
92
|
+
log.debug(log_key) { 'Updating cache' }
|
116
93
|
fetcher.download
|
117
94
|
fetcher.verify_checksum!
|
118
95
|
else
|
119
|
-
log 'Cached copy up to date, skipping.'
|
96
|
+
log.debug(log_key) { 'Cached copy up to date, skipping.' }
|
120
97
|
end
|
121
98
|
end
|
122
99
|
|
123
100
|
def bucket
|
124
101
|
@bucket ||= begin
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
102
|
+
if @client.exists?('/')
|
103
|
+
@client.bucket
|
104
|
+
else
|
105
|
+
@client.connection.put('/')
|
106
|
+
end
|
129
107
|
end
|
130
108
|
end
|
131
109
|
end
|
data/lib/omnibus/software.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright
|
3
|
-
# License:: Apache License, Version 2.0
|
2
|
+
# Copyright 2012 Chef Software, Inc.
|
4
3
|
#
|
5
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
5
|
# you may not use this file except in compliance with the License.
|
@@ -16,21 +15,18 @@
|
|
16
15
|
#
|
17
16
|
|
18
17
|
require 'digest/md5'
|
19
|
-
require 'mixlib/shellout'
|
20
18
|
require 'net/ftp'
|
21
19
|
require 'net/http'
|
22
20
|
require 'net/https'
|
23
21
|
require 'uri'
|
24
22
|
|
25
|
-
require 'omnibus/fetcher'
|
26
|
-
require 'omnibus/builder'
|
27
|
-
require 'omnibus/config'
|
28
|
-
|
29
23
|
require 'fileutils'
|
30
24
|
|
31
25
|
module Omnibus
|
32
26
|
# Omnibus software DSL reader
|
33
27
|
class Software
|
28
|
+
include Logging
|
29
|
+
|
34
30
|
NULL_ARG = Object.new
|
35
31
|
UNINITIALIZED = Object.new
|
36
32
|
|
@@ -90,7 +86,11 @@ module Omnibus
|
|
90
86
|
|
91
87
|
@dependencies = []
|
92
88
|
@whitelist_files = []
|
93
|
-
instance_eval(io, filename
|
89
|
+
instance_eval(io, filename)
|
90
|
+
end
|
91
|
+
|
92
|
+
def <=>(other)
|
93
|
+
self.name <=> other.name
|
94
94
|
end
|
95
95
|
|
96
96
|
# Retrieves the override_version
|
@@ -100,7 +100,11 @@ module Omnibus
|
|
100
100
|
# @todo: can't we just use #version here or are we testing this against nil? somewhere and
|
101
101
|
# not using #overridden?
|
102
102
|
def override_version
|
103
|
-
|
103
|
+
log.deprecated(log_key) do
|
104
|
+
'Software#override_version. Please use #version or ' \
|
105
|
+
'test with #overridden?'
|
106
|
+
end
|
107
|
+
|
104
108
|
overrides[:version]
|
105
109
|
end
|
106
110
|
|
@@ -126,7 +130,7 @@ module Omnibus
|
|
126
130
|
# @return [String]
|
127
131
|
def name(val = NULL_ARG)
|
128
132
|
@name = val unless val.equal?(NULL_ARG)
|
129
|
-
@name ||
|
133
|
+
@name || raise(MissingSoftwareConfiguration.new(name, 'name', 'libxslt'))
|
130
134
|
end
|
131
135
|
|
132
136
|
# Sets the description of the software
|
@@ -188,7 +192,10 @@ module Omnibus
|
|
188
192
|
#
|
189
193
|
# @todo: remove this in favor of default_version
|
190
194
|
def given_version
|
191
|
-
|
195
|
+
log.deprecated(log_key) do
|
196
|
+
'Software#given_version. Please use #default_version instead.'
|
197
|
+
end
|
198
|
+
|
192
199
|
default_version
|
193
200
|
end
|
194
201
|
|
@@ -214,7 +221,7 @@ module Omnibus
|
|
214
221
|
def version(val = NULL_ARG)
|
215
222
|
if block_given?
|
216
223
|
if val.equal?(NULL_ARG)
|
217
|
-
|
224
|
+
raise 'block needs a version argument to apply against'
|
218
225
|
else
|
219
226
|
if val == apply_overrides(:version)
|
220
227
|
yield
|
@@ -222,7 +229,9 @@ module Omnibus
|
|
222
229
|
end
|
223
230
|
else
|
224
231
|
unless val.equal?(NULL_ARG)
|
225
|
-
|
232
|
+
log.deprecated(log_key) do
|
233
|
+
'Software#version. Please use #default_version instead.'
|
234
|
+
end
|
226
235
|
@version = val
|
227
236
|
end
|
228
237
|
end
|
@@ -257,6 +266,15 @@ module Omnibus
|
|
257
266
|
@project.build_version
|
258
267
|
end
|
259
268
|
|
269
|
+
# Returns the version to be used in cache.
|
270
|
+
def version_for_cache
|
271
|
+
if fetcher
|
272
|
+
fetcher.version_for_cache || version
|
273
|
+
else
|
274
|
+
version
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
260
278
|
# @todo Judging by existing usage, this should sensibly default to
|
261
279
|
# the name of the software, since that's what it effectively does down in #project_dir
|
262
280
|
def relative_path(val)
|
@@ -270,7 +288,7 @@ module Omnibus
|
|
270
288
|
# implementation
|
271
289
|
# @todo Why the caching of the URI?
|
272
290
|
def source_uri
|
273
|
-
@source_uri ||= URI(
|
291
|
+
@source_uri ||= URI(source[:url])
|
274
292
|
end
|
275
293
|
|
276
294
|
# @param val [Boolean]
|
@@ -295,7 +313,7 @@ module Omnibus
|
|
295
313
|
# across two classes, one of which is a specific interface
|
296
314
|
# implementation
|
297
315
|
def checksum
|
298
|
-
|
316
|
+
source[:md5]
|
299
317
|
end
|
300
318
|
|
301
319
|
# @todo Should this ever be legitimately used in the DSL? It
|
@@ -335,8 +353,8 @@ module Omnibus
|
|
335
353
|
# @todo It seems like this isn't used, and if it were, it should
|
336
354
|
# probably be part of Opscode::Builder instead
|
337
355
|
def max_build_jobs
|
338
|
-
if
|
339
|
-
|
356
|
+
if Ohai.cpu && Ohai.cpu[:total] && Ohai.cpu[:total].to_s =~ /^\d+$/
|
357
|
+
Ohai.cpu[:total].to_i + 1
|
340
358
|
else
|
341
359
|
3
|
342
360
|
end
|
@@ -408,20 +426,20 @@ module Omnibus
|
|
408
426
|
#
|
409
427
|
# @return [String]
|
410
428
|
def platform
|
411
|
-
|
429
|
+
Ohai.platform
|
412
430
|
end
|
413
431
|
|
414
432
|
# Return the architecture of the machine, as determined by Ohai.
|
415
433
|
# @return [String] Either "sparc" or "intel", as appropriate
|
416
434
|
# @todo Is this used? Doesn't appear to be...
|
417
435
|
def architecture
|
418
|
-
|
436
|
+
Ohai.kernel['machine'] =~ /sun/ ? 'sparc' : 'intel'
|
419
437
|
end
|
420
438
|
|
421
439
|
# Actually build the software package
|
422
440
|
def build_me
|
423
441
|
# Fetch the source
|
424
|
-
fetcher = fetch_me
|
442
|
+
@fetcher = fetch_me
|
425
443
|
|
426
444
|
# Build if we need to
|
427
445
|
if always_build?
|
@@ -433,6 +451,8 @@ module Omnibus
|
|
433
451
|
execute_build(fetcher)
|
434
452
|
end
|
435
453
|
end
|
454
|
+
|
455
|
+
project.build_version_dsl.resolve(self)
|
436
456
|
true
|
437
457
|
end
|
438
458
|
|
@@ -454,6 +474,30 @@ module Omnibus
|
|
454
474
|
fetcher
|
455
475
|
end
|
456
476
|
|
477
|
+
# A PATH variable format string representing the current PATH with the
|
478
|
+
# project's embedded/bin directory prepended. The correct path separator
|
479
|
+
# for the platform is used to join the paths.
|
480
|
+
#
|
481
|
+
# @return [String]
|
482
|
+
def path_with_embedded
|
483
|
+
prepend_path("#{install_dir}/bin", "#{install_dir}/embedded/bin")
|
484
|
+
end
|
485
|
+
|
486
|
+
# A PATH variable format string representing the current PATH with the
|
487
|
+
# given path prepended. The correct path separator
|
488
|
+
# for the platform is used to join the paths.
|
489
|
+
#
|
490
|
+
# @param paths [String]
|
491
|
+
# @param paths [Array<String>]
|
492
|
+
# @return [String]
|
493
|
+
def prepend_path(*paths)
|
494
|
+
path_values = Array(paths)
|
495
|
+
path_values << ENV['PATH']
|
496
|
+
|
497
|
+
separator = File::PATH_SEPARATOR || ':'
|
498
|
+
path_values.join(separator)
|
499
|
+
end
|
500
|
+
|
457
501
|
private
|
458
502
|
|
459
503
|
# Apply overrides in the @overrides hash that mask instance variables
|
@@ -470,19 +514,21 @@ module Omnibus
|
|
470
514
|
end
|
471
515
|
end
|
472
516
|
|
473
|
-
# @todo
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
517
|
+
# @todo Remove this in the next major release
|
518
|
+
def command(*)
|
519
|
+
log.deprecated(log_key) do
|
520
|
+
'Software#command. Please use something else.'
|
521
|
+
end
|
522
|
+
|
523
|
+
raise 'Method Moved.'
|
478
524
|
end
|
479
525
|
|
480
526
|
def execute_build(fetcher)
|
481
527
|
fetcher.clean
|
482
528
|
@builder.build
|
483
|
-
|
529
|
+
log.info(log_key) { 'Caching build' }
|
484
530
|
Omnibus::InstallPathCache.new(install_dir, self).incremental
|
485
|
-
|
531
|
+
log.info(log_key) { 'Dirtied the cache!' }
|
486
532
|
project.dirty_cache = true
|
487
533
|
end
|
488
534
|
|
@@ -491,5 +537,9 @@ module Omnibus
|
|
491
537
|
f.print ''
|
492
538
|
end
|
493
539
|
end
|
540
|
+
|
541
|
+
def log_key
|
542
|
+
@log_key ||= "#{super}: #{name}"
|
543
|
+
end
|
494
544
|
end
|
495
545
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2013-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
|
+
module Omnibus
|
18
|
+
module SoftwareS3URLs
|
19
|
+
class InsufficientSpecification < ArgumentError
|
20
|
+
def initialize(key, package)
|
21
|
+
@key, @package = key, package
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_s
|
25
|
+
"Software must specify a #{@key} to cache it in S3 (#{@package})!"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def config
|
30
|
+
Omnibus.config
|
31
|
+
end
|
32
|
+
|
33
|
+
def url_for(software)
|
34
|
+
"http://#{config.s3_bucket}.s3.amazonaws.com/#{key_for_package(software)}"
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def key_for_package(package)
|
40
|
+
return @key_for_package if @key_for_package
|
41
|
+
|
42
|
+
package.name || raise(InsufficientSpecification.new(:name, package))
|
43
|
+
package.version || raise(InsufficientSpecification.new(:version, package))
|
44
|
+
package.checksum || raise(InsufficientSpecification.new(:checksum, package))
|
45
|
+
|
46
|
+
@key_for_package = "#{package.name}-#{package.version}-#{package.checksum}"
|
47
|
+
@key_for_package
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/omnibus/sugar.rb
CHANGED
@@ -28,8 +28,6 @@ require 'chef/sugar/ruby'
|
|
28
28
|
require 'chef/sugar/shell'
|
29
29
|
require 'chef/sugar/vagrant'
|
30
30
|
|
31
|
-
require 'omnibus/project'
|
32
|
-
|
33
31
|
module Omnibus
|
34
32
|
class Project
|
35
33
|
private
|
@@ -39,7 +37,7 @@ module Omnibus
|
|
39
37
|
# Omnibus project as if it were Chef. Otherwise, we would need to rewrite
|
40
38
|
# all the DSL methods.
|
41
39
|
def node
|
42
|
-
|
40
|
+
Ohai
|
43
41
|
end
|
44
42
|
end
|
45
43
|
end
|
data/lib/omnibus/util.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
#
|
3
|
-
# Copyright:: Copyright (c) 2013-2014 Chef Software, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
2
|
+
# Copyright 2013-2014 Chef Software, Inc.
|
5
3
|
#
|
6
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
5
|
# you may not use this file except in compliance with the License.
|
@@ -25,33 +23,28 @@ module Omnibus
|
|
25
23
|
module Util
|
26
24
|
# Shells out and runs +command+.
|
27
25
|
#
|
28
|
-
# @overload shellout(command,
|
26
|
+
# @overload shellout(command, options = {})
|
29
27
|
# @param command [String]
|
30
|
-
# @param
|
28
|
+
# @param options [Hash] the options passed to the initializer of the
|
31
29
|
# +Mixlib::ShellOut+ instance.
|
32
|
-
# @overload shellout(command_fragments,
|
30
|
+
# @overload shellout(command_fragments, options = {})
|
33
31
|
# @param command [Array<String>] command argv as individual strings
|
34
|
-
# @param
|
32
|
+
# @param options [Hash] the options passed to the initializer of the
|
35
33
|
# +Mixlib::ShellOut+ instance.
|
36
34
|
# @return [Mixlib::ShellOut] the underlying +Mixlib::ShellOut+ instance
|
37
35
|
# which which has +stdout+, +stderr+, +status+, and +exitstatus+
|
38
36
|
# populated with results of the command.
|
39
37
|
#
|
40
|
-
def shellout(*
|
41
|
-
|
42
|
-
|
43
|
-
opts = if command_fragments.last.kind_of?(Hash)
|
44
|
-
command_fragments.pop
|
45
|
-
else
|
46
|
-
{}
|
47
|
-
end
|
38
|
+
def shellout(*args)
|
39
|
+
options = args.last.kind_of?(Hash) ? args.pop : {}
|
48
40
|
|
49
41
|
default_options = {
|
50
42
|
live_stream: STDOUT,
|
51
43
|
timeout: 7200, # 2 hours
|
52
44
|
environment: {},
|
53
45
|
}
|
54
|
-
|
46
|
+
|
47
|
+
cmd = Mixlib::ShellOut.new(*args, default_options.merge(options))
|
55
48
|
cmd.run_command
|
56
49
|
cmd
|
57
50
|
end
|
@@ -64,10 +57,44 @@ module Omnibus
|
|
64
57
|
# @raise [Mixlib::ShellOut::ShellCommandFailed] if +exitstatus+ is not in
|
65
58
|
# the list of +valid_exit_codes+.
|
66
59
|
#
|
67
|
-
def shellout!(*
|
68
|
-
cmd = shellout(*
|
60
|
+
def shellout!(*args)
|
61
|
+
cmd = shellout(*args)
|
69
62
|
cmd.error!
|
70
63
|
cmd
|
71
64
|
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# Run a command in subshell, suppressing any output.
|
68
|
+
#
|
69
|
+
# @see (Util#shellout)
|
70
|
+
#
|
71
|
+
def quiet_shellout(*args)
|
72
|
+
options = args.last.kind_of?(Hash) ? args.pop : {}
|
73
|
+
options[:live_stream] = nil
|
74
|
+
args << options
|
75
|
+
shellout(*args)
|
76
|
+
end
|
77
|
+
|
78
|
+
#
|
79
|
+
# Run a command, suppressing any output, but raising an error if the
|
80
|
+
# command fails.
|
81
|
+
#
|
82
|
+
# @see (Util#shellout!)
|
83
|
+
#
|
84
|
+
def quiet_shellout!(*args)
|
85
|
+
options = args.last.kind_of?(Hash) ? args.pop : {}
|
86
|
+
options[:live_stream] = nil
|
87
|
+
args << options
|
88
|
+
shellout!(*args)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Replaces path separators with alternative ones when needed.
|
92
|
+
#
|
93
|
+
# @param path [String]
|
94
|
+
# @return [String] given path with applied changes.
|
95
|
+
#
|
96
|
+
def windows_safe_path!(path)
|
97
|
+
path.gsub!(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR
|
98
|
+
end
|
72
99
|
end
|
73
100
|
end
|