summaryrefslogtreecommitdiff
path: root/lib/chef/resource/build_essential.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-11-18 14:53:40 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2019-11-18 14:53:40 -0800
commitdee1de9611aef8a8366bff0da2ace2dc7a4646b5 (patch)
treed847b54698ab2065ed8c51fd2a30ddf0be6cf305 /lib/chef/resource/build_essential.rb
parent5d5a1aeeb5d5585548a8bacb06fa7a57d3ecc660 (diff)
downloadchef-dee1de9611aef8a8366bff0da2ace2dc7a4646b5.tar.gz
build build_essential for rhel
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/resource/build_essential.rb')
-rw-r--r--lib/chef/resource/build_essential.rb34
1 files changed, 23 insertions, 11 deletions
diff --git a/lib/chef/resource/build_essential.rb b/lib/chef/resource/build_essential.rb
index 8d93e57aab..6cef29da8c 100644
--- a/lib/chef/resource/build_essential.rb
+++ b/lib/chef/resource/build_essential.rb
@@ -45,24 +45,29 @@ class Chef
description: "Install the build essential packages at compile time.",
default: false, desired_state: false
+ property :raise_if_unsupported, [TrueClass, FalseClass],
+ description: "Raise a hard error on platforms where this resource is unsupported.",
+ default: false, desired_state: false # FIXME: make this default to true
+
action :install do
description "Install build essential packages"
- case node["platform_family"]
- when "debian"
+ case
+ when debian?
package %w{ autoconf binutils-doc bison build-essential flex gettext ncurses-dev }
- when fedora_derived?
+ when false # rubocop:disable Lint/LiteralAsCondition
+ # when fedora_derived?
package %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
package %w{ gcc44 gcc44-c++ } if platform_family?("rhel") && node["platform_version"].to_i < 6
- when "freebsd"
+ when freebsd?
package "devel/gmake"
package "devel/autoconf"
package "devel/m4"
package "devel/gettext"
- when "mac_os_x"
+ when macos?
unless xcode_cli_installed?
# 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
@@ -80,7 +85,7 @@ class Chef
EOH
end
end
- when "omnios"
+ when omnios?
package "developer/gcc48"
package "developer/object-file"
package "developer/linker"
@@ -93,7 +98,7 @@ class Chef
# $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"
- when "solaris2"
+ when solaris2?
package "autoconf"
package "automake"
package "bison"
@@ -111,21 +116,28 @@ class Chef
package "make"
package "pkg-config"
package "ucb"
- when "smartos"
+ when smartos?
package "autoconf"
package "binutils"
package "build-essential"
package "gcc47"
package "gmake"
package "pkg-config"
- when "suse"
+ when suse?
package %w{ autoconf bison flex gcc gcc-c++ kernel-default-devel make m4 }
package %w{ gcc48 gcc48-c++ } if node["platform_version"].to_i < 12
else
- Chef::Log.warn <<-EOH
+ if new_resource.raise_if_unsupported
+ raise <<-EOH
+ The build_essential resource does not currently support the '#{node["platform_family"]}'
+ platform family. Skipping...
+ EOH
+ else
+ Chef::Log.warn <<-EOH
The build_essential resource does not currently support the '#{node["platform_family"]}'
platform family. Skipping...
- EOH
+ EOH
+ end
end
end