Vendor the external cookbooks
Knife-Zero doesn't include Berkshelf support, so vendoring everything in the repo is convenient again
This commit is contained in:
5
cookbooks/poise-build-essential/CHANGELOG.md
Normal file
5
cookbooks/poise-build-essential/CHANGELOG.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Poise-Build-Essential Changelog
|
||||
|
||||
## v1.0.0
|
||||
|
||||
* Initial release!
|
||||
85
cookbooks/poise-build-essential/README.md
Normal file
85
cookbooks/poise-build-essential/README.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# Poise-Build-Essential Cookbook
|
||||
|
||||
[](https://travis-ci.org/poise/poise-build-essential)
|
||||
[](https://rubygems.org/gems/poise-build-essential)
|
||||
[](https://supermarket.chef.io/cookbooks/poise-build-essential)
|
||||
[](https://codecov.io/github/poise/poise-build-essential)
|
||||
[](https://gemnasium.com/poise/poise-build-essential)
|
||||
[](https://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
A [Chef](https://www.chef.io/) cookbook to install a C compiler and build tools..
|
||||
|
||||
## Quick Start
|
||||
|
||||
To install a C compiler:
|
||||
|
||||
```ruby
|
||||
include_recipe 'poise-build-essential'
|
||||
```
|
||||
|
||||
Or to install using a resource and at compile time:
|
||||
|
||||
```ruby
|
||||
poise_build_essential 'build_essential' do
|
||||
action :nothing
|
||||
end.run_action(:install)
|
||||
```
|
||||
|
||||
## Recipes
|
||||
|
||||
* `poise-build-essential::default` – Install a C compiler and build tools.
|
||||
|
||||
## Attributes
|
||||
|
||||
* `node['poise-build-essential']['action']` – Action to use. One of install,
|
||||
upgrade, or remove. *(default: install)*
|
||||
* `node['poise-build-essential']['allow_unsupported_platform']` – Whether or not
|
||||
to raise an error on unsupported platforms. *(default: false)*
|
||||
|
||||
## Resources
|
||||
|
||||
### `poise_build_essential`
|
||||
|
||||
The `poise_build_essential` resource installs a C compiler and build tools.
|
||||
|
||||
```ruby
|
||||
poise_build_essential 'build_essential' do
|
||||
allow_unsupported_platform true
|
||||
end
|
||||
```
|
||||
|
||||
#### Actions
|
||||
|
||||
* `:install` – Install a C compiler. *(default)*
|
||||
* `:upgrade` – Install a C compiler using `package action :ugprade` rules.
|
||||
* `:remove` – Remove a C compiler.
|
||||
|
||||
#### Properties
|
||||
|
||||
* `allow_unsupported_platform` – Whether or not to raise an error on unsupported
|
||||
platforms. *(default: false)*
|
||||
|
||||
## Sponsors
|
||||
|
||||
Development sponsored by [SAP](https://www.sap.com/).
|
||||
|
||||
The Poise test server infrastructure is sponsored by [Rackspace](https://rackspace.com/).
|
||||
|
||||
## License
|
||||
|
||||
Some code copyright 2008-2017, Chef Software, Inc. Used under the terms of the
|
||||
Apache License, Version 2.0.
|
||||
|
||||
Copyright 2017, Noah Kantrowitz
|
||||
|
||||
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.
|
||||
21
cookbooks/poise-build-essential/attributes/default.rb
Normal file
21
cookbooks/poise-build-essential/attributes/default.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Action to use. One of install, upgrade, or remove.
|
||||
default['poise-build-essential']['action'] = 'install'
|
||||
|
||||
# Whether or not to raise an error on unsupported platforms.
|
||||
default['poise-build-essential']['allow_unsupported_platform'] = false
|
||||
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
autoload :BuildEssentialProviders, 'poise_build_essential/build_essential_providers'
|
||||
autoload :Resources, 'poise_build_essential/resources'
|
||||
autoload :VERSION, 'poise_build_essential/version'
|
||||
end
|
||||
@@ -0,0 +1,49 @@
|
||||
#
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'chef/platform/provider_priority_map'
|
||||
|
||||
require 'poise_build_essential/build_essential_providers/debian'
|
||||
require 'poise_build_essential/build_essential_providers/freebsd'
|
||||
require 'poise_build_essential/build_essential_providers/mac_os_x'
|
||||
require 'poise_build_essential/build_essential_providers/omnios'
|
||||
require 'poise_build_essential/build_essential_providers/rhel'
|
||||
require 'poise_build_essential/build_essential_providers/smartos'
|
||||
require 'poise_build_essential/build_essential_providers/solaris'
|
||||
require 'poise_build_essential/build_essential_providers/suse'
|
||||
# require 'poise_build_essential/build_essential_providers/windows'
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
# Inversion providers for the poise_build_essential resource.
|
||||
#
|
||||
# @since 1.0.0
|
||||
module BuildEssentialProviders
|
||||
# Set up priority maps
|
||||
Chef::Platform::ProviderPriorityMap.instance.priority(:poise_build_essential, [
|
||||
PoiseBuildEssential::BuildEssentialProviders::Debian,
|
||||
PoiseBuildEssential::BuildEssentialProviders::FreeBSD,
|
||||
PoiseBuildEssential::BuildEssentialProviders::MacOSX,
|
||||
PoiseBuildEssential::BuildEssentialProviders::OmniOS,
|
||||
PoiseBuildEssential::BuildEssentialProviders::RHEL,
|
||||
PoiseBuildEssential::BuildEssentialProviders::SmartOS,
|
||||
PoiseBuildEssential::BuildEssentialProviders::Solaris,
|
||||
PoiseBuildEssential::BuildEssentialProviders::SUSE,
|
||||
# PoiseBuildEssential::BuildEssentialProviders::Windows,
|
||||
PoiseBuildEssential::BuildEssentialProviders::Base,
|
||||
])
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,103 @@
|
||||
#
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'chef/provider'
|
||||
require 'poise'
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
module BuildEssentialProviders
|
||||
# The provider base class for `poise_build_essential`.
|
||||
#
|
||||
# @see PoiseBuildEssential::Resources::PoiseBuildEssential::Resource
|
||||
# @provides poise_build_essential
|
||||
class Base < Chef::Provider
|
||||
include Poise
|
||||
provides(:poise_build_essential)
|
||||
|
||||
# The `install` action for the `poise_build_essential` resource.
|
||||
#
|
||||
# @return [void]
|
||||
def action_install
|
||||
notifying_block do
|
||||
install_build_essential
|
||||
end
|
||||
end
|
||||
|
||||
# The `upgrade` action for the `poise_build_essential` resource.
|
||||
#
|
||||
# @return [void]
|
||||
def action_upgrade
|
||||
notifying_block do
|
||||
upgrade_build_essential
|
||||
end
|
||||
end
|
||||
|
||||
# The `remove` action for the `poise_build_essential` resource.
|
||||
#
|
||||
# @return [void]
|
||||
def action_remove
|
||||
notifying_block do
|
||||
remove_build_essential
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Install C compiler and build tools. Must be implemented by subclasses.
|
||||
#
|
||||
# @abstract
|
||||
def install_build_essential
|
||||
unsupported_platform("Unknown platform for poise_build_eseential: #{node['platform']} (#{node['platform_family']})")
|
||||
# Return an array so upgrade/remove also work.
|
||||
[]
|
||||
end
|
||||
|
||||
# Upgrade C compiler and build tools. Must be implemented by subclasses.
|
||||
#
|
||||
# @abstract
|
||||
def upgrade_build_essential
|
||||
install_build_essential.tap do |installed|
|
||||
Array(installed).each {|r| r.action(:upgrade) }
|
||||
end
|
||||
end
|
||||
|
||||
# Uninstall C compiler and build tools. Must be implemented by subclasses.
|
||||
#
|
||||
# @abstract
|
||||
def remove_build_essential
|
||||
install_build_essential.tap do |installed|
|
||||
Array(installed).each {|r| r.action(:remove) }
|
||||
end
|
||||
end
|
||||
|
||||
# Helper method for either warning about an unsupported platform or raising
|
||||
# an exception.
|
||||
#
|
||||
# @api private
|
||||
# @param msg [String] Error message to display.
|
||||
# @return [void]
|
||||
def unsupported_platform(msg)
|
||||
if new_resource.allow_unsupported_platform
|
||||
Chef::Log.warn(msg)
|
||||
else
|
||||
raise RuntimeError.new(msg)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# Copyright 2008-2017, Chef Software, Inc.
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'poise_build_essential/build_essential_providers/base'
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
module BuildEssentialProviders
|
||||
# A provider for `poise_build_essential` to install on Debian platforms.
|
||||
#
|
||||
# @see PoiseBuildEssential::Resources::PoiseBuildEssential::Resource
|
||||
# @provides poise_build_essential
|
||||
class Debian < Base
|
||||
provides(:poise_build_essential, platform_family: 'debian')
|
||||
|
||||
private
|
||||
|
||||
# (see Base#install_build_essential)
|
||||
def install_build_essential
|
||||
package %w{autoconf binutils-doc bison build-essential flex gettext ncurses-dev}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# Copyright 2008-2017, Chef Software, Inc.
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'poise_build_essential/build_essential_providers/base'
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
module BuildEssentialProviders
|
||||
# A provider for `poise_build_essential` to install on FreeBSD platforms.
|
||||
#
|
||||
# @see PoiseBuildEssential::Resources::PoiseBuildEssential::Resource
|
||||
# @provides poise_build_essential
|
||||
class FreeBSD < Base
|
||||
provides(:poise_build_essential, platform_family: 'freebsd')
|
||||
|
||||
private
|
||||
|
||||
# (see Base#install_build_essential)
|
||||
def install_build_essential
|
||||
pkgs = %w{devel/gmake devel/autoconf devel/m4 devel/gettext}
|
||||
# Only install gcc on freebsd 9.x - 10 uses clang.
|
||||
if node['platform_version'].to_i <= 9
|
||||
pkgs << 'lang/gcc49'
|
||||
end
|
||||
pkgs.map {|name| package name }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
#
|
||||
# Copyright 2008-2017, Chef Software, Inc.
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'poise_build_essential/build_essential_providers/base'
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
module BuildEssentialProviders
|
||||
# A provider for `poise_build_essential` to install on macOS platforms.
|
||||
#
|
||||
# @see PoiseBuildEssential::Resources::PoiseBuildEssential::Resource
|
||||
# @provides poise_build_essential
|
||||
class MacOSX < Base
|
||||
provides(:poise_build_essential, platform_family: 'mac_os_x')
|
||||
|
||||
private
|
||||
|
||||
# (see Base#install_build_essential)
|
||||
def install_build_essential
|
||||
# This script was graciously borrowed and modified from Tim Sutton's
|
||||
# osx-vm-templates at https://github.com/timsutton/osx-vm-templates/blob/b001475df54a9808d3d56d06e71b8fa3001fff42/scripts/xcode-cli-tools.sh
|
||||
execute 'install XCode Command Line tools' do
|
||||
command <<-EOH
|
||||
# create the placeholder file that's checked by CLI updates' .dist code
|
||||
# in Apple's SUS catalog
|
||||
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
|
||||
# find the CLI Tools update
|
||||
PROD=$(softwareupdate -l | grep "\*.*Command Line" | head -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | tr -d '\n')
|
||||
# install it
|
||||
softwareupdate -i "$PROD" --verbose
|
||||
# Remove the placeholder to prevent perpetual appearance in the update utility
|
||||
rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
|
||||
EOH
|
||||
not_if 'pkgutil --pkgs=com.apple.pkg.CLTools_Executables'
|
||||
end
|
||||
end
|
||||
|
||||
# (see Base#upgrade_build_essential)
|
||||
def upgrade_build_essential
|
||||
# Make upgrade the same as install on Mac.
|
||||
install_build_essential
|
||||
end
|
||||
|
||||
# (see Base#remove_build_essential)
|
||||
def remove_build_essential
|
||||
# Not sure how to do this, ignoring for now.
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# Copyright 2008-2017, Chef Software, Inc.
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'poise_build_essential/build_essential_providers/base'
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
module BuildEssentialProviders
|
||||
# A provider for `poise_build_essential` to install on OmniOS platforms.
|
||||
#
|
||||
# @see PoiseBuildEssential::Resources::PoiseBuildEssential::Resource
|
||||
# @provides poise_build_essential
|
||||
class OmniOS < Base
|
||||
provides(:poise_build_essential, platform_family: 'omnios')
|
||||
|
||||
private
|
||||
|
||||
# (see Base#install_build_essential)
|
||||
def install_build_essential
|
||||
# Per OmniOS documentation, the gcc bin dir isn't in the default
|
||||
# $PATH, so add it to the running process environment.
|
||||
# http://omnios.omniti.com/wiki.php/DevEnv
|
||||
ENV['PATH'] = "#{ENV['PATH']}:/opt/gcc-4.7.2/bin"
|
||||
|
||||
%w{developer/gcc48 developer/object-file developer/linker
|
||||
developer/library/lint developer/build/gnu-make system/header
|
||||
system/library/math/header-math}.map {|name| package name }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# Copyright 2008-2017, Chef Software, Inc.
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'poise_build_essential/build_essential_providers/base'
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
module BuildEssentialProviders
|
||||
# A provider for `poise_build_essential` to install on RedHat and Fedora platforms.
|
||||
#
|
||||
# @see PoiseBuildEssential::Resources::PoiseBuildEssential::Resource
|
||||
# @provides poise_build_essential
|
||||
class RHEL < Base
|
||||
provides(:poise_build_essential, platform_family: %w{rhel fedora})
|
||||
|
||||
private
|
||||
|
||||
# (see Base#install_build_essential)
|
||||
def install_build_essential
|
||||
pkgs = %w{autoconf bison flex gcc gcc-c++ gettext kernel-devel make m4 ncurses-devel patch}
|
||||
# Ensure GCC 4 is available on older pre-6 EL
|
||||
if node['platform_family'] == 'rhel' && node['platform_version'].to_i < 6
|
||||
pkgs += %w{gcc44 gcc44-c++}
|
||||
end
|
||||
package pkgs
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# Copyright 2008-2017, Chef Software, Inc.
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'poise_build_essential/build_essential_providers/base'
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
module BuildEssentialProviders
|
||||
# A provider for `poise_build_essential` to install on SmartOS platforms.
|
||||
#
|
||||
# @see PoiseBuildEssential::Resources::PoiseBuildEssential::Resource
|
||||
# @provides poise_build_essential
|
||||
class SmartOS < Base
|
||||
provides(:poise_build_essential, platform_family: 'smartos')
|
||||
|
||||
private
|
||||
|
||||
# (see Base#install_build_essential)
|
||||
def install_build_essential
|
||||
%w{autoconf binutils build-essential gcc47 gmake pkg-config}.map {|name| package name }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# Copyright 2008-2017, Chef Software, Inc.
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'poise_build_essential/build_essential_providers/base'
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
module BuildEssentialProviders
|
||||
# A provider for `poise_build_essential` to install on Solaris platforms.
|
||||
#
|
||||
# @see PoiseBuildEssential::Resources::PoiseBuildEssential::Resource
|
||||
# @provides poise_build_essential
|
||||
class Solaris < Base
|
||||
provides(:poise_build_essential, platform_family: 'solaris2')
|
||||
|
||||
private
|
||||
|
||||
# (see Base#install_build_essential)
|
||||
def install_build_essential
|
||||
if node['platform_version'].to_f < 5.11
|
||||
unsupported_platform('poise_build_essential does not support Solaris before 11. You will need to install SUNWbison, SUNWgcc, SUNWggrp, SUNWgmake, and SUNWgtar from the Solaris DVD')
|
||||
return []
|
||||
end
|
||||
|
||||
# lock because we don't use gcc 5 yet.
|
||||
[package('gcc') { version '4.8.2'} ] + \
|
||||
%w{autoconf automake bison gnu-coreutils flex gcc-3 gnu-grep gnu-make
|
||||
gnu-patch gnu-tar make pkg-config ucb}.map {|name| package name }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Copyright 2008-2017, Chef Software, Inc.
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'poise_build_essential/build_essential_providers/base'
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
module BuildEssentialProviders
|
||||
# A provider for `poise_build_essential` to install on SUSE platforms.
|
||||
#
|
||||
# @see PoiseBuildEssential::Resources::PoiseBuildEssential::Resource
|
||||
# @provides poise_build_essential
|
||||
class SUSE < Base
|
||||
provides(:poise_build_essential, platform_family: 'suse')
|
||||
|
||||
private
|
||||
|
||||
# (see Base#install_build_essential)
|
||||
def install_build_essential
|
||||
pkgs = %w{autoconf bison flex gcc gcc-c++ kernel-default-devel make m4}
|
||||
if node['platform_version'].to_i < 12
|
||||
pkgs += %w{gcc48 gcc48-c++}
|
||||
end
|
||||
package pkgs
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,68 @@
|
||||
#
|
||||
# Copyright 2008-2017, Chef Software, Inc.
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'poise_build_essential/build_essential_providers/base'
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
module BuildEssentialProviders
|
||||
# A provider for `poise_build_essential` to install on Windows platforms.
|
||||
#
|
||||
# @see PoiseBuildEssential::Resources::PoiseBuildEssential::Resource
|
||||
# @provides poise_build_essential
|
||||
class Windows < Base
|
||||
provides(:poise_build_essential, platform_family: 'windows')
|
||||
|
||||
private
|
||||
|
||||
# (see Base#install_build_essential)
|
||||
def install_build_essential
|
||||
install_build_essential_packages
|
||||
end
|
||||
|
||||
# (see Base#upgrade_build_essential)
|
||||
def upgrade_build_essential
|
||||
# Upgrade and install are the same on Windows. (?)
|
||||
install_build_essential
|
||||
end
|
||||
|
||||
# (see Base#remove_build_essential)
|
||||
def remove_build_essential
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
||||
# Install MSYS2 packages needed for the build environment.
|
||||
#
|
||||
# @api private
|
||||
# @return [Array<Chef::Resource>]
|
||||
def install_build_essential_packages
|
||||
# TODO This probably won't work on 32-bit right now, fix that.
|
||||
[
|
||||
'base-devel', # Brings down msys based bash/make/awk/patch/stuff.
|
||||
'mingw-w64-x86_64-toolchain', # Puts 64-bit SEH mingw toolchain in msys2\mingw64.
|
||||
'mingw-w64-i686-toolchain' # Puts 32-bit DW2 mingw toolchain in msys2\ming32.
|
||||
].map do |pkg_group|
|
||||
# The pacman package provider doesn't support groups, so going old-school.
|
||||
poise_msys2_execute "pacman --sync #{pkg_group}" do
|
||||
command ['pacman', '--sync', '--noconfirm', '--noprogressbar', '--needed', pkg_group]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'poise_build_essential/resources'
|
||||
require 'poise_build_essential/build_essential_providers'
|
||||
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'poise_build_essential/resources/poise_build_essential'
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
# Chef resources and providers for poise-build-essential.
|
||||
#
|
||||
# @since 1.0.0
|
||||
module Resources
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
require 'chef/resource'
|
||||
require 'poise'
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
module Resources
|
||||
# (see PoiseBuildEssential::Resource)
|
||||
# @since 1.0.0
|
||||
module PoiseBuildEssential
|
||||
# A `poise_build_essential` resource to install a C compiler and build tools.
|
||||
#
|
||||
# @provides poise_build_essential
|
||||
# @action install
|
||||
# @action upgrade
|
||||
# @action uninstall
|
||||
# @example
|
||||
# poise_build_essential 'build-essential'
|
||||
class Resource < Chef::Resource
|
||||
include Poise
|
||||
provides(:poise_build_essential)
|
||||
actions(:install, :upgrade, :remove)
|
||||
|
||||
# @!attribute allow_unsupported_platform
|
||||
# Whether or not to raise an error on unsupported platforms.
|
||||
# @return [Boolean]
|
||||
attribute(:allow_unsupported_platform, kind_of: [TrueClass, FalseClass], default: lazy { node['poise-build-essential']['allow_unsupported_platform'] })
|
||||
end
|
||||
|
||||
# Providers can be found under build_essential_providers/.
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
module PoiseBuildEssential
|
||||
VERSION = '1.0.0'
|
||||
end
|
||||
19
cookbooks/poise-build-essential/libraries/default.rb
Normal file
19
cookbooks/poise-build-essential/libraries/default.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
raise 'Halite is not compatible with no_lazy_load false, please set no_lazy_load true in your Chef configuration file.' unless Chef::Config[:no_lazy_load]
|
||||
$LOAD_PATH << File.expand_path('../../files/halite_gem', __FILE__)
|
||||
require "poise_build_essential/cheftie"
|
||||
1
cookbooks/poise-build-essential/metadata.json
Normal file
1
cookbooks/poise-build-essential/metadata.json
Normal file
@@ -0,0 +1 @@
|
||||
{"name":"poise-build-essential","version":"1.0.0","description":"A Chef cookbook to install a C compiler and build tools.","long_description":"# Poise-Build-Essential Cookbook\n\n[](https://travis-ci.org/poise/poise-build-essential)\n[](https://rubygems.org/gems/poise-build-essential)\n[](https://supermarket.chef.io/cookbooks/poise-build-essential)\n[](https://codecov.io/github/poise/poise-build-essential)\n[](https://gemnasium.com/poise/poise-build-essential)\n[](https://www.apache.org/licenses/LICENSE-2.0)\n\nA [Chef](https://www.chef.io/) cookbook to install a C compiler and build tools..\n\n## Quick Start\n\nTo install a C compiler:\n\n```ruby\ninclude_recipe 'poise-build-essential'\n```\n\nOr to install using a resource and at compile time:\n\n```ruby\npoise_build_essential 'build_essential' do\n action :nothing\nend.run_action(:install)\n```\n\n## Recipes\n\n* `poise-build-essential::default` – Install a C compiler and build tools.\n\n## Attributes\n\n* `node['poise-build-essential']['action']` – Action to use. One of install,\n upgrade, or remove. *(default: install)*\n* `node['poise-build-essential']['allow_unsupported_platform']` – Whether or not\n to raise an error on unsupported platforms. *(default: false)*\n\n## Resources\n\n### `poise_build_essential`\n\nThe `poise_build_essential` resource installs a C compiler and build tools.\n\n```ruby\npoise_build_essential 'build_essential' do\n allow_unsupported_platform true\nend\n```\n\n#### Actions\n\n* `:install` – Install a C compiler. *(default)*\n* `:upgrade` – Install a C compiler using `package action :ugprade` rules.\n* `:remove` – Remove a C compiler.\n\n#### Properties\n\n* `allow_unsupported_platform` – Whether or not to raise an error on unsupported\n platforms. *(default: false)*\n\n## Sponsors\n\nDevelopment sponsored by [SAP](https://www.sap.com/).\n\nThe Poise test server infrastructure is sponsored by [Rackspace](https://rackspace.com/).\n\n## License\n\nSome code copyright 2008-2017, Chef Software, Inc. Used under the terms of the\nApache License, Version 2.0.\n\nCopyright 2017, Noah Kantrowitz\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","maintainer":"Noah Kantrowitz","maintainer_email":"noah@coderanger.net","license":"Apache 2.0","platforms":{},"dependencies":{"poise":"~> 2.6"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/poise/poise-build-essential","issues_url":"https://github.com/poise/poise-build-essential/issues","chef_version":[["< 14",">= 12.1"]],"ohai_version":[]}
|
||||
19
cookbooks/poise-build-essential/recipes/default.rb
Normal file
19
cookbooks/poise-build-essential/recipes/default.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# Copyright 2017, Noah Kantrowitz
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
poise_build_essential 'build_essential' do
|
||||
action node['poise-build-essential']['action'].to_sym
|
||||
end
|
||||
Reference in New Issue
Block a user