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
@@ -0,0 +1,79 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 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
|
+
#
|
18
|
+
# This file contains the deprecated commands. This class, its references, and
|
19
|
+
# any associated tests should be removed in the next major release.
|
20
|
+
#
|
21
|
+
# @todo Remove in 4.0
|
22
|
+
#
|
23
|
+
module Omnibus
|
24
|
+
class Command::Base
|
25
|
+
class << self
|
26
|
+
alias_method :old_dispatch, :dispatch
|
27
|
+
def dispatch(m, args, options, config)
|
28
|
+
# Handle old --timestamp
|
29
|
+
if args.include?('--timestamp') || args.include?('-t')
|
30
|
+
warn("The '--timestamp' option has been deprecated! Please use '--override append_timestamp:true' instead.")
|
31
|
+
args.delete('--timestamp')
|
32
|
+
args.delete('-t')
|
33
|
+
args += %w(--override append_timestamp:true)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Handle old --no-timestamp
|
37
|
+
if args.include?('--no-timestamp')
|
38
|
+
warn("The '--no-timestamp' option has been deprecated! Please use '--override append_timestamp:false' instead.")
|
39
|
+
args.delete('--no-timestamp')
|
40
|
+
args += %w(--override append_timestamp:false)
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# Legacy build command:
|
45
|
+
#
|
46
|
+
# $ omnibus build project PROJECT
|
47
|
+
#
|
48
|
+
if args[0..1] == %w(build project)
|
49
|
+
warn("The interface for building a project has changed. Please use 'omnibus build hamlet' instead.")
|
50
|
+
args.delete_at(1)
|
51
|
+
return old_dispatch(m, args, options, config)
|
52
|
+
end
|
53
|
+
|
54
|
+
#
|
55
|
+
# Legacy software builder:
|
56
|
+
#
|
57
|
+
# $ omnibus build software SOFTWARE
|
58
|
+
#
|
59
|
+
if args[0..1] == %w(build software)
|
60
|
+
raise 'Building individual software definitions is no longer supported!'
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# Legacy generator:
|
65
|
+
#
|
66
|
+
# $ omnibus project PROJECT
|
67
|
+
#
|
68
|
+
if args[0] == 'project'
|
69
|
+
warn("The project generator has been renamed to 'omnibus new'. Please use 'omnibus new' in the future.")
|
70
|
+
args[0] = 'new'
|
71
|
+
return old_dispatch(m, args, options, config)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Dispatch everything else down the stack
|
75
|
+
old_dispatch(m, args, options, config)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/lib/omnibus/cli/release.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright
|
3
|
-
# License:: Apache License, Version 2.0
|
2
|
+
# Copyright 2013-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.
|
@@ -15,30 +14,27 @@
|
|
15
14
|
# limitations under the License.
|
16
15
|
#
|
17
16
|
|
18
|
-
require 'omnibus/cli/base'
|
19
|
-
require 'omnibus/cli/application'
|
20
|
-
require 'omnibus/package_release'
|
21
|
-
require 'json'
|
22
|
-
|
23
17
|
module Omnibus
|
24
|
-
|
25
|
-
|
26
|
-
namespace :release
|
18
|
+
class Command::Release < Command::Base
|
19
|
+
namespace :release
|
27
20
|
|
28
|
-
|
29
|
-
|
30
|
-
|
21
|
+
class_option :target,
|
22
|
+
aliases: '-t',
|
23
|
+
desc: 'The target backend to release the package',
|
24
|
+
default: 'S3'
|
31
25
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
method_option :public,
|
27
|
+
type: :boolean,
|
28
|
+
desc: 'Make S3 object publicly readable',
|
29
|
+
default: false
|
30
|
+
desc 'package PATH', 'Upload a single package to S3'
|
31
|
+
def package(path)
|
32
|
+
access_policy = options[:public] ? :public_read : :private
|
36
33
|
|
37
|
-
|
38
|
-
|
39
|
-
end
|
40
|
-
uploader.release
|
34
|
+
uploader = PackageRelease.new(path, access: access_policy) do |uploaded_item|
|
35
|
+
say("Uploaded #{uploaded_item}", :green)
|
41
36
|
end
|
37
|
+
uploader.release
|
42
38
|
end
|
43
39
|
end
|
44
40
|
end
|
data/lib/omnibus/config.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.
|
@@ -16,8 +15,6 @@
|
|
16
15
|
#
|
17
16
|
|
18
17
|
require 'mixlib/config'
|
19
|
-
require 'omnibus/exceptions'
|
20
|
-
require 'json'
|
21
18
|
|
22
19
|
module Omnibus
|
23
20
|
# Global configuration object for Omnibus runs.
|
@@ -29,6 +26,16 @@ module Omnibus
|
|
29
26
|
class Config
|
30
27
|
extend Mixlib::Config
|
31
28
|
|
29
|
+
# Converts a given path to a platform specific path based on windows or
|
30
|
+
# linux.
|
31
|
+
def self.platformize_omnibus_path(path)
|
32
|
+
if Ohai.platform == 'windows'
|
33
|
+
File.join('C:\\omnibus-ruby', path).gsub(File::SEPARATOR, File::ALT_SEPARATOR)
|
34
|
+
else
|
35
|
+
File.join('/var/cache/omnibus', path)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
32
39
|
# @!group Directory Configuration Parameters
|
33
40
|
|
34
41
|
# @!attribute [rw] cache_dir
|
@@ -38,7 +45,7 @@ module Omnibus
|
|
38
45
|
# Defaults to `"/var/cache/omnibus/cache"`.
|
39
46
|
#
|
40
47
|
# @return [String]
|
41
|
-
default
|
48
|
+
default(:cache_dir) { platformize_omnibus_path('cache') }
|
42
49
|
|
43
50
|
# @!attribute [rw] install_path_cache_dir
|
44
51
|
# The absolute path to the directory on the virtual machine where
|
@@ -47,7 +54,7 @@ module Omnibus
|
|
47
54
|
# Defaults to `"/var/cache/omnibus/cache/install_path"`.
|
48
55
|
#
|
49
56
|
# @return [String]
|
50
|
-
default
|
57
|
+
default(:install_path_cache_dir) { platformize_omnibus_path('cache/install_path') }
|
51
58
|
|
52
59
|
# @!attribute [rw] source_dir
|
53
60
|
# The absolute path to the directory on the virtual machine where
|
@@ -56,7 +63,7 @@ module Omnibus
|
|
56
63
|
# Defaults to `"/var/cache/omnibus/src"`.
|
57
64
|
#
|
58
65
|
# @return [String]
|
59
|
-
default
|
66
|
+
default(:source_dir) { platformize_omnibus_path('src') }
|
60
67
|
|
61
68
|
# @!attribute [rw] build_dir
|
62
69
|
# The absolute path to the directory on the virtual machine where
|
@@ -65,7 +72,7 @@ module Omnibus
|
|
65
72
|
# Defaults to `"/var/cache/omnibus/build"`.
|
66
73
|
#
|
67
74
|
# @return [String]
|
68
|
-
default
|
75
|
+
default(:build_dir) { platformize_omnibus_path('build') }
|
69
76
|
|
70
77
|
# @!attribute [rw] package_dir
|
71
78
|
# The absolute path to the directory on the virtual machine where
|
@@ -74,7 +81,7 @@ module Omnibus
|
|
74
81
|
# Defaults to `"/var/cache/omnibus/pkg"`.
|
75
82
|
#
|
76
83
|
# @return [String]
|
77
|
-
default
|
84
|
+
default(:package_dir) { platformize_omnibus_path('pkg') }
|
78
85
|
|
79
86
|
# @!attribute [rw] package_tmp
|
80
87
|
# The absolute path to the directory on the virtual machine where
|
@@ -85,7 +92,7 @@ module Omnibus
|
|
85
92
|
# Defaults to `"/var/cache/omnibus/pkg-tmp"`.
|
86
93
|
#
|
87
94
|
# @return [String]
|
88
|
-
default
|
95
|
+
default(:package_tmp) { platformize_omnibus_path('pkg-tmp') }
|
89
96
|
|
90
97
|
# @!attribute [rw] project_dir
|
91
98
|
# The relative path of the directory containing {Omnibus::Project}
|
@@ -112,7 +119,7 @@ module Omnibus
|
|
112
119
|
# Defaults to the current working directory.
|
113
120
|
#
|
114
121
|
# @return [String]
|
115
|
-
default
|
122
|
+
default(:project_root) { Dir.pwd }
|
116
123
|
|
117
124
|
# @!attribute [rw] install_dir
|
118
125
|
# Installation directory
|
@@ -127,7 +134,7 @@ module Omnibus
|
|
127
134
|
|
128
135
|
# @!endgroup
|
129
136
|
|
130
|
-
# @!group DMG configuration options
|
137
|
+
# @!group DMG / PKG configuration options
|
131
138
|
|
132
139
|
# @!attribute [rw] build_dmg
|
133
140
|
# Package OSX pkg files inside a DMG
|
@@ -149,6 +156,22 @@ module Omnibus
|
|
149
156
|
# @return [String]
|
150
157
|
default :dmg_pkg_position, '535, 50'
|
151
158
|
|
159
|
+
# @!attribute [rw] sign_pkg
|
160
|
+
# Sign the pkg package.
|
161
|
+
#
|
162
|
+
# Default is false.
|
163
|
+
#
|
164
|
+
# @return [Boolean]
|
165
|
+
default :sign_pkg, false
|
166
|
+
|
167
|
+
# @!attribute [rw] signing_identity
|
168
|
+
# The identity to sign the pkg with.
|
169
|
+
#
|
170
|
+
# Default is nil. Required if sign_pkg is set.
|
171
|
+
#
|
172
|
+
# @return [String]
|
173
|
+
default :signing_identity, nil
|
174
|
+
|
152
175
|
# @!endgroup
|
153
176
|
|
154
177
|
# @!group S3 Caching Configuration Parameters
|
@@ -245,6 +268,7 @@ module Omnibus
|
|
245
268
|
# @!group Build Version Parameters
|
246
269
|
|
247
270
|
# @!attribute [rw] append_timestamp
|
271
|
+
# Append the current timestamp to the version identifier.
|
248
272
|
#
|
249
273
|
# @return [Boolean]
|
250
274
|
default :append_timestamp, true
|
@@ -254,6 +278,7 @@ module Omnibus
|
|
254
278
|
# @!group Build Control Parameters
|
255
279
|
|
256
280
|
# @! attribute [rw] build_retries
|
281
|
+
# The number of times to retry the build before failing.
|
257
282
|
#
|
258
283
|
# @return [Integer, nil]
|
259
284
|
default :build_retries, 3
|
@@ -274,7 +299,7 @@ module Omnibus
|
|
274
299
|
def self.valid_s3_config?
|
275
300
|
if use_s3_caching
|
276
301
|
unless s3_bucket
|
277
|
-
|
302
|
+
raise InvalidS3Configuration.new(s3_bucket, s3_access_key, s3_secret_key)
|
278
303
|
end
|
279
304
|
end
|
280
305
|
end
|
data/lib/omnibus/exceptions.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 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
|
+
|
1
17
|
module Omnibus
|
2
18
|
class AbstractMethod < RuntimeError
|
3
19
|
def initialize(signature)
|
@@ -9,6 +25,23 @@ module Omnibus
|
|
9
25
|
end
|
10
26
|
end
|
11
27
|
|
28
|
+
class ProjectNotFound < RuntimeError
|
29
|
+
def initialize(name)
|
30
|
+
@name = name
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_s
|
34
|
+
out = "I could not find an Omnibus project named '#{@name}'! "
|
35
|
+
out << "Valid projects are:\n"
|
36
|
+
|
37
|
+
Omnibus.project_names.sort.each do |project_name|
|
38
|
+
out << " * #{project_name}\n"
|
39
|
+
end
|
40
|
+
|
41
|
+
out.strip
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
12
45
|
class MissingAsset < RuntimeError
|
13
46
|
def initialize(path)
|
14
47
|
@path = path
|
@@ -25,29 +58,48 @@ module Omnibus
|
|
25
58
|
end
|
26
59
|
|
27
60
|
def to_s
|
28
|
-
|
29
|
-
|
61
|
+
<<-EOH
|
62
|
+
One or more required S3 configuration values is missing.
|
30
63
|
|
31
|
-
|
64
|
+
Your effective configuration was the following:
|
32
65
|
|
33
|
-
|
34
|
-
|
35
|
-
|
66
|
+
s3_bucket #{@s3_bucket.inspect}
|
67
|
+
s3_access_key #{@s3_access_key.inspect}
|
68
|
+
s3_secret_key #{@s3_secret_key.inspect}
|
36
69
|
|
37
|
-
|
38
|
-
|
70
|
+
If you truly do want S3 caching, you should add values similar to the following
|
71
|
+
in your Omnibus config file:
|
39
72
|
|
40
|
-
|
41
|
-
|
42
|
-
|
73
|
+
s3_bucket ENV['S3_BUCKET_NAME']
|
74
|
+
s3_access_key ENV['S3_ACCESS_KEY']
|
75
|
+
s3_secret_key ENV['S3_SECRET_KEY']
|
43
76
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
77
|
+
Note that you are not required to use environment variables as illustrated (and
|
78
|
+
the ones listed have no special significance in Omnibus), but it is encouraged
|
79
|
+
to prevent spread of sensitive information and inadvertent check-in of same to
|
80
|
+
version control systems.
|
81
|
+
EOH
|
82
|
+
end
|
83
|
+
end
|
49
84
|
|
50
|
-
|
85
|
+
class BadReplacesLine < RuntimeError
|
86
|
+
def to_s
|
87
|
+
<<-EOH
|
88
|
+
The `replaces` project DSL statement should never equal the `package_name` or
|
89
|
+
`name` of a project. The `replaces` option should only be used when you have
|
90
|
+
published an artifact under one name and then later renamed the packages that
|
91
|
+
you are publishing and you must obsolete the old package name. For example this
|
92
|
+
is used, correctly, in chef-client builds:
|
93
|
+
|
94
|
+
name 'chef'
|
95
|
+
replaces 'chef-full'
|
96
|
+
|
97
|
+
The RPMs and debs which were originally published were named "chef-full" and
|
98
|
+
this was later renamed, and in order to upgrade the (very old) "chef-full"
|
99
|
+
packages the new "chef" packages needed to know to uninstall any "chef-full"
|
100
|
+
packages that were found. Projects which have never been renamed, however,
|
101
|
+
should never use the replaces line.
|
102
|
+
EOH
|
51
103
|
end
|
52
104
|
end
|
53
105
|
|
@@ -135,7 +187,7 @@ module Omnibus
|
|
135
187
|
# been set.
|
136
188
|
class MissingSoftwareConfiguration < RuntimeError
|
137
189
|
def initialize(software_name, parameter_name, sample_value)
|
138
|
-
@software_name, @parameter_name, @sample_value =
|
190
|
+
@software_name, @parameter_name, @sample_value = software_name, parameter_name, sample_value
|
139
191
|
end
|
140
192
|
|
141
193
|
def to_s
|
data/lib/omnibus/fetcher.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.
|
@@ -57,6 +56,7 @@ module Omnibus
|
|
57
56
|
# @todo If {Omnibus::Fetcher#description} is meant to show
|
58
57
|
# parameters (presumably the kind of fetcher and the software it
|
59
58
|
# is fetching?),
|
59
|
+
# @todo make this use the logger
|
60
60
|
def explain(why)
|
61
61
|
$stderr.puts '* ' * 40
|
62
62
|
$stderr.puts why
|
@@ -125,14 +125,12 @@ module Omnibus
|
|
125
125
|
elsif software.source[:path]
|
126
126
|
PathFetcher.new(software)
|
127
127
|
else
|
128
|
-
|
128
|
+
raise UnsupportedSourceLocation, "Don't know how to fetch software project #{software}"
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
|
133
|
-
|
134
|
-
@name
|
135
|
-
end
|
132
|
+
include Logging
|
133
|
+
include Util
|
136
134
|
|
137
135
|
attr_reader :name
|
138
136
|
|
@@ -140,10 +138,7 @@ module Omnibus
|
|
140
138
|
attr_reader :source_timefile
|
141
139
|
|
142
140
|
def initialize(software)
|
143
|
-
|
144
|
-
|
145
|
-
def log(message)
|
146
|
-
puts "[fetcher:#{self.class.name}::#{name}] #{message}"
|
141
|
+
@software = software
|
147
142
|
end
|
148
143
|
|
149
144
|
# @!group Methods for Subclasses to Implement
|
@@ -175,6 +170,18 @@ module Omnibus
|
|
175
170
|
def version_guid
|
176
171
|
end
|
177
172
|
|
173
|
+
# Returns the version to be used during build caching.
|
174
|
+
# By default fetchers don't override the versions.
|
175
|
+
def version_for_cache
|
176
|
+
nil
|
177
|
+
end
|
178
|
+
|
179
|
+
private
|
180
|
+
|
181
|
+
def log_key
|
182
|
+
@log_key ||= "#{super}: #{@software.name}"
|
183
|
+
end
|
184
|
+
|
178
185
|
# !@endgroup
|
179
186
|
end
|
180
187
|
end
|