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
/
chef-dk.rb
111 lines (90 loc) · 4.03 KB
/
chef-dk.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#
# Copyright 2014-2019, 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"
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: "#{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: "https://github.com/chef/chef-dk.git"
end
# For nokogiri
dependency "libxml2"
dependency "libxslt"
dependency "liblzma"
dependency "zlib"
dependency "libarchive"
#
# NOTE: NO GEM DEPENDENCIES
#
# we do not add dependencies here on omnibus-software definitions that install gems.
#
# all of the gems for chef-dk must be installed in the mega bundle install below.
#
# doing bundle install / rake install in dependent software definitions causes gemsets
# to get solved without some of the chef-dk constraints, which results in multiple different
# versions of gems in the omnibus bundle.
#
# for gems that depend on c-libs, we include the c-libraries directly here.
#
# For berkshelf
dependency "libarchive"
# For opscode-pushy-client
dependency "libzmq"
# ruby and bundler and friends
dependency "ruby"
# for train
dependency "google-protobuf"
# This is a transative dep but we need to build from source so binaries are built on current sdk.
# Only matters on mac.
# @todo Contact gem mainter about getting new release.
dependency "rb-fsevent-gem" if mac_os_x?
build do
env = with_standard_compiler_flags(with_embedded_path)
excluded_groups = %w{server docgen maintenance pry integration ci}
# install the whole bundle first
bundle "install --jobs 10 --without #{excluded_groups.join(" ")}", env: env
gem "build chef-dk.gemspec", env: env
gem "install chef*.gem --no-document --verbose", env: env
env["NOKOGIRI_USE_SYSTEM_LIBRARIES"] = "true"
appbundle "chef", lockdir: project_dir, gem: "chef", without: %w{docgen chefstyle omnibus_package}, env: env
appbundle "foodcritic", lockdir: project_dir, gem: "foodcritic", without: %w{development}, env: env
appbundle "test-kitchen", lockdir: project_dir, gem: "test-kitchen", without: %w{changelog debug docs}, env: env
appbundle "inspec", lockdir: project_dir, gem: "inspec-bin", without: %w{deploy tools maintenance integration}, env: env
appbundle "dco", lockdir: project_dir, gem: "dco", without: %w{development}, env: env
%w{chef-bin chef-dk chef-vault ohai opscode-pushy-client cookstyle berkshelf}.each do |gem|
appbundle gem, lockdir: project_dir, gem: gem, without: %w{changelog}, env: env
end
# Clear git-checked-out gems (most of this cleanup has been moved into the chef-cleanup omnibus-software definition,
# but chef-client still needs git-checked-out gems)
block "Delete bundler git installs" do
gemdir = shellout!("#{install_dir}/embedded/bin/gem environment gemdir", env: env).stdout.chomp
remove_directory "#{gemdir}/bundler"
end
end