forked from travis-ci/travis-cookbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.rb
98 lines (75 loc) · 2.77 KB
/
default.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
#
# Cookbook Name:: kerl
# Recipe:: default
#
# Copyright 2011, Michael S. Klishin, Ward Bekker
#
# 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.
include_recipe "libreadline"
include_recipe "libssl"
include_recipe "libncurses"
package "curl" do
action :install
end
installation_root = "/home/#{node.travis_build_environment.user}/otp"
directory(installation_root) do
owner node.travis_build_environment.user
group node.travis_build_environment.group
mode "0755"
action :create
end
remote_file(node.kerl.path) do
source "http://files.travis-ci.org/kerl"
mode "0755"
owner node.travis_build_environment.user
group node.travis_build_environment.group
end
home = "/home/#{node.travis_build_environment.user}"
env = {
'HOME' => home,
'USER' => node.travis_build_environment.user,
'KERL_DISABLE_AGNER' => 'yes',
"KERL_BASE_DIR" => "#{home}/.kerl"
}
case [node[:platform], node[:platform_version]]
when ["ubuntu", "11.04"] then
# fixes compilation with Ubuntu 11.04 zlib. MK.
env["KERL_CONFIGURE_OPTIONS"] = "--enable-dynamic-ssl-lib --enable-hipe"
end
# updates list of available releases. Needed for kerl to recognize
# R15B, for example. MK.
execute "erlang.releases.update" do
command "#{node.kerl.path} update releases"
user node.travis_build_environment.user
group node.travis_build_environment.group
environment(env)
# run when kerl script is downloaded & installed
subscribes :run, resources(:remote_file => node.kerl.path)
end
node.kerl.releases.each do |rel, build|
execute "build Erlang #{rel}" do
command "#{node.kerl.path} build #{rel} #{rel}"
user node.travis_build_environment.user
group node.travis_build_environment.group
environment(env)
# make sure R14B02 won't cause R14B to be skipped. MK.
not_if "#{node.kerl.path} list builds | grep \"^#{rel}$\"", :user => node.travis_build_environment.user, :environment => env
end
execute "install Erlang #{rel}" do
command "#{node.kerl.path} install #{rel} #{installation_root}/#{rel}"
user node.travis_build_environment.user
group node.travis_build_environment.group
environment(env)
not_if "#{node.kerl.path} list installations | grep #{rel}", :user => node.travis_build_environment.user, :environment => env
end
end