from-scratch 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Berksfile.lock +11 -0
- data/chefignore +1 -0
- data/cookbooks/apt/CHANGELOG.md +248 -0
- data/cookbooks/apt/README.md +294 -0
- data/cookbooks/apt/attributes/default.rb +51 -0
- data/cookbooks/apt/files/default/15update-stamp +1 -0
- data/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
- data/cookbooks/apt/libraries/helpers.rb +61 -0
- data/cookbooks/apt/libraries/matchers.rb +17 -0
- data/cookbooks/apt/libraries/network.rb +31 -0
- data/cookbooks/apt/metadata.json +1 -0
- data/cookbooks/apt/providers/preference.rb +84 -0
- data/cookbooks/apt/providers/repository.rb +246 -0
- data/cookbooks/apt/recipes/cacher-client.rb +83 -0
- data/cookbooks/apt/recipes/cacher-ng.rb +43 -0
- data/cookbooks/apt/recipes/default.rb +112 -0
- data/cookbooks/apt/recipes/unattended-upgrades.rb +47 -0
- data/cookbooks/apt/resources/preference.rb +37 -0
- data/cookbooks/apt/resources/repository.rb +60 -0
- data/cookbooks/apt/templates/debian-6.0/acng.conf.erb +173 -0
- data/cookbooks/apt/templates/default/01proxy.erb +9 -0
- data/cookbooks/apt/templates/default/10recommends.erb +3 -0
- data/cookbooks/apt/templates/default/20auto-upgrades.erb +2 -0
- data/cookbooks/apt/templates/default/50unattended-upgrades.erb +68 -0
- data/cookbooks/apt/templates/default/acng.conf.erb +275 -0
- data/cookbooks/apt/templates/default/unattended-upgrades.seed.erb +1 -0
- data/cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +269 -0
- data/cookbooks/build-essential/CHANGELOG.md +136 -0
- data/cookbooks/build-essential/README.md +108 -0
- data/cookbooks/build-essential/attributes/default.rb +20 -0
- data/cookbooks/build-essential/libraries/matchers.rb +5 -0
- data/cookbooks/build-essential/libraries/timing.rb +124 -0
- data/cookbooks/build-essential/libraries/xcode_command_line_tools.rb +210 -0
- data/cookbooks/build-essential/metadata.json +1 -0
- data/cookbooks/build-essential/recipes/_debian.rb +28 -0
- data/cookbooks/build-essential/recipes/_fedora.rb +32 -0
- data/cookbooks/build-essential/recipes/_freebsd.rb +24 -0
- data/cookbooks/build-essential/recipes/_mac_os_x.rb +22 -0
- data/cookbooks/build-essential/recipes/_omnios.rb +33 -0
- data/cookbooks/build-essential/recipes/_rhel.rb +36 -0
- data/cookbooks/build-essential/recipes/_smartos.rb +27 -0
- data/cookbooks/build-essential/recipes/_solaris2.rb +48 -0
- data/cookbooks/build-essential/recipes/_suse.rb +29 -0
- data/cookbooks/build-essential/recipes/default.rb +29 -0
- data/cookbooks/chef-sugar/CHANGELOG.md +159 -0
- data/cookbooks/chef-sugar/README.md +464 -0
- data/cookbooks/chef-sugar/metadata.json +1 -0
- data/cookbooks/chef-sugar/recipes/default.rb +34 -0
- data/cookbooks/openssl/CHANGELOG.md +30 -0
- data/cookbooks/openssl/README.md +115 -0
- data/cookbooks/openssl/attributes/default.rb +21 -0
- data/cookbooks/openssl/libraries/secure_password.rb +37 -0
- data/cookbooks/openssl/metadata.json +31 -0
- data/cookbooks/openssl/providers/x509.rb +94 -0
- data/cookbooks/openssl/recipes/default.rb +18 -0
- data/cookbooks/openssl/recipes/upgrade.rb +39 -0
- data/cookbooks/openssl/resources/x509.rb +16 -0
- data/cookbooks/postgresql/CHANGELOG.md +220 -0
- data/cookbooks/postgresql/README.md +464 -0
- data/cookbooks/postgresql/attributes/default.rb +549 -0
- data/cookbooks/postgresql/files/default/tests/minitest/apt_pgdg_postgresql_test.rb +39 -0
- data/cookbooks/postgresql/files/default/tests/minitest/default_test.rb +27 -0
- data/cookbooks/postgresql/files/default/tests/minitest/ruby_test.rb +28 -0
- data/cookbooks/postgresql/files/default/tests/minitest/server_test.rb +43 -0
- data/cookbooks/postgresql/files/default/tests/minitest/support/helpers.rb +29 -0
- data/cookbooks/postgresql/libraries/default.rb +377 -0
- data/cookbooks/postgresql/metadata.json +56 -0
- data/cookbooks/postgresql/recipes/apt_pgdg_postgresql.rb +18 -0
- data/cookbooks/postgresql/recipes/client.rb +32 -0
- data/cookbooks/postgresql/recipes/config_initdb.rb +148 -0
- data/cookbooks/postgresql/recipes/config_pgtune.rb +284 -0
- data/cookbooks/postgresql/recipes/contrib.rb +44 -0
- data/cookbooks/postgresql/recipes/default.rb +18 -0
- data/cookbooks/postgresql/recipes/ruby.rb +117 -0
- data/cookbooks/postgresql/recipes/server.rb +89 -0
- data/cookbooks/postgresql/recipes/server_conf.rb +34 -0
- data/cookbooks/postgresql/recipes/server_debian.rb +38 -0
- data/cookbooks/postgresql/recipes/server_redhat.rb +100 -0
- data/cookbooks/postgresql/recipes/yum_pgdg_postgresql.rb +45 -0
- data/cookbooks/postgresql/templates/default/pg_hba.conf.erb +35 -0
- data/cookbooks/postgresql/templates/default/pgsql.sysconfig.erb +4 -0
- data/cookbooks/postgresql/templates/default/postgresql.conf.erb +21 -0
- data/cookbooks/scratchify/.chef/knife.rb +2 -5
- data/cookbooks/scratchify/Berksfile +2 -1
- data/cookbooks/scratchify/Berksfile.lock +11 -0
- data/cookbooks/scratchify/README.md +34 -17
- data/cookbooks/scratchify/bin/scratchify +1 -1
- data/cookbooks/scratchify/chefignore +1 -0
- data/cookbooks/scratchify/from-scratch.gemspec +2 -5
- data/cookbooks/scratchify/lib/from-scratch.rb +25 -0
- data/cookbooks/scratchify/lib/{from/scratch → from-scratch}/version.rb +1 -1
- data/cookbooks/scratchify/metadata.json +2 -1
- data/cookbooks/scratchify/templates/node.json.erb +34 -0
- data/cookbooks/scratchify/templates/user.json.erb +6 -0
- data/lib/from-scratch.rb +2 -2
- data/lib/from-scratch/version.rb +1 -1
- data/templates/node.json.erb +6 -3
- metadata +85 -10
- data/cookbooks/scratchify/bin/console +0 -14
- data/cookbooks/scratchify/bin/setup +0 -7
- data/cookbooks/scratchify/data_bags/users/deploy.json +0 -6
- data/cookbooks/scratchify/environments/.gitkeep +0 -0
- data/cookbooks/scratchify/lib/from/scratch.rb +0 -31
- data/cookbooks/scratchify/lib/from/scratch/interviewer.rb +0 -35
- data/cookbooks/scratchify/nodes/normfood.ru.json +0 -75
- data/cookbooks/scratchify/roles/.gitkeep +0 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
build-essential Cookbook CHANGELOG
|
|
2
|
+
==================================
|
|
3
|
+
This file is used to list changes made in each version of the build-essential cookbook.
|
|
4
|
+
|
|
5
|
+
v2.2.4 (2015-10-06)
|
|
6
|
+
-------------------
|
|
7
|
+
* Add patch package on Fedora systems
|
|
8
|
+
* Add additional platforms to Kitchen CI
|
|
9
|
+
* Use Chef standard Rubocop file and resolve several issues
|
|
10
|
+
* Update contributing and testing docs
|
|
11
|
+
* Update Gemfile with the latest testing and development deps
|
|
12
|
+
* Add maintainers.md and maintainers.toml files
|
|
13
|
+
* Add chefignore file to limit the files uploaded to the Chef server
|
|
14
|
+
* Add source_url and issues_url metadata for Supermarket
|
|
15
|
+
|
|
16
|
+
v2.2.3 (2015-04-15)
|
|
17
|
+
-------------------
|
|
18
|
+
* Don’t install omnibus-build-essential on Solaris 10 - We decided it’s easier to use the old GCC that ships with Solaris 10.
|
|
19
|
+
* Use ChefDK for all Travis testing.
|
|
20
|
+
|
|
21
|
+
v2.2.2 (2015-03-27)
|
|
22
|
+
-------------------
|
|
23
|
+
* Update Solar 10’s omnibus-build-essential to 0.0.5
|
|
24
|
+
|
|
25
|
+
v2.2.1 (2015-03-23)
|
|
26
|
+
-------------------
|
|
27
|
+
* Install GNU Patch on Solaris 11
|
|
28
|
+
|
|
29
|
+
v2.2.0 (2015-03-18)
|
|
30
|
+
-------------------
|
|
31
|
+
* [solaris] Differentiate between Solaris 10 and 11
|
|
32
|
+
* [solaris] Add ucb compat package
|
|
33
|
+
* [solaris] Solaris 10 build essential setup
|
|
34
|
+
* Fix metadata to use a string instead of a bool (see #56, #57)
|
|
35
|
+
|
|
36
|
+
v2.1.3 (2014-11-18)
|
|
37
|
+
-------------------
|
|
38
|
+
* Update metadata for supported versions of OS X (10.7+) as noted from
|
|
39
|
+
v2.0.0 previously (#38)
|
|
40
|
+
* Clarify requirement to have apt package cache updated in README. (#41)
|
|
41
|
+
* Fix Xcode CLI installation on OS X (#50)
|
|
42
|
+
|
|
43
|
+
v2.1.2 (2014-10-14)
|
|
44
|
+
-------------------
|
|
45
|
+
* Mac OS X 10.10 Yosemite support
|
|
46
|
+
|
|
47
|
+
v2.1.0 (2014-10-14)
|
|
48
|
+
-------------------
|
|
49
|
+
* Use fully-qualified names when installing FreeBSD package
|
|
50
|
+
|
|
51
|
+
v2.0.6 (2014-08-11)
|
|
52
|
+
-------------------
|
|
53
|
+
* Use the resource form of `remote_file` to prevent context issues
|
|
54
|
+
|
|
55
|
+
v2.0.4 (2014-06-06)
|
|
56
|
+
-------------------
|
|
57
|
+
* [COOK-4661] added patch package to _rhel recipe
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
v2.0.2 (2014-05-02)
|
|
61
|
+
-------------------
|
|
62
|
+
- Updated documentation about older Chef versions
|
|
63
|
+
- Added new SVG badges to the README
|
|
64
|
+
- Fix a bug where `potentially_at_compile_time` fails on non-resources
|
|
65
|
+
|
|
66
|
+
v2.0.0 (2014-03-13)
|
|
67
|
+
-------------------
|
|
68
|
+
- Updated tested harnesses to use latest ecosystem tools
|
|
69
|
+
- Added support for FreeBSD
|
|
70
|
+
- Added support for installing XCode Command Line Tools on OSX (10.7, 10.8, 10.9)
|
|
71
|
+
- Created a DSL method for wrapping compile_time vs runtime execution
|
|
72
|
+
- Install additional developement tools on some platforms
|
|
73
|
+
- Add nicer log and warning messages with helpful information
|
|
74
|
+
|
|
75
|
+
**Potentially Breaking Changes**
|
|
76
|
+
|
|
77
|
+
- Dropped support for OSX 10.6
|
|
78
|
+
- OSX no longer downloads OSX GCC and uses XCode CLI tools instead
|
|
79
|
+
- `build_essential` -> `build-essential` in node attributes
|
|
80
|
+
- `compiletime` -> `compile_time` in node attributes
|
|
81
|
+
- Cookbook version 2.x no longer supports Chef 10.x
|
|
82
|
+
|
|
83
|
+
v1.4.4 (2014-02-27)
|
|
84
|
+
-------------------
|
|
85
|
+
- [COOK-4245] Wrong package name used for developer tools on OS X 10.9
|
|
86
|
+
|
|
87
|
+
v1.4.2
|
|
88
|
+
------
|
|
89
|
+
### Bug
|
|
90
|
+
- **[COOK-3318](https://tickets.chef.io/browse/COOK-3318)** - Use Mixlib::ShellOut instead of Chef::ShellOut
|
|
91
|
+
|
|
92
|
+
### New Feature
|
|
93
|
+
- **[COOK-3093](https://tickets.chef.io/browse/COOK-3093)** - Add OmniOS support
|
|
94
|
+
|
|
95
|
+
### Improvement
|
|
96
|
+
- **[COOK-3024](https://tickets.chef.io/browse/COOK-3024)** - Use newer package on SmartOS
|
|
97
|
+
|
|
98
|
+
v1.4.0
|
|
99
|
+
------
|
|
100
|
+
This version splits up the default recipe into recipes included based on the node's platform_family.
|
|
101
|
+
|
|
102
|
+
- [COOK-2505] - backport omnibus builder improvements
|
|
103
|
+
|
|
104
|
+
v1.3.4
|
|
105
|
+
------
|
|
106
|
+
- [COOK-2272] - Complete `platform_family` conversion in build-essential
|
|
107
|
+
|
|
108
|
+
v1.3.2
|
|
109
|
+
------
|
|
110
|
+
- [COOK-2069] - build-essential will install osx-gcc-installer when XCode is present
|
|
111
|
+
|
|
112
|
+
v1.3.0
|
|
113
|
+
------
|
|
114
|
+
- [COOK-1895] - support smartos
|
|
115
|
+
|
|
116
|
+
v1.2.0
|
|
117
|
+
------
|
|
118
|
+
- Add test-kitchen support (source repo only)
|
|
119
|
+
- [COOK-1677] - build-essential cookbook support for OpenSuse and SLES
|
|
120
|
+
- [COOK-1718] - build-essential cookbook metadata should include scientific
|
|
121
|
+
- [COOK-1768] - The apt-get update in build-essentials needs to be renamed
|
|
122
|
+
|
|
123
|
+
v1.1.2
|
|
124
|
+
------
|
|
125
|
+
- [COOK-1620] - support OS X 10.8
|
|
126
|
+
|
|
127
|
+
v1.1.0
|
|
128
|
+
------
|
|
129
|
+
- [COOK-1098] - support amazon linux
|
|
130
|
+
- [COOK-1149] - support Mac OS X
|
|
131
|
+
- [COOK-1296] - allow for compile-time installation of packages through an attribute (see README)
|
|
132
|
+
|
|
133
|
+
v1.0.2
|
|
134
|
+
------
|
|
135
|
+
- [COOK-1098] - Add Amazon Linux platform support
|
|
136
|
+
- [COOK-1149] - Add OS X platform support
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Description
|
|
2
|
+
===========
|
|
3
|
+
[][cookbook]
|
|
4
|
+
[][travis]
|
|
5
|
+
|
|
6
|
+
[cookbook]: https://community.chef.io/cookbooks/build-essential
|
|
7
|
+
[travis]: http://travis-ci.org/chef-cookbooks/build-essential
|
|
8
|
+
|
|
9
|
+
Installs packages required for compiling C software from source. Use this
|
|
10
|
+
cookbook if you wish to compile C programs, or install RubyGems with native
|
|
11
|
+
extensions.
|
|
12
|
+
|
|
13
|
+
Requirements
|
|
14
|
+
------------
|
|
15
|
+
Chef 11+ and Ohai 6.14+ are required. For the latest list of supported
|
|
16
|
+
platforms, please see the `metadata.rb`.
|
|
17
|
+
|
|
18
|
+
**Note for Debian platform family:** On Debian platform-family systems, it is recommended that `apt-get update` be run, to ensure that the package cache is updated. It's not in the scope of this cookbook to do that, as it can [create a duplicate resource](https://tickets.chef.io/browse/CHEF-3694). We recommend using the [apt](https://supermarket.chef.io/cookbooks/apt) cookbook to do this.
|
|
19
|
+
|
|
20
|
+
**Note for OmniOS**: Currently, OmniOS's Ruby package is built with
|
|
21
|
+
GCC 4.6.3, and the path is hardcoded, as the gcc binaries are not
|
|
22
|
+
installed in the default $PATH. This means that in order to install
|
|
23
|
+
RubyGems into the "system" Ruby, one must install `developer/gcc46`.
|
|
24
|
+
[An issue](https://github.com/omniti-labs/omnios-build/issues/19) is
|
|
25
|
+
open upstream w/ OmniOS to rebuild the Ruby package with GCC 4.7.2.
|
|
26
|
+
|
|
27
|
+
Attributes
|
|
28
|
+
----------
|
|
29
|
+
| Attribute | Default | Description |
|
|
30
|
+
|----------------|:-------:|-----------------------------------|
|
|
31
|
+
| `compile_time` | `false` | Execute resources at compile time |
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
Usage
|
|
35
|
+
-----
|
|
36
|
+
Include the build-essential recipe in your run list:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
knife node run_list add NODE "recipe[build-essential::default]"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
or add the build-essential recipe as a dependency and include it from inside
|
|
43
|
+
another cookbook:
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
include_recipe 'build-essential::default'
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Gems with C extensions
|
|
50
|
+
For RubyGems that include native C extensions you wish to use with Chef, you
|
|
51
|
+
should do the following.
|
|
52
|
+
|
|
53
|
+
1. Set the `compile_time` attribute to true in your wrapper cookbook or role:
|
|
54
|
+
|
|
55
|
+
```ruby
|
|
56
|
+
# Wrapper attribute
|
|
57
|
+
default['build-essential']['compile_time'] = true
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```ruby
|
|
61
|
+
# Role
|
|
62
|
+
default_attributes(
|
|
63
|
+
'build-essential' => {
|
|
64
|
+
'compile_time' => true
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
1. Ensure that the C libraries, which include files and other assorted "dev"
|
|
70
|
+
type packages, are installed in the compile phase after the build-essential
|
|
71
|
+
recipe is executed. For example:
|
|
72
|
+
|
|
73
|
+
```ruby
|
|
74
|
+
include_recipe 'build-essential::default'
|
|
75
|
+
|
|
76
|
+
package('mypackage-devel') { action :nothing }.run_action(:install)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
1. Use the `chef_gem` resource in your recipe to install the gem with the native
|
|
80
|
+
extension:
|
|
81
|
+
|
|
82
|
+
```ruby
|
|
83
|
+
chef_gem 'gem-with-native-extension'
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
License & Authors
|
|
88
|
+
-----------------
|
|
89
|
+
- Author: Seth Vargo (<sethvargo@gmail.com>)
|
|
90
|
+
- Author: Joshua Timberman (<joshua@chef.io>)
|
|
91
|
+
- Author: Seth Chisamore (<schisamo@chef.io>)
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
Copyright 2009-2015, Chef Software, Inc. (<legal@chef.io>)
|
|
95
|
+
|
|
96
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
97
|
+
you may not use this file except in compliance with the License.
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software
|
|
103
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
104
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
105
|
+
See the License for the specific language governing permissions and
|
|
106
|
+
limitations under the License.
|
|
107
|
+
```
|
|
108
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Cookbook Name:: build-essential
|
|
3
|
+
# Attributes:: default
|
|
4
|
+
#
|
|
5
|
+
# Copyright 2008-2012, Chef Software, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
#
|
|
19
|
+
|
|
20
|
+
default['build-essential']['compile_time'] = false
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Cookbook Name:: build-essential
|
|
3
|
+
# Library:: timing
|
|
4
|
+
#
|
|
5
|
+
# Copyright 2014, Chef Software, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
#
|
|
19
|
+
|
|
20
|
+
#
|
|
21
|
+
# This module is used to clean up the recipe DSL and "potentially" execute
|
|
22
|
+
# resources at compile time (depending on the value of an attribute).
|
|
23
|
+
#
|
|
24
|
+
# This library is only for use within the build-essential cookbook. Resources
|
|
25
|
+
# inside the potentially_at_compile_time block will not fire notifications in
|
|
26
|
+
# some situations. This is fixable, but since none of the resources in this
|
|
27
|
+
# cookbook actually use notifications, it is not worth the added technical debt.
|
|
28
|
+
#
|
|
29
|
+
# TL;DR Don't use this DSL method outside of this cookbook.
|
|
30
|
+
#
|
|
31
|
+
module BuildEssential
|
|
32
|
+
module Timing
|
|
33
|
+
#
|
|
34
|
+
# Potentially evaluate the given block at compile time, depending on the
|
|
35
|
+
# value of the +node['build-essential']['compile_time']+ attribute.
|
|
36
|
+
#
|
|
37
|
+
# @example
|
|
38
|
+
# potentially_at_compile_time do
|
|
39
|
+
# package 'apache2'
|
|
40
|
+
# end
|
|
41
|
+
#
|
|
42
|
+
# @param [Proc] block
|
|
43
|
+
# the thing to eval
|
|
44
|
+
#
|
|
45
|
+
def potentially_at_compile_time(&block)
|
|
46
|
+
if compile_time?
|
|
47
|
+
CompileTime.new(self).evaluate(&block)
|
|
48
|
+
else
|
|
49
|
+
instance_eval(&block)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
#
|
|
56
|
+
# Checks if the DSL should be evaluated at compile time.
|
|
57
|
+
#
|
|
58
|
+
# @return [true, false]
|
|
59
|
+
#
|
|
60
|
+
def compile_time?
|
|
61
|
+
check_for_old_attributes!
|
|
62
|
+
!!node['build-essential']['compile_time']
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
#
|
|
66
|
+
# Checks for the presence of the "old" attributes.
|
|
67
|
+
#
|
|
68
|
+
# @todo Remove in 2.0.0
|
|
69
|
+
#
|
|
70
|
+
# @return [void]
|
|
71
|
+
#
|
|
72
|
+
def check_for_old_attributes!
|
|
73
|
+
unless node['build_essential'].nil?
|
|
74
|
+
Chef::Log.warn <<-EOH
|
|
75
|
+
node['build_essential'] has been changed to node['build-essential'] to match the
|
|
76
|
+
cookbook name and community standards. I have gracefully converted the attribute
|
|
77
|
+
for you, but this warning and conversion will be removed in the next major
|
|
78
|
+
release of the build-essential cookbook.
|
|
79
|
+
EOH
|
|
80
|
+
node.default['build-essential'] = node['build_essential']
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
unless node['build-essential']['compiletime'].nil?
|
|
84
|
+
Chef::Log.warn <<-EOH
|
|
85
|
+
node['build-essential']['compiletime'] has been deprecated. Please use
|
|
86
|
+
node['build-essential']['compile_time'] instead. I have gracefully converted the
|
|
87
|
+
attribute for you, but this warning and conversion will be removed in the next
|
|
88
|
+
major release of the build-essential cookbook.
|
|
89
|
+
EOH
|
|
90
|
+
node.default['build-essential']['compile_time'] = node['build-essential']['compiletime']
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
#
|
|
95
|
+
# A class graciously borrowed from Chef Sugar for evaluating a resource at
|
|
96
|
+
# compile time in a block.
|
|
97
|
+
#
|
|
98
|
+
class CompileTime
|
|
99
|
+
def initialize(recipe)
|
|
100
|
+
@recipe = recipe
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def evaluate(&block)
|
|
104
|
+
instance_eval(&block)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def method_missing(m, *args, &block)
|
|
108
|
+
resource = @recipe.send(m, *args, &block)
|
|
109
|
+
if resource.is_a?(Chef::Resource)
|
|
110
|
+
actions = Array(resource.action)
|
|
111
|
+
resource.action(:nothing)
|
|
112
|
+
|
|
113
|
+
actions.each do |action|
|
|
114
|
+
resource.run_action(action)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
resource
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Include the timing module into the main recipe DSL
|
|
124
|
+
Chef::Recipe.send(:include, BuildEssential::Timing)
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Cookbook Name:: build-essential
|
|
3
|
+
# Library:: xcode_command_line_tools
|
|
4
|
+
#
|
|
5
|
+
# Copyright 2014, Chef Software, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
#
|
|
19
|
+
|
|
20
|
+
class Chef
|
|
21
|
+
class Resource::XcodeCommandLineTools < Resource::LWRPBase
|
|
22
|
+
def self.resource_name
|
|
23
|
+
:xcode_command_line_tools
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
actions :install
|
|
27
|
+
default_action :install
|
|
28
|
+
|
|
29
|
+
def initialize(name, run_context = nil)
|
|
30
|
+
super
|
|
31
|
+
|
|
32
|
+
@provider = case node['platform_version'].to_f
|
|
33
|
+
when 10.7, 10.8
|
|
34
|
+
Provider::XcodeCommandLineToolsFromDmg
|
|
35
|
+
when 10.9, 10.10
|
|
36
|
+
Provider::XcodeCommandLineToolsFromSoftwareUpdate
|
|
37
|
+
else
|
|
38
|
+
Chef::Log.warn <<-EOH
|
|
39
|
+
OSX #{node['platform_version']} is not an officially supported platform for the
|
|
40
|
+
build-essential cookbook. I am going to try and install the command line tools
|
|
41
|
+
from Software Update, but there is a high probability that it will fail...
|
|
42
|
+
|
|
43
|
+
If you have tested and verified OSX #{node['platform_version']} and you are sick
|
|
44
|
+
of seeing this warning in your Chef Client runs, please submit a Pull Request to
|
|
45
|
+
https://github.com/chef-cookbooks/build-essential and add this version of OSX
|
|
46
|
+
to provider list.
|
|
47
|
+
EOH
|
|
48
|
+
Provider::XcodeCommandLineToolsFromSoftwareUpdate
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
#
|
|
55
|
+
# This is a legacy provider for installing OSX from DMGs. It only supports OSX
|
|
56
|
+
# versions 10.7 and 10.8 and will (hopefully) be deprecated in the future. It
|
|
57
|
+
# downloads a remote .dmg file, mounts it, installs it, and unmounts it
|
|
58
|
+
# automatically. In later versions of OSX, the operating system handles this for
|
|
59
|
+
# the end user.
|
|
60
|
+
#
|
|
61
|
+
class Chef
|
|
62
|
+
class Provider::XcodeCommandLineToolsFromDmg < Provider::LWRPBase
|
|
63
|
+
action(:install) do
|
|
64
|
+
if installed?
|
|
65
|
+
Chef::Log.debug("#{new_resource} already installed - skipping")
|
|
66
|
+
else
|
|
67
|
+
converge_by("Install #{new_resource}") do
|
|
68
|
+
download
|
|
69
|
+
attach
|
|
70
|
+
install
|
|
71
|
+
detach
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
private
|
|
77
|
+
|
|
78
|
+
#
|
|
79
|
+
# Determine if the XCode Command Line Tools are installed
|
|
80
|
+
#
|
|
81
|
+
# @return [true, false]
|
|
82
|
+
#
|
|
83
|
+
def installed?
|
|
84
|
+
cmd = Mixlib::ShellOut.new('pkgutil --pkgs=com.apple.pkg.DeveloperToolsCLI')
|
|
85
|
+
cmd.run_command
|
|
86
|
+
cmd.error!
|
|
87
|
+
true
|
|
88
|
+
rescue Mixlib::ShellOut::ShellCommandFailed
|
|
89
|
+
false
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
#
|
|
93
|
+
# The path where the dmg should be cached on disk.
|
|
94
|
+
#
|
|
95
|
+
# @return [String]
|
|
96
|
+
#
|
|
97
|
+
def dmg_cache_path
|
|
98
|
+
::File.join(Chef::Config[:file_cache_path], 'osx-command-line-tools.dmg')
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
#
|
|
102
|
+
# The path where the dmg should be downloaded from. This is intentionally
|
|
103
|
+
# not a configurable object by the end user. If you do not like where we
|
|
104
|
+
# are downloading XCode from - too bad.
|
|
105
|
+
#
|
|
106
|
+
# @return [String]
|
|
107
|
+
#
|
|
108
|
+
def dmg_remote_source
|
|
109
|
+
case node['platform_version'].to_f
|
|
110
|
+
when 10.7
|
|
111
|
+
'http://devimages.apple.com/downloads/xcode/command_line_tools_for_xcode_os_x_lion_april_2013.dmg'
|
|
112
|
+
when 10.8
|
|
113
|
+
'http://devimages.apple.com/downloads/xcode/command_line_tools_for_xcode_os_x_mountain_lion_march_2014.dmg'
|
|
114
|
+
else
|
|
115
|
+
fail "Unknown DMG download URL for OSX #{node['platform_version']}"
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
#
|
|
120
|
+
# The path where the volume should be mounted.
|
|
121
|
+
#
|
|
122
|
+
# @return [String]
|
|
123
|
+
#
|
|
124
|
+
def mount_path
|
|
125
|
+
::File.join(Chef::Config[:file_cache_path], 'osx-command-line-tools')
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
#
|
|
129
|
+
# Action: download the remote dmg.
|
|
130
|
+
#
|
|
131
|
+
# @return [void]
|
|
132
|
+
#
|
|
133
|
+
def download
|
|
134
|
+
remote_file = Resource::RemoteFile.new(dmg_cache_path, run_context)
|
|
135
|
+
remote_file.source(dmg_remote_source)
|
|
136
|
+
remote_file.backup(false)
|
|
137
|
+
remote_file.run_action(:create)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
#
|
|
141
|
+
# Action: attach the dmg (basically, double-click on it)
|
|
142
|
+
#
|
|
143
|
+
# @return [void]
|
|
144
|
+
#
|
|
145
|
+
def attach
|
|
146
|
+
execute %(hdiutil attach "#{dmg_cache_path}" -mountpoint "#{mount_path}")
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
#
|
|
150
|
+
# Action: install the package inside the dmg
|
|
151
|
+
#
|
|
152
|
+
# @return [void]
|
|
153
|
+
#
|
|
154
|
+
def install
|
|
155
|
+
execute %|installer -package "$(find '#{mount_path}' -name *.mpkg)" -target "/"|
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
#
|
|
159
|
+
# Action: detach the dmg (basically, drag it to eject on the dock)
|
|
160
|
+
#
|
|
161
|
+
# @return [void]
|
|
162
|
+
#
|
|
163
|
+
def detach
|
|
164
|
+
execute %(hdiutil detach "#{mount_path}")
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
class Chef
|
|
170
|
+
class Provider::XcodeCommandLineToolsFromSoftwareUpdate < Provider::LWRPBase
|
|
171
|
+
action(:install) do
|
|
172
|
+
if installed?
|
|
173
|
+
Chef::Log.debug("#{new_resource} already installed - skipping")
|
|
174
|
+
else
|
|
175
|
+
converge_by("Install #{new_resource}") do
|
|
176
|
+
# This script was graciously borrowed and modified from Tim Sutton's
|
|
177
|
+
# osx-vm-templates at https://github.com/timsutton/osx-vm-templates/blob/b001475df54a9808d3d56d06e71b8fa3001fff42/scripts/xcode-cli-tools.sh
|
|
178
|
+
execute 'install XCode Command Line tools' do
|
|
179
|
+
command <<-EOH.gsub(/^ {14}/, '')
|
|
180
|
+
# create the placeholder file that's checked by CLI updates' .dist code
|
|
181
|
+
# in Apple's SUS catalog
|
|
182
|
+
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
|
|
183
|
+
# find the CLI Tools update
|
|
184
|
+
PROD=$(softwareupdate -l | grep "\*.*Command Line" | head -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | tr -d '\n')
|
|
185
|
+
# install it
|
|
186
|
+
softwareupdate -i "$PROD" -v
|
|
187
|
+
EOH
|
|
188
|
+
# rubocop:enable Metrics/LineLength
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
private
|
|
195
|
+
|
|
196
|
+
#
|
|
197
|
+
# Determine if the XCode Command Line Tools are installed
|
|
198
|
+
#
|
|
199
|
+
# @return [true, false]
|
|
200
|
+
#
|
|
201
|
+
def installed?
|
|
202
|
+
cmd = Mixlib::ShellOut.new('pkgutil --pkgs=com.apple.pkg.CLTools_Executables')
|
|
203
|
+
cmd.run_command
|
|
204
|
+
cmd.error!
|
|
205
|
+
true
|
|
206
|
+
rescue Mixlib::ShellOut::ShellCommandFailed
|
|
207
|
+
false
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
end
|