Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
Build all gems using one Gemfile.lock
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeiser committed Mar 28, 2016
1 parent 1c3c08a commit ca43b2f
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 191 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ before_install:
- gem install bundler --no-ri --no-rdoc
- gem --version

rvm:
- 2.1.1
include:
- rvm: 2.2
- rvm: 2.1
- gemfile: chef-dk-gemset/Gemfile
rvm: 2.2

branches:
only:
Expand Down
22 changes: 13 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

require "bundler/gem_tasks"

require "github_changelog_generator/task"

namespace :version do
task :bump => 'version:bump_patch'

Expand Down Expand Up @@ -46,11 +44,17 @@ end

require_relative 'tasks/dependencies'

GitHubChangelogGenerator::RakeTask.new :changelog do |config|
config.user = "chef"
config.project = "chef-dk"
config.future_release = ChefDK::VERSION
config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature".split(",")
config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(",")
config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog,Question,Discussion".split(",")
begin
require "github_changelog_generator/task"

GitHubChangelogGenerator::RakeTask.new :changelog do |config|
config.user = "chef"
config.project = "chef-dk"
config.future_release = ChefDK::VERSION
config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature".split(",")
config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(",")
config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog,Question,Discussion".split(",")
end
rescue LoadError
puts "github_changelog_generator is not available. gem install github_changelog_generator to generate changelogs"
end
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ install:
- gem --version
- gem install bundler --no-ri --no-rdoc
- bundler --version
- set BUNDLE_GEMFILE=C:\projects\chefdk\chef-dk-gemset\Gemfile

build_script:
- bundle install
Expand Down
23 changes: 0 additions & 23 deletions omnibus/config/chefdk_gem_overrides.rb

This file was deleted.

15 changes: 3 additions & 12 deletions omnibus/config/projects/chefdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
install_dir "#{default_root}/#{name}"
end

# Bring in generated gem overrides
overrides_file = File.expand_path('../../chefdk_gem_overrides.rb', __FILE__)
instance_eval(IO.read(overrides_file), overrides_file, 1)

# Lower level library pins
override :libedit, version: "20130712-3.1"
#override :"libffi", version: "3.2.1"
Expand All @@ -49,9 +45,10 @@
override :makedepend, version: "1.0.5"
#override :"ncurses", version: "5.9"
#override :"pkg-config-lite", version: "0.28-1"
override :rubocop, version: "v0.37.2"
override :ruby, version: "2.1.8"
override :rubygems, version: "2.5.2"
override :bundler, version: "1.11.2"
override :appbundler, version: "jk/multiple-gems"
override :"util-macros", version: "1.19.0"
override :xproto, version: "7.0.28"
#override :"libyaml", version: "0.1.6"
Expand All @@ -64,13 +61,7 @@
#override :"openssl" # leave this?

dependency "preparation"
dependency "rb-readline"
dependency "chefdk"
dependency "pry"
dependency "chef-provisioning-aws"
dependency "chef-provisioning-fog"
dependency "chef-provisioning-vagrant"
dependency "chef-provisioning-azure"
dependency "chef-dk-gemset"
dependency "ruby-windows-devkit" if windows?
dependency "rubygems-customization"
dependency "shebang-cleanup"
Expand Down
157 changes: 157 additions & 0 deletions omnibus/config/software/chef-dk-gemset.rb
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
89 changes: 0 additions & 89 deletions omnibus/config/software/chefdk.rb

This file was deleted.

Loading

0 comments on commit ca43b2f

Please sign in to comment.