This repository has been archived by the owner on Jul 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build all gems using one Gemfile.lock
- Loading branch information
Showing
8 changed files
with
183 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
# | ||
# 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-dk-gemset" | ||
default_version "local_source" | ||
|
||
# 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-dk.git" | ||
end | ||
|
||
relative_path "chef-dk" | ||
|
||
dependency "ruby" | ||
dependency "rubygems" | ||
dependency "bundler" | ||
|
||
# For nokogiri | ||
dependency "libxml2" | ||
dependency "libxslt" | ||
dependency "libiconv" | ||
dependency "liblzma" | ||
dependency "zlib" | ||
|
||
# For berkshelf | ||
dependency "libarchive" | ||
|
||
dependency "chefdk-env-customization" if windows? | ||
|
||
dependency "appbundler" | ||
|
||
require "shellwords" | ||
|
||
build do | ||
def self.embedded_bin(bin) | ||
windows_safe_path("#{install_dir}/embedded/bin/#{bin}") | ||
end | ||
|
||
chef_dk_gemset = File.join(project_dir, "chef-dk-gemset") | ||
|
||
env = with_standard_compiler_flags(with_embedded_path, bfd_flags: true).merge( | ||
"BUNDLE_GEMFILE" => File.join(chef_dk_gemset, "Gemfile") | ||
) | ||
|
||
# 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 | ||
|
||
# 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" | ||
block do | ||
nokogiri_build_config = [ | ||
"--use-system-libraries", | ||
"--with-xml2-lib=#{install_dir}/embedded/lib", | ||
"--with-xml2-include=#{install_dir}/embedded/include/libxml2", | ||
"--with-xslt-lib=#{install_dir}/embedded/lib", | ||
"--with-xslt-include=#{install_dir}/embedded/include/libxslt", | ||
"--with-iconv-dir=#{install_dir}/embedded", | ||
"--with-zlib-dir=#{install_dir}/embedded" | ||
].join(" ") | ||
|
||
FileUtils.mkdir_p("#{chef_dk_gemset}/.bundle") | ||
# bundle config build.nokogiri #{nokogiri_build_config} messes up the line | ||
IO.write("#{chef_dk_gemset}/.bundle/config", <<-EOM.gsub(/^\s+/, '')) | ||
--- | ||
BUNDLE_BUILD__NOKOGIRI: #{nokogiri_build_config} | ||
EOM | ||
end | ||
|
||
# First, bundle install to bring over all dependencies | ||
bundle "install --without=development --jobs=4 --retry=4 --verbose --frozen", env: env | ||
|
||
# Next, build and install the chef-dk and chef-dk-gemset gems | ||
bundle "exec rake build", env: env | ||
bundle "exec rake build", cwd: chef_dk_gemset, env: env | ||
gem "install pkg/chef-dk-*.gem chef-dk-gemset/pkg/chef-dk-*.gem --no-document --ignore-dependencies", env: env | ||
|
||
# Ensure the main bin dir exists | ||
bin_dir = File.join(install_dir, "bin") | ||
FileUtils.mkdir_p(bin_dir) | ||
|
||
# appbundle all the things | ||
appbundler_bin = embedded_bin('appbundler') | ||
appbundler_args = [ chef_dk_gemset, bin_dir ] | ||
appbundler_args += %w(berkshelf chef chef-dk chef-vault foodcritic ohai rubocop test-kitchen) | ||
appbundler_args = appbundler_args.map { |a| ::Shellwords.escape(a) } | ||
command "#{appbundler_bin} #{appbundler_args.join(" ")}", env: env | ||
|
||
# | ||
# Everything that follows is from the chef software def: | ||
# | ||
|
||
# | ||
# TODO bundle show chef can get the installed location of chef. Install from there. | ||
# TODO TODO just copy the stuff from the chef install over. | ||
if windows? | ||
block do | ||
# Copy the chef gem's distro stuff over | ||
chef_gem_path = shellout!("#{embedded_bin("bundle")} show chef", env: env).stdout.chomp | ||
mkdir "#{install_dir}/modules/chef" | ||
copy "#{chef_gem_path}/distro/powershell/chef/*", "#{install_dir}/modules/chef" | ||
end | ||
end | ||
|
||
# TODO find a way to get this in the gemspec | ||
unless aix? || windows? | ||
gem "install ruby-shadow --no-document --verbose", env: env | ||
end | ||
|
||
# Clean up | ||
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 |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.