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:
@@ -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
|
||||
Reference in New Issue
Block a user