summaryrefslogtreecommitdiff
path: root/omnibus
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-05-09 09:39:23 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2017-05-09 10:16:36 -0700
commit1b1a8b34c872bc55f2acf77e44ac70e6e1efcab7 (patch)
tree3c6789905e64f7f3f9e3343a61bd4f8ce7f5a737 /omnibus
parent0ad389f48d43ebfc4347c41a3573ee855993c5f1 (diff)
downloadchef-1b1a8b34c872bc55f2acf77e44ac70e6e1efcab7.tar.gz
simplify omnibus config and greenify builds again
this is also necessary for bundler-1.14.x i'm still not entirely clear why we ever needed all the fussy software gem configs or what the build-chef / build-chef-gem infrastructure ever did for us. it seems to have been mostly micro-optimization around building the software gems before bundle installing the project in order to take advantage of git caching. i aggressively don't care about that, this is quite fast enough. we can install nokogiri and libgecode early and that should take care of 98% of the build optimization issue. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'omnibus')
-rw-r--r--omnibus/Gemfile.lock18
-rw-r--r--omnibus/config/projects/chef.rb23
-rw-r--r--omnibus/config/software/chef-appbundle.rb18
-rw-r--r--omnibus/config/software/chef-cleanup.rb30
-rw-r--r--omnibus/config/software/chef-complete.rb20
-rw-r--r--omnibus/config/software/chef-gem-bcrypt_pbkdf-ruby.rb10
-rw-r--r--omnibus/config/software/chef-gem-binding_of_caller.rb10
-rw-r--r--omnibus/config/software/chef-gem-byebug.rb10
-rw-r--r--omnibus/config/software/chef-gem-debug_inspector.rb10
-rw-r--r--omnibus/config/software/chef-gem-ffi-yajl.rb12
-rw-r--r--omnibus/config/software/chef-gem-ffi.rb12
-rw-r--r--omnibus/config/software/chef-gem-inspec.rb10
-rw-r--r--omnibus/config/software/chef-gem-json.rb11
-rw-r--r--omnibus/config/software/chef-gem-libyajl2.rb10
-rw-r--r--omnibus/config/software/chef-gem-mini_portile2.rb10
-rw-r--r--omnibus/config/software/chef-gem-nokogiri.rb13
-rw-r--r--omnibus/config/software/chef-gem-ohai.rb10
-rw-r--r--omnibus/config/software/chef-gem-pkg-config.rb10
-rw-r--r--omnibus/config/software/chef-gem-rbnacl-libsodium.rb10
-rw-r--r--omnibus/config/software/chef-gem-ruby-prof.rb10
-rw-r--r--omnibus/config/software/chef-gem-ruby-shadow.rb11
-rw-r--r--omnibus/config/software/chef.rb88
-rw-r--r--omnibus/files/chef-appbundle/build-chef-appbundle.rb93
-rw-r--r--omnibus/files/chef-gem/build-chef-gem.rb128
-rw-r--r--omnibus/files/chef-gem/build-chef-gem/gem-install-software-def.rb155
-rw-r--r--omnibus/files/chef/build-chef.rb127
26 files changed, 26 insertions, 843 deletions
diff --git a/omnibus/Gemfile.lock b/omnibus/Gemfile.lock
index 3d32a97a15..caf63bef43 100644
--- a/omnibus/Gemfile.lock
+++ b/omnibus/Gemfile.lock
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/chef/license_scout
- revision: ff3cb28159e72414d63008f9a0d42e85d4aec4ba
+ revision: 92e9e27d71f457ea222b09c8fb3819bcb30a330a
specs:
license_scout (0.1.3)
ffi-yajl (~> 2.2)
@@ -25,7 +25,7 @@ GIT
GIT
remote: https://github.com/chef/omnibus-software
- revision: cae44c1a3ebf7207516813ba15b372231c253954
+ revision: 986940586711c0ea8895120605ed59e2cacdea26
specs:
omnibus-software (4.0.0)
chef-sugar (>= 3.4.0)
@@ -38,13 +38,13 @@ GEM
public_suffix (~> 2.0, >= 2.0.2)
artifactory (2.8.1)
awesome_print (1.7.0)
- aws-sdk (2.9.7)
- aws-sdk-resources (= 2.9.7)
- aws-sdk-core (2.9.7)
+ aws-sdk (2.9.15)
+ aws-sdk-resources (= 2.9.15)
+ aws-sdk-core (2.9.15)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
- aws-sdk-resources (2.9.7)
- aws-sdk-core (= 2.9.7)
+ aws-sdk-resources (2.9.15)
+ aws-sdk-core (= 2.9.15)
aws-sigv4 (1.0.0)
berkshelf (4.3.5)
addressable (~> 2.3, >= 2.3.4)
@@ -85,7 +85,7 @@ GEM
celluloid-io (0.16.2)
celluloid (>= 0.16.0)
nio4r (>= 1.1.0)
- chef-config (12.19.36)
+ chef-config (12.20.3)
addressable
fuzzyurl
mixlib-config (~> 2.0)
@@ -170,7 +170,7 @@ GEM
multipart-post (~> 2.0.0)
progressbar
zhexdump (>= 0.0.2)
- plist (3.2.0)
+ plist (3.3.0)
progressbar (1.8.2)
pry (0.10.4)
coderay (~> 1.1.0)
diff --git a/omnibus/config/projects/chef.rb b/omnibus/config/projects/chef.rb
index 10c2cd21b3..2342a7e186 100644
--- a/omnibus/config/projects/chef.rb
+++ b/omnibus/config/projects/chef.rb
@@ -1,5 +1,5 @@
#
-# Copyright 2012-2016, Chef Software, Inc.
+# Copyright 2012-2017, Chef Software Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -39,17 +39,28 @@ else
install_dir "#{default_root}/#{name}"
end
+override :chef, version: "local_source"
+
# Load dynamically updated overrides
overrides_path = File.expand_path("../../../../omnibus_overrides.rb", current_file)
instance_eval(IO.read(overrides_path), overrides_path)
-override :"ruby-windows-devkit", version: "4.5.2-20111229-1559" if windows? && windows_arch_i386?
-
dependency "preparation"
+dependency "chef"
+
+# FIXME?: might make sense to move dependencies below into the omnibus-software chef
+# definition or into a chef-complete definition added to omnibus-software.
+dependency "gem-permissions"
+dependency "shebang-cleanup"
+dependency "version-manifest"
+dependency "openssl-customization"
-# All actual dependencies are in chef-complete, so that the addition
-# or removal of a dependency doesn't dirty the entire project file
-dependency "chef-complete"
+# devkit needs to come dead last these days so we do not use it to compile any gems
+if windows?
+ override :"ruby-windows-devkit", version: "4.5.2-20111229-1559" if windows_arch_i386?
+ dependency "ruby-windows-devkit"
+ dependency "ruby-windows-devkit-bash"
+end
package :rpm do
signing_passphrase ENV["OMNIBUS_RPM_SIGNING_PASSPHRASE"]
diff --git a/omnibus/config/software/chef-appbundle.rb b/omnibus/config/software/chef-appbundle.rb
deleted file mode 100644
index 8ea21103fb..0000000000
--- a/omnibus/config/software/chef-appbundle.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-name "chef-appbundle"
-default_version "local_source"
-
-license :project_license
-skip_transitive_dependency_licensing true
-
-source path: project.files_path
-
-dependency "chef"
-
-build do
- # This is where we get the definitions below
- require_relative "../../files/chef-appbundle/build-chef-appbundle"
- extend BuildChefAppbundle
-
- appbundle_gem "chef"
- appbundle_gem "ohai"
-end
diff --git a/omnibus/config/software/chef-cleanup.rb b/omnibus/config/software/chef-cleanup.rb
deleted file mode 100644
index 302e841699..0000000000
--- a/omnibus/config/software/chef-cleanup.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-name "chef-cleanup"
-default_version "local_source"
-
-license :project_license
-skip_transitive_dependency_licensing true
-
-source path: project.files_path
-
-dependency "chef"
-
-build do
- # This is where we get the definitions below
- require_relative "../../files/chef/build-chef"
- extend BuildChef
-
- # Clear the now-unnecessary git caches, cached gems, and git-checked-out gems
- block "Delete bundler git cache and git installs" do
- gemdir = shellout!("#{gem_bin} environment gemdir", env: env).stdout.chomp
- remove_directory "#{gemdir}/cache"
- remove_directory "#{gemdir}/bundler"
- end
-
- delete "#{install_dir}/embedded/docs"
- delete "#{install_dir}/embedded/share/man"
- delete "#{install_dir}/embedded/share/doc"
- delete "#{install_dir}/embedded/share/gtk-doc"
- delete "#{install_dir}/embedded/ssl/man"
- delete "#{install_dir}/embedded/man"
- delete "#{install_dir}/embedded/info"
-end
diff --git a/omnibus/config/software/chef-complete.rb b/omnibus/config/software/chef-complete.rb
deleted file mode 100644
index 4e2b9f6ec2..0000000000
--- a/omnibus/config/software/chef-complete.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-name "chef-complete"
-
-license :project_license
-skip_transitive_dependency_licensing true
-
-dependency "chef"
-dependency "chef-appbundle"
-dependency "chef-cleanup"
-
-dependency "gem-permissions"
-dependency "shebang-cleanup"
-dependency "version-manifest"
-dependency "openssl-customization"
-
-if windows?
- # TODO can this be safely moved to before the chef?
- # It would make caching better ...
- dependency "ruby-windows-devkit"
- dependency "ruby-windows-devkit-bash"
-end
diff --git a/omnibus/config/software/chef-gem-bcrypt_pbkdf-ruby.rb b/omnibus/config/software/chef-gem-bcrypt_pbkdf-ruby.rb
deleted file mode 100644
index 1f7f4d3207..0000000000
--- a/omnibus/config/software/chef-gem-bcrypt_pbkdf-ruby.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "MIT"
-license_file "https://raw.githubusercontent.com/mfazekas/bcrypt_pbkdf-ruby/master/COPYING"
-skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef-gem-binding_of_caller.rb b/omnibus/config/software/chef-gem-binding_of_caller.rb
deleted file mode 100644
index 3e7a9f9c70..0000000000
--- a/omnibus/config/software/chef-gem-binding_of_caller.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "MIT"
-license_file "https://github.com/banister/binding_of_caller/blob/master/LICENSE"
-skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef-gem-byebug.rb b/omnibus/config/software/chef-gem-byebug.rb
deleted file mode 100644
index 3aef706e82..0000000000
--- a/omnibus/config/software/chef-gem-byebug.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "MIT"
-license_file "https://github.com/deivid-rodriguez/byebug/blob/master/LICENSE"
-skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef-gem-debug_inspector.rb b/omnibus/config/software/chef-gem-debug_inspector.rb
deleted file mode 100644
index ab818768ea..0000000000
--- a/omnibus/config/software/chef-gem-debug_inspector.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "MIT"
-license_file "https://github.com/banister/debug_inspector/blob/master/README.md"
-skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef-gem-ffi-yajl.rb b/omnibus/config/software/chef-gem-ffi-yajl.rb
deleted file mode 100644
index 44f98446bd..0000000000
--- a/omnibus/config/software/chef-gem-ffi-yajl.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "MIT"
-license_file "https://github.com/chef/ffi-yajl/blob/master/LICENSE"
-skip_transitive_dependency_licensing true
-
-dependency "chef-gem-libyajl2"
diff --git a/omnibus/config/software/chef-gem-ffi.rb b/omnibus/config/software/chef-gem-ffi.rb
deleted file mode 100644
index ea8879c2ac..0000000000
--- a/omnibus/config/software/chef-gem-ffi.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "BSD-3-Clause"
-license_file "https://github.com/ffi/ffi/blob/master/LICENSE"
-license_file "https://github.com/ffi/ffi/blob/master/COPYING"
-license_file "https://github.com/ffi/ffi/blob/master/LICENSE.SPECS"
-skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef-gem-inspec.rb b/omnibus/config/software/chef-gem-inspec.rb
deleted file mode 100644
index 8c5e1cbf26..0000000000
--- a/omnibus/config/software/chef-gem-inspec.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "Apache-2.0"
-license_file "https://raw.githubusercontent.com/chef/inspec/master/LICENSE"
-skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef-gem-json.rb b/omnibus/config/software/chef-gem-json.rb
deleted file mode 100644
index 9217359ba2..0000000000
--- a/omnibus/config/software/chef-gem-json.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "Ruby"
-license_file "https://github.com/flori/json/blob/master/README.md"
-license_file "https://www.ruby-lang.org/en/about/license.txt"
-skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef-gem-libyajl2.rb b/omnibus/config/software/chef-gem-libyajl2.rb
deleted file mode 100644
index 47ef42e1cf..0000000000
--- a/omnibus/config/software/chef-gem-libyajl2.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "Apache-2.0"
-license_file "https://github.com/chef/libyajl2-gem/blob/master/LICENSE"
-skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef-gem-mini_portile2.rb b/omnibus/config/software/chef-gem-mini_portile2.rb
deleted file mode 100644
index 36a2b833dd..0000000000
--- a/omnibus/config/software/chef-gem-mini_portile2.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "MIT"
-license_file "https://github.com/flavorjones/mini_portile/blob/master/LICENSE.txt"
-skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef-gem-nokogiri.rb b/omnibus/config/software/chef-gem-nokogiri.rb
deleted file mode 100644
index c6b8d03822..0000000000
--- a/omnibus/config/software/chef-gem-nokogiri.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "MIT"
-license_file "https://github.com/ruby-prof/ruby-prof/blob/master/LICENSE"
-skip_transitive_dependency_licensing true
-
-dependency "chef-gem-pkg-config"
-dependency "chef-gem-mini_portile2"
diff --git a/omnibus/config/software/chef-gem-ohai.rb b/omnibus/config/software/chef-gem-ohai.rb
deleted file mode 100644
index 7ee7ff4909..0000000000
--- a/omnibus/config/software/chef-gem-ohai.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "Apache-2.0"
-license_file "https://github.com/chef/ohai/blob/master/LICENSE"
-skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef-gem-pkg-config.rb b/omnibus/config/software/chef-gem-pkg-config.rb
deleted file mode 100644
index 051091b73f..0000000000
--- a/omnibus/config/software/chef-gem-pkg-config.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "LGPL-2.1"
-license_file "https://github.com/ruby-gnome2/pkg-config/blob/master/LGPL-2.1"
-skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef-gem-rbnacl-libsodium.rb b/omnibus/config/software/chef-gem-rbnacl-libsodium.rb
deleted file mode 100644
index 90bbc69dfb..0000000000
--- a/omnibus/config/software/chef-gem-rbnacl-libsodium.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "MIT"
-license_file "https://raw.githubusercontent.com/cryptosphere/rbnacl-libsodium/master/LICENSE"
-skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef-gem-ruby-prof.rb b/omnibus/config/software/chef-gem-ruby-prof.rb
deleted file mode 100644
index af90212d23..0000000000
--- a/omnibus/config/software/chef-gem-ruby-prof.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "BSD-2-Clause"
-license_file "https://github.com/ruby-prof/ruby-prof/blob/master/LICENSE"
-skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef-gem-ruby-shadow.rb b/omnibus/config/software/chef-gem-ruby-shadow.rb
deleted file mode 100644
index 02fc906d9d..0000000000
--- a/omnibus/config/software/chef-gem-ruby-shadow.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# gem installs this gem from the version specified in chef's Gemfile.lock
-# so we can take advantage of omnibus's caching. Just duplicate this file and
-# add the new software def to chef software def if you want to separate
-# another gem's installation.
-require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
-BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
-
-license "Public-Domain"
-license_file "https://github.com/apalmblad/ruby-shadow/blob/master/LICENSE"
-license_file "http://creativecommons.org/licenses/publicdomain/"
-skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef.rb b/omnibus/config/software/chef.rb
deleted file mode 100644
index 4726f8b687..0000000000
--- a/omnibus/config/software/chef.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-name "chef"
-default_version "local_source"
-
-license :project_license
-
-# For the specific super-special version "local_source", build the source from
-# the local git checkout. This is what you'd want to occur by default if you
-# just ran omnibus build locally.
-version("local_source") do
- source path: File.expand_path("../..", project.files_path),
- # Since we are using the local repo, we try to not copy any files
- # that are generated in the process of bundle installing omnibus.
- # If the install steps are well-behaved, this should not matter
- # since we only perform bundle and gem installs from the
- # omnibus cache source directory, but we do this regardless
- # to maintain consistency between what a local build sees and
- # what a github based build will see.
- options: { exclude: [ "omnibus/vendor" ] }
-end
-
-# For any version other than "local_source", fetch from github.
-if version != "local_source"
- source git: "git://github.com/chef/chef.git"
-end
-
-# For nokogiri
-dependency "libxml2"
-dependency "libxslt"
-dependency "liblzma"
-dependency "zlib"
-
-# ruby and bundler and friends
-dependency "ruby"
-dependency "rubygems"
-dependency "bundler"
-
-# Install all the native gems separately
-# Worst offenders first to take best advantage of cache:
-dependency "chef-gem-ffi-yajl"
-dependency "chef-gem-ohai"
-dependency "chef-gem-nokogiri" unless windows?
-dependency "chef-gem-libyajl2"
-dependency "chef-gem-ruby-prof"
-dependency "chef-gem-byebug"
-dependency "chef-gem-debug_inspector"
-dependency "chef-gem-binding_of_caller"
-dependency "chef-gem-inspec"
-unless ios_xr? || solaris?
- dependency "chef-gem-rbnacl-libsodium"
- dependency "chef-gem-bcrypt_pbkdf-ruby"
-end
-
-# Now everyone else, in alphabetical order because we don't care THAT much
-Dir.entries(File.dirname(__FILE__)).sort.each do |gem_software|
- if gem_software =~ /^(chef-gem-.+)\.rb$/
- dependency $1
- end
-end
-
-build do
- # This is where we get the definitions below
- require_relative "../../files/chef/build-chef"
- extend BuildChef
-
- project_env = env.dup
- project_env["BUNDLE_GEMFILE"] = project_gemfile
-
- # Prepare to install: build config, retries, job, frozen=true
- # TODO Windows install seems to sometimes install already-installed gems such
- # as gherkin (and fail as a result) if you use jobs > 1.
- create_bundle_config(project_gemfile, retries: 4, jobs: windows? ? 1 : 7, frozen: true)
-
- # Install all the things. Arguments are specified in .bundle/config (see create_bundle_config)
- block { log.info(log_key) { "" } }
- bundle "install --verbose", env: project_env
-
- # Check that it worked
- block { log.info(log_key) { "" } }
- bundle "check", env: project_env
-
- # fix up git-sourced gems
- properly_reinstall_git_and_path_sourced_gems
- install_shared_gemfile
-
- # Check that the final gemfile worked
- block { log.info(log_key) { "" } }
- bundle "check", env: env, cwd: File.dirname(shared_gemfile)
-end
diff --git a/omnibus/files/chef-appbundle/build-chef-appbundle.rb b/omnibus/files/chef-appbundle/build-chef-appbundle.rb
deleted file mode 100644
index eaf4904501..0000000000
--- a/omnibus/files/chef-appbundle/build-chef-appbundle.rb
+++ /dev/null
@@ -1,93 +0,0 @@
-require_relative "../chef-gem/build-chef-gem"
-
-module BuildChefAppbundle
- include BuildChefGem
-
- def lockdown_gem(gem_name)
- shared_gemfile = self.shared_gemfile
-
- # Update the Gemfile to restrict to built versions so that bundle installs
- # will do the right thing
- block "Lock down the #{gem_name} gem" do
- installed_path = shellout!("#{bundle_bin} show #{gem_name}", env: env, cwd: install_dir).stdout.chomp
- installed_gemfile = File.join(installed_path, "Gemfile")
-
- #
- # Include the main distribution Gemfile in the gem's Gemfile
- #
- # NOTE: if this fails and the build retries, you will see this multiple
- # times in the file.
- #
- distribution_gemfile = Pathname(shared_gemfile).relative_path_from(Pathname(installed_gemfile)).to_s
- gemfile_text = <<-EOM.gsub(/^\s+/, "")
- # Lock gems that are part of the distribution
- distribution_gemfile = File.expand_path(#{distribution_gemfile.inspect}, __FILE__)
- instance_eval(IO.read(distribution_gemfile), distribution_gemfile)
- EOM
- gemfile_text << IO.read(installed_gemfile)
- create_file(installed_gemfile) { gemfile_text }
-
- # Remove the gemfile.lock
- remove_file("#{installed_gemfile}.lock") if File.exist?("#{installed_gemfile}.lock")
-
- # If it's frozen, make it not be.
- shellout!("#{bundle_bin} config --delete frozen")
-
- # This could be changed to `bundle install` if we wanted to actually
- # install extra deps out of their gemfile ...
- shellout!("#{bundle_bin} lock", env: env, cwd: installed_path)
- # bundle lock doesn't always tell us when it fails, so we have to check :/
- unless File.exist?("#{installed_gemfile}.lock")
- raise "bundle lock failed: no #{installed_gemfile}.lock created!"
- end
-
- # Ensure all the gems we need are actually installed (if the bundle adds
- # something, we need to know about it so we can include it in the main
- # solve).
- # Save bundle config and modify to use --without development before checking
- bundle_config = File.expand_path("../.bundle/config", installed_gemfile)
- orig_config = IO.read(bundle_config) if File.exist?(bundle_config)
- # "test", "changelog" and "guard" come from berkshelf, "maintenance" comes from chef
- # "tools" and "integration" come from inspec
- shellout!("#{bundle_bin} config --local without #{without_groups.join(":")}", env: env, cwd: installed_path)
- shellout!("#{bundle_bin} config --local frozen 1")
-
- shellout!("#{bundle_bin} check", env: env, cwd: installed_path)
-
- # Restore bundle config
- if orig_config
- create_file(bundle_config) { orig_config }
- else
- remove_file bundle_config
- end
- end
- end
-
- # appbundle the gem, making /opt/chef/bin/<binary> do the superfast pinning
- # thing.
- #
- # To protect the app from loading the wrong versions of things, it uses
- # appbundler against the resulting file.
- #
- # Relocks the Gemfiles inside the specified gems (e.g. berkshelf, test-kitchen,
- # chef) to use the distribution's chosen gems.
- def appbundle_gem(gem_name)
- # First lock the gemfile down.
- lockdown_gem(gem_name)
-
- shared_gemfile = self.shared_gemfile
-
- # Ensure the main bin dir exists
- bin_dir = File.join(install_dir, "bin")
- mkdir(bin_dir)
-
- block "Lock down the #{gem_name} gem" do
- installed_path = shellout!("#{bundle_bin} show #{gem_name}", env: env, cwd: install_dir).stdout.chomp
-
- # appbundle the gem
- appbundler_args = [ installed_path, bin_dir, gem_name ]
- appbundler_args = appbundler_args.map { |a| ::Shellwords.escape(a) }
- shellout!("#{appbundler_bin} #{appbundler_args.join(" ")}", env: env, cwd: installed_path)
- end
- end
-end
diff --git a/omnibus/files/chef-gem/build-chef-gem.rb b/omnibus/files/chef-gem/build-chef-gem.rb
deleted file mode 100644
index c9aaaada1d..0000000000
--- a/omnibus/files/chef-gem/build-chef-gem.rb
+++ /dev/null
@@ -1,128 +0,0 @@
-require "shellwords"
-require "pathname"
-require "bundler"
-require_relative "../../../version_policy"
-
-# Common definitions and helpers (like compile environment and binary
-# locations) for all software definitions.
-module BuildChefGem
- PLATFORM_FAMILY_FAMILIES = {
- "linux" => %w{wrlinux debian fedora rhel suse gentoo slackware arch exherbo alpine},
- "bsd" => %w{dragonflybsd freebsd netbsd openbsd},
- "solaris" => %w{smartos omnios openindiana opensolaris solaris2 nextentacore},
- "aix" => %w{aix},
- "windows" => %w{windows},
- "mac_os_x" => %w{mac_os_x},
- }
- def platform_family_families
- PLATFORM_FAMILY_FAMILIES.keys
- end
-
- def platform_family_family
- PLATFORM_FAMILY_FAMILIES.
- select { |key, families| families.include?(Omnibus::Ohai["platform_family"]) }.
- first[0]
- end
-
- def embedded_bin(binary)
- windows_safe_path("#{install_dir}/embedded/bin/#{binary}")
- end
-
- def appbundler_bin
- embedded_bin("appbundler")
- end
-
- def bundle_bin
- embedded_bin("bundle")
- end
-
- def gem_bin
- embedded_bin("gem")
- end
-
- def rake_bin
- embedded_bin("rake")
- end
-
- def without_groups
- # Add --without for every known OS except the one we're in.
- exclude_os_groups = platform_family_families - [ platform_family_family ]
- (INSTALL_WITHOUT_GROUPS + exclude_os_groups).map { |g| g.to_sym }
- end
-
- #
- # Get the path to the top level shared Gemfile included by all individual
- # Gemfiles
- #
- def shared_gemfile
- File.join(install_dir, "Gemfile")
- end
-
- # A common env for building everything including nokogiri and dep-selector-libgecode
- def env
- env = with_standard_compiler_flags(with_embedded_path, bfd_flags: true)
-
- # From dep-selector-libgecode
- # On some RHEL-based systems, the default GCC that's installed is 4.1. We
- # need to use 4.4, which is provided by the gcc44 and gcc44-c++ packages.
- # These do not use the gcc binaries so we set the flags to point to the
- # correct version here.
- if File.exist?("/usr/bin/gcc44")
- env["CC"] = "gcc44"
- env["CXX"] = "g++44"
- end
-
- if solaris_11?
- env["CFLAGS"] << " -std=c99"
- env["CPPFLAGS"] << " -D_XOPEN_SOURCE=600 -D_XPG6"
- end
-
- # From dep-selector-libgecode
- # Ruby DevKit ships with BSD Tar
- env["PROG_TAR"] = "bsdtar" if windows?
- env["ARFLAGS"] = "rv #{env["ARFLAGS"]}" if env["ARFLAGS"]
-
- # Set up nokogiri environment and args
- env["NOKOGIRI_USE_SYSTEM_LIBRARIES"] = "true"
- env
- end
-
- #
- # Install arguments for various gems (to be passed to `gem install` or set in
- # `bundle config build.<gemname>`).
- #
- def all_install_args
- @all_install_args = {
- "nokogiri" => %W{
- --use-system-libraries
- --with-xml2-lib=#{Shellwords.escape("#{install_dir}/embedded/lib")}
- --with-xml2-include=#{Shellwords.escape("#{install_dir}/embedded/include/libxml2")}
- --with-xslt-lib=#{Shellwords.escape("#{install_dir}/embedded/lib")}
- --with-xslt-include=#{Shellwords.escape("#{install_dir}/embedded/include/libxslt")}
- --without-iconv-dir
- --with-zlib-dir=#{Shellwords.escape("#{install_dir}/embedded")}
- }.join(" "),
- }
- end
-
- # gem install arguments for a particular gem. "" if no special args.
- def install_args_for(gem_name)
- all_install_args[gem_name] || ""
- end
-
- # Give block all the variables
- def block(*args, &block)
- super do
- extend BuildChefGem
- instance_eval(&block)
- end
- end
-
- # Give build all the variables
- def build(*args, &block)
- super do
- extend BuildChefGem
- instance_eval(&block)
- end
- end
-end
diff --git a/omnibus/files/chef-gem/build-chef-gem/gem-install-software-def.rb b/omnibus/files/chef-gem/build-chef-gem/gem-install-software-def.rb
deleted file mode 100644
index ea6c32e94a..0000000000
--- a/omnibus/files/chef-gem/build-chef-gem/gem-install-software-def.rb
+++ /dev/null
@@ -1,155 +0,0 @@
-require "bundler"
-require "omnibus"
-require_relative "../build-chef-gem"
-require_relative "../../../../tasks/gemfile_util"
-
-module BuildChefGem
- class GemInstallSoftwareDef
- def self.define(software, software_filename)
- new(software, software_filename).send(:define)
- end
-
- include BuildChefGem
- include Omnibus::Logging
-
- protected
-
- def initialize(software, software_filename)
- @software = software
- @software_filename = software_filename
- end
-
- attr_reader :software, :software_filename
-
- # XXX: why are we programmatically defining config that is already expressed as code-as-configuration?
-
- def define
- # this has to come first because gem_metadata depends on it
- software.name "#{File.basename(software_filename)[0..-4]}"
- if installing_from_git?
- define_git
- else
- define_gem
- end
- end
-
- def define_git
- software.default_version gem_metadata[:ref]
-
- # If the source directory for building stuff changes, tell omnibus to de-cache us
- software.source git: gem_metadata[:git]
-
- # ruby and bundler and friends
- software.dependency "ruby"
- software.dependency "rubygems"
-
- software.relative_path gem_name
-
- gem_name = self.gem_name
-
- software.build do
- extend BuildChefGem
- gem "build #{gem_name}.gemspec", env: env
- gem "install #{gem_name}*.gem --no-ri --no-rdoc", env: env
- end
- end
-
- def define_gem
- software.default_version gem_version
-
- # If the source directory for building stuff changes, tell omnibus to
- # de-cache us
- software.source path: File.expand_path("../..", __FILE__)
-
- # ruby and bundler and friends
- software.dependency "ruby"
- software.dependency "rubygems"
-
- gem_name = self.gem_name
- gem_version = self.gem_version
- gem_metadata = self.gem_metadata
- lockfile_path = self.lockfile_path
-
- software.build do
- extend BuildChefGem
-
- if gem_version == "<skip>"
- if gem_metadata
- block do
- raise "can we just remove this use case? what is it for?"
- #log.info(log_key) { "#{gem_name} has source #{gem_metadata} in #{lockfile_path}. We only cache rubygems.org installs in omnibus to keep things simple. The chef step will build #{gem_name} ..." }
- end
- else
- block do
- log.info(log_key) { "#{gem_name} is not in the #{lockfile_path}. This can happen if your OS doesn't build it, or if chef no longer depends on it. Skipping ..." }
- end
- end
- else
- block do
- log.info(log_key) { "Found version #{gem_version} of #{gem_name} in #{lockfile_path}. Building early to take advantage of omnibus caching ..." }
- end
- gem "install #{gem_name} -v #{gem_version} --no-doc --no-ri --ignore-dependencies --verbose -- #{install_args_for(gem_name)}", env: env
- end
- end
- end
-
- # Path above omnibus (where Gemfile is)
- def root_path
- File.expand_path("../../../../..", __FILE__)
- end
-
- def gemfile_path
- File.join(root_path, "Gemfile")
- end
-
- def lockfile_path
- "#{gemfile_path}.lock"
- end
-
- def gem_name
- @gem_name ||= begin
- # File must be named chef-<gemname>.rb
- # Will look at chef/Gemfile.lock and install that version of the gem using "gem install"
- # (and only that version)
- if File.basename(software_filename) =~ /^chef-gem-(.+)\.rb$/
- $1
- else
- raise "#{software_filename} must be named chef-<gemname>.rb to build a gem automatically"
- end
- end
- end
-
- def gem_metadata
- @gem_metadata ||= begin
- bundle = GemfileUtil::Bundle.parse(gemfile_path, lockfile_path)
- result = bundle.gems[gem_name]
- if result
- if bundle.select_gems(without_groups: without_groups).include?(gem_name)
- log.info(software.name) { "Using #{gem_name} version #{result[:version]} from #{gemfile_path}" }
- result
- else
- log.info(software.name) { "#{gem_name} not loaded from #{gemfile_path} because it was only in groups #{without_groups.join(", ")}. Skipping ..." }
- nil
- end
- else
- log.info(software.name) { "#{gem_name} was not found in #{lockfile_path}. Skipping ..." }
- nil
- end
- end
- end
-
- def installing_from_git?
- gem_metadata && gem_metadata[:git] && gem_metadata[:ref]
- end
-
- def gem_version
- @gem_version ||= begin
- if gem_metadata && URI(gem_metadata[:source]) == URI("https://rubygems.org/")
- gem_metadata[:version]
- else
- "<skip>"
- end
- end
- end
- end
-end
diff --git a/omnibus/files/chef/build-chef.rb b/omnibus/files/chef/build-chef.rb
deleted file mode 100644
index 4b8ec78054..0000000000
--- a/omnibus/files/chef/build-chef.rb
+++ /dev/null
@@ -1,127 +0,0 @@
-require "shellwords"
-require "pathname"
-require "bundler"
-require_relative "../chef-gem/build-chef-gem"
-require_relative "../../../version_policy"
-
-# We use this to break up the `build` method into readable parts
-module BuildChef
- include BuildChefGem
-
- def create_bundle_config(gemfile, without: without_groups, retries: nil, jobs: nil, frozen: nil)
- bundle_config = File.expand_path("../.bundle/config", gemfile)
-
- block "Put build config into #{bundle_config}: #{{ without: without, retries: retries, jobs: jobs, frozen: frozen }}" do
- # bundle config build.nokogiri #{nokogiri_build_config} messes up the line,
- # so we write it directly ourselves.
- new_bundle_config = "---\n"
- new_bundle_config << "BUNDLE_WITHOUT: #{Array(without).join(":")}\n" if without
- new_bundle_config << "BUNDLE_RETRY: #{retries}\n" if retries
- new_bundle_config << "BUNDLE_JOBS: #{jobs}\n" if jobs
- new_bundle_config << "BUNDLE_FROZEN: '1'\n" if frozen
- all_install_args.each do |gem_name, install_args|
- new_bundle_config << "BUNDLE_BUILD__#{gem_name.upcase}: #{install_args}\n"
- end
- create_file(bundle_config) { new_bundle_config }
- end
- end
-
- #
- # Get the (possibly platform-specific) path to the Gemfile.
- #
- def project_gemfile
- File.join(project_dir, "Gemfile")
- end
-
- #
- # Some gems we installed don't end up in the `gem list` due to the fact that
- # they have git sources (`gem 'chef', github: 'chef/chef'`) or paths (`gemspec`
- # or `gem 'chef-config', path: 'chef-config'`). To get them in there, we need
- # to go through these gems, run `rake install` from their top level, and
- # then delete the git cached versions.
- #
- # Once we finish with all this, we update the Gemfile that will end up in the
- # top-level install so that it doesn't have git or path references anymore.
- #
- def properly_reinstall_git_and_path_sourced_gems
- # Emit blank line to separate different tasks
- block { log.info(log_key) { "" } }
- project_env = env.dup.merge("BUNDLE_GEMFILE" => project_gemfile)
-
- # Reinstall git-sourced or path-sourced gems, and delete the originals
- block "Reinstall git-sourced gems properly" do
- # Grab info about the gem environment so we can make decisions
- gemdir = shellout!("#{gem_bin} environment gemdir", env: env).stdout.chomp
- gem_install_dir = File.join(gemdir, "gems")
-
- # bundle list --paths gets us the list of gem install paths. Get the ones
- # that are installed local (git and path sources like `gem :x, github: 'chef/x'`
- # or `gem :x, path: '.'` or `gemspec`). To do this, we just detect which ones
- # have properly-installed paths (in the `gems` directory that shows up when
- # you run `gem list`).
- locally_installed_gems = shellout!("#{bundle_bin} list --paths", env: project_env, cwd: project_dir).
- stdout.lines.select { |gem_path| !gem_path.start_with?(gem_install_dir) }
-
- # Install the gems for real using `rake install` in their directories
- locally_installed_gems.each do |gem_path|
- gem_path = gem_path.chomp
- # We use the already-installed bundle to rake install, because (hopefully)
- # just rake installing doesn't require anything special.
- # Emit blank line to separate different tasks
- log.info(log_key) { "" }
- log.info(log_key) { "Properly installing git or path sourced gem #{gem_path} using rake install" }
- shellout!("#{bundle_bin} exec #{rake_bin} install", env: project_env, cwd: gem_path)
- end
- end
- end
-
- def install_shared_gemfile
- # Emit blank line to separate different tasks
- block { log.info(log_key) { "" } }
-
- shared_gemfile = self.shared_gemfile
- project_env = env.dup.merge("BUNDLE_GEMFILE" => project_gemfile)
-
- # Show the config for good measure
- bundle "config", env: project_env
-
- # Make `Gemfile` point to these by removing path and git sources and pinning versions.
- block "Rewrite Gemfile using all properly-installed gems" do
- gem_pins = ""
- result = []
- shellout!("#{bundle_bin} list", env: project_env).stdout.lines.map do |line|
- if line =~ /^\s*\*\s*(\S+)\s+\((\S+).*\)\s*$/
- name, version = $1, $2
- # rubocop is an exception, since different projects disagree
- next if GEMS_ALLOWED_TO_FLOAT.include?(name)
- gem_pins << "gem #{name.inspect}, #{version.inspect}, override: true\n"
- end
- end
-
- # Find the installed chef gem by looking for lib/chef.rb
- chef_gem = File.expand_path("../..", shellout!("#{gem_bin} which chef", env: project_env).stdout.chomp)
- # Figure out the path to gemfile_util from there
- gemfile_util = Pathname.new(File.join(chef_gem, "tasks", "gemfile_util"))
- gemfile_util = gemfile_util.relative_path_from(Pathname.new(shared_gemfile).dirname)
-
- create_file(shared_gemfile) { <<-EOM }
- # Meant to be included in component Gemfiles at the beginning with:
- #
- # instance_eval(IO.read("#{install_dir}/Gemfile"), "#{install_dir}/Gemfile")
- #
- # Override any existing gems with our own.
- require_relative "#{gemfile_util}"
- extend GemfileUtil
- #{gem_pins}
- EOM
- end
-
- shared_gemfile_env = env.dup.merge("BUNDLE_GEMFILE" => shared_gemfile)
-
- # Create a `Gemfile.lock` at the final location
- bundle "lock", env: shared_gemfile_env
-
- # Freeze the location's Gemfile.lock.
- create_bundle_config(shared_gemfile, frozen: true)
- end
-end