summaryrefslogtreecommitdiff
path: root/omnibus/config/software
diff options
context:
space:
mode:
authorKartik Null Cating-Subramanian <ksubramanian@chef.io>2016-01-08 13:22:45 -0800
committerKartik Null Cating-Subramanian <ksubramanian@chef.io>2016-01-08 13:22:45 -0800
commit5a0031d962402221b580df270e8802b71d5ea1f0 (patch)
treec57c56e8115c04e14f40ecad2b83c2d8f0f99fcf /omnibus/config/software
parentc9d7e017de225db3e8b8610dc7e2f41242dbe730 (diff)
parent286c306edfb9c5b90a6c1f382defb9efd1580e96 (diff)
downloadchef-5a0031d962402221b580df270e8802b71d5ea1f0.tar.gz
Import all of omnibus-chef under the omnibus directory
Diffstat (limited to 'omnibus/config/software')
-rw-r--r--omnibus/config/software/chef-init.rb38
-rw-r--r--omnibus/config/software/chefdk-env-customization.rb41
-rw-r--r--omnibus/config/software/chefdk.rb76
-rw-r--r--omnibus/config/software/openssl-customization.rb95
-rw-r--r--omnibus/config/software/opscode-pushy-client.rb54
-rw-r--r--omnibus/config/software/rubygems-customization.rb52
-rw-r--r--omnibus/config/software/shebang-cleanup.rb92
7 files changed, 448 insertions, 0 deletions
diff --git a/omnibus/config/software/chef-init.rb b/omnibus/config/software/chef-init.rb
new file mode 100644
index 0000000000..a599abe10a
--- /dev/null
+++ b/omnibus/config/software/chef-init.rb
@@ -0,0 +1,38 @@
+#
+# Copyright 2012-2014 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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name "chef-init"
+default_version "master"
+
+source git: "https://github.com/opscode/chef-init"
+
+relative_path "chef-init"
+
+dependency "bundler"
+dependency "chef"
+dependency "runit"
+
+build do
+ env = with_standard_compiler_flags(with_embedded_path)
+
+ bundle "install", env: env
+
+ gem "build chef-init.gemspec", env: env
+ gem "install chef-init*.gem" \
+ " --no-ri --no-rdoc", env: env
+
+ appbundle 'chef-init'
+end
diff --git a/omnibus/config/software/chefdk-env-customization.rb b/omnibus/config/software/chefdk-env-customization.rb
new file mode 100644
index 0000000000..fe36072574
--- /dev/null
+++ b/omnibus/config/software/chefdk-env-customization.rb
@@ -0,0 +1,41 @@
+#
+# Copyright:: Copyright (c) 2015 Chef Software, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is a windows only dependency
+
+name "chefdk-env-customization"
+
+source path: "#{project.files_path}/#{name}"
+
+dependency "ruby-windows"
+
+build do
+ block "Add chefdk_env_customization file" do
+ source_customization_file = "#{project_dir}/windows/chefdk_env_customization.rb"
+
+ site_ruby = Bundler.with_clean_env do
+ ruby = windows_safe_path("#{install_dir}/embedded/bin/ruby")
+ %x|#{ruby} -rrbconfig -e "puts RbConfig::CONFIG['sitelibdir']"|.strip
+ end
+
+ if site_ruby.nil? || site_ruby.empty?
+ raise "Could not determine embedded Ruby's site directory, aborting!"
+ end
+
+ FileUtils.cp source_customization_file, site_ruby
+ end
+end
diff --git a/omnibus/config/software/chefdk.rb b/omnibus/config/software/chefdk.rb
new file mode 100644
index 0000000000..4f4938953a
--- /dev/null
+++ b/omnibus/config/software/chefdk.rb
@@ -0,0 +1,76 @@
+#
+# Copyright 2012-2014 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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name "chefdk"
+default_version "master"
+
+source git: "git://github.com/chef/chef-dk.git"
+
+relative_path "chef-dk"
+
+if windows?
+ dependency "ruby-windows"
+ dependency "ruby-windows-devkit"
+else
+ dependency "libffi" if debian?
+ dependency "ruby"
+end
+
+dependency "rubygems"
+dependency "bundler"
+dependency "appbundler"
+dependency "chef"
+dependency "berkshelf"
+dependency "chef-vault"
+dependency "foodcritic"
+dependency "ohai"
+dependency "inspec"
+dependency "rubocop"
+dependency "test-kitchen"
+dependency "kitchen-inspec"
+dependency "kitchen-vagrant"
+# This is a TK dependency but isn't declared in that software definition
+# because it is an optional dependency but we want to give it to ChefDK users
+dependency "winrm-transport"
+dependency "openssl-customization"
+dependency "knife-windows"
+dependency "knife-spork"
+dependency "fauxhai"
+dependency "chefspec"
+
+dependency "chefdk-env-customization" if windows?
+
+build do
+ env = with_standard_compiler_flags(with_embedded_path).merge(
+ # Rubocop pulls in nokogiri 1.5.11, so needs PKG_CONFIG_PATH and
+ # NOKOGIRI_USE_SYSTEM_LIBRARIES until rubocop stops doing that
+ "PKG_CONFIG_PATH" => "#{install_dir}/embedded/lib/pkgconfig",
+ "NOKOGIRI_USE_SYSTEM_LIBRARIES" => "true",
+ )
+
+ bundle "install", env: env
+ gem "build chef-dk.gemspec", env: env
+ gem "install chef-dk*.gem" \
+ " --no-ri --no-rdoc" \
+ " --verbose", env: env
+
+ appbundle 'berkshelf'
+ appbundle 'chefdk'
+ appbundle 'chef-vault'
+ appbundle 'foodcritic'
+ appbundle 'rubocop'
+ appbundle 'test-kitchen'
+end
diff --git a/omnibus/config/software/openssl-customization.rb b/omnibus/config/software/openssl-customization.rb
new file mode 100644
index 0000000000..8af23e12fd
--- /dev/null
+++ b/omnibus/config/software/openssl-customization.rb
@@ -0,0 +1,95 @@
+#
+# Copyright:: Copyright (c) 2014 Chef Software, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This software makes sure that SSL_CERT_FILE environment variable is pointed
+# to the bundled CA certificates that ship with omnibus. With this, Chef
+# tools can be used with https URLs out of the box.
+name "openssl-customization"
+
+source path: "#{project.files_path}/#{name}"
+
+if windows?
+ dependency "ruby-windows"
+else
+ dependency "ruby"
+ dependency "rubygems"
+end
+
+fips_enabled = (project.overrides[:fips] && project.overrides[:fips][:enabled]) || false
+
+build do
+ block "Add OpenSSL customization file" do
+ # gets directories for RbConfig::CONFIG and sanitizes them.
+ def get_sanitized_rbconfig(config)
+ ruby = windows_safe_path("#{install_dir}/embedded/bin/ruby")
+
+ config_dir = Bundler.with_clean_env do
+ command_output = %x|#{ruby} -rrbconfig -e "puts RbConfig::CONFIG['#{config}']"|.strip
+ windows_safe_path(command_output)
+ end
+
+ if config_dir.nil? || config_dir.empty?
+ raise "could not determine embedded ruby's RbConfig::CONFIG['#{config}']"
+ end
+
+ config_dir
+ end
+
+ fips_additions = [
+ "OpenSSL.fips_mode = true",
+ "require 'digest'",
+ "require 'digest/sha1'",
+ "Digest::SHA1 = OpenSSL::Digest::SHA1",
+
+ "require 'digest/md5'",
+ "# We're going to use the ruby md5 implementation for now",
+ "# This will be removed once all our MD5 uses are removed",
+ "OpenSSL::Digest::MD5 = Digest::MD5",
+ ].join("\n")
+
+ if windows?
+ embedded_ruby_site_dir = get_sanitized_rbconfig('sitelibdir')
+ embedded_ruby_lib_dir = get_sanitized_rbconfig('rubylibdir')
+
+ source_ssl_env_hack = File.join(project_dir, "windows", "ssl_env_hack.rb")
+ destination_ssl_env_hack = File.join(embedded_ruby_site_dir, "ssl_env_hack.rb")
+
+ copy(source_ssl_env_hack, destination_ssl_env_hack)
+
+ # Unfortunately there is no patch on windows, but luckily we only need to append a line to the openssl.rb
+ # to pick up our script which find the CA bundle in omnibus installations and points SSL_CERT_FILE to it
+ # if it's not already set
+ source_openssl_rb = File.join(embedded_ruby_lib_dir, "openssl.rb")
+ File.open(source_openssl_rb, "r+") do |f|
+ unpatched_openssl_rb = f.read
+ f.rewind
+ f.write("\nrequire 'ssl_env_hack'\n")
+ f.write(unpatched_openssl_rb)
+ f.write(fips_additions) if fips_enabled
+ end
+ else
+ embedded_ruby_lib_dir = get_sanitized_rbconfig('rubylibdir')
+ source_openssl_rb = File.join(embedded_ruby_lib_dir, "openssl.rb")
+ File.open(source_openssl_rb, "r+") do |f|
+ unpatched_openssl_rb = f.read
+ f.rewind
+ f.write(unpatched_openssl_rb)
+ f.write(fips_additions) if fips_enabled
+ end
+ end
+ end
+end
diff --git a/omnibus/config/software/opscode-pushy-client.rb b/omnibus/config/software/opscode-pushy-client.rb
new file mode 100644
index 0000000000..bb85d0960b
--- /dev/null
+++ b/omnibus/config/software/opscode-pushy-client.rb
@@ -0,0 +1,54 @@
+#
+# Copyright:: Copyright (c) 2013 Opscode, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name "opscode-pushy-client"
+
+default_version "master"
+
+source git: "git://github.com/opscode/opscode-pushy-client"
+
+relative_path "opscode-pushy-client"
+
+dependency "rubygems"
+dependency "bundler"
+dependency "appbundler"
+dependency "chef"
+dependency "openssl-customization"
+
+if windows?
+ dependency "libzmq4x-windows"
+else
+ dependency "libzmq"
+end
+
+build do
+ env = with_standard_compiler_flags(with_embedded_path)
+
+ zmq_lib_dir = if windows?
+ "#{install_dir}/embedded/bin"
+ else
+ "#{install_dir}/embedded/lib"
+ end
+
+ bundle "install", env: env
+ gem "build opscode-pushy-client.gemspec", env: env
+ gem "install opscode-pushy-client*.gem" \
+ " --no-ri --no-rdoc" \
+ " --verbose", env: env
+
+ appbundle 'opscode-pushy-client'
+end
diff --git a/omnibus/config/software/rubygems-customization.rb b/omnibus/config/software/rubygems-customization.rb
new file mode 100644
index 0000000000..2d65657569
--- /dev/null
+++ b/omnibus/config/software/rubygems-customization.rb
@@ -0,0 +1,52 @@
+#
+# Copyright:: Copyright (c) 2014 Chef Software, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name "rubygems-customization"
+
+source path: "#{project.files_path}/#{name}"
+
+if windows?
+ dependency "ruby-windows"
+else
+ dependency "ruby"
+end
+
+dependency "rubygems"
+
+build do
+ block "Add Rubygems customization file" do
+ source_customization_file = if windows?
+ "#{project_dir}/windows/operating_system.rb"
+ else
+ "#{project_dir}/default/operating_system.rb"
+ end
+
+ site_ruby = Bundler.with_clean_env do
+ ruby = windows_safe_path("#{install_dir}/embedded/bin/ruby")
+ %x|#{ruby} -rrbconfig -e "puts RbConfig::CONFIG['sitelibdir']"|.strip
+ end
+
+ if site_ruby.nil? || site_ruby.empty?
+ raise "Could not determine embedded Ruby's site directory, aborting!"
+ end
+
+ destination = "#{site_ruby}/rubygems/defaults"
+
+ FileUtils.mkdir_p destination
+ FileUtils.cp source_customization_file, destination
+ end
+end
diff --git a/omnibus/config/software/shebang-cleanup.rb b/omnibus/config/software/shebang-cleanup.rb
new file mode 100644
index 0000000000..9f10f694e5
--- /dev/null
+++ b/omnibus/config/software/shebang-cleanup.rb
@@ -0,0 +1,92 @@
+#
+# Copyright 2012-2014 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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Use this software definition to fix the shebangs of binaries under embedded/bin
+# to point to the embedded ruby.
+#
+
+name "shebang-cleanup"
+
+default_version "0.0.2"
+
+build do
+ if windows?
+ block "Update batch files to point at embedded ruby" do
+ load_gemspec = if Gem::VERSION >= '2'
+ require 'rubygems/package'
+ Gem::Package.method(:new)
+ else
+ require 'rubygems/format'
+ Gem::Format.method(:from_file_by_path)
+ end
+ Dir["#{install_dir.gsub(/\\/, '/')}/embedded/lib/ruby/gems/**/cache/*.gem"].each do |gem_file|
+ load_gemspec.call(gem_file).spec.executables.each do |bin|
+ if File.exists?("#{install_dir}/bin/#{bin}")
+ File.open("#{install_dir}/bin/#{bin}.bat", "w") do |f|
+ f.puts <<-EOF
+@ECHO OFF
+"%~dp0\\..\\embedded\\bin\\ruby.exe" "%~dpn0" %*
+ EOF
+ end
+ end
+ if File.exists?("#{install_dir}/embedded/bin/#{bin}")
+ File.open("#{install_dir}/embedded/bin/#{bin}.bat", "w") do |f|
+ f.puts <<-EOF
+@ECHO OFF
+"%~dp0\\ruby.exe" "%~dpn0" %*
+ EOF
+ end
+ end
+ end
+ end
+
+ # Fix gem.bat
+ File.open("#{install_dir}/embedded/bin/gem.bat", "w") do |f|
+ f.puts <<-EOF
+@ECHO OFF
+"%~dp0\\ruby.exe" "%~dpn0" %*
+ EOF
+ end
+ end
+ else
+ block "Update shebangs to point to embedded Ruby" do
+ # Fix the shebang for binaries with shebangs that have:
+ # #!/usr/bin/env ruby
+ Dir.glob("#{install_dir}/embedded/bin/*") do |bin_file|
+ update_shebang = false
+ rest_of_the_file = ""
+
+ File.open(bin_file) do |f|
+ shebang = f.readline
+ if shebang.start_with?("#!") &&
+ shebang.include?("ruby") &&
+ !shebang.include?("#{install_dir}/embedded/bin/ruby")
+ rest_of_the_file = f.read
+ update_shebang = true
+ end
+ end
+
+ if update_shebang
+ File.open(bin_file, "w+") do |f|
+ f.puts("#!#{install_dir}/embedded/bin/ruby")
+ f.puts(rest_of_the_file)
+ end
+ end
+ end
+ end
+ end
+end