Module: PoiseLanguages::Scl::Mixin::ClassMethods

Included in:
PoiseLanguages::Scl::Mixin
Defined in:
lib/poise_languages/scl/mixin.rb

Instance Method Summary collapse

Instance Method Details

#default_inversion_options(node, resource) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Set some default inversion provider options. Package name can’t get a default value here because that would complicate the handling of system_package_candidates.



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/poise_languages/scl/mixin.rb', line 94

def default_inversion_options(node, resource)
  super.merge({
    # Install dev headers?
    dev_package: true,
    # Manual overrides for package name and/or version.
    package_name: nil,
    package_version: nil,
    # Set to true to use action :upgrade on system packages.
    package_upgrade: false,
  })
end

#find_scl_package(node, version) ⇒ Object



106
107
108
109
110
111
112
# File 'lib/poise_languages/scl/mixin.rb', line 106

def find_scl_package(node, version)
  platform_version = ::Gem::Version.create(node['platform_version'])
  # Filter out anything that doesn't match this EL version.
  candidate_packages = scl_packages.select {|p| p[:platform_version].satisfied_by?(platform_version) }
  # Find something with a prefix match on the Python version.
  candidate_packages.find {|p| p[:version].start_with?(version) }
end

#provides_auto?(node, resource) ⇒ Boolean

Returns:

  • (Boolean)


81
82
83
84
85
86
87
# File 'lib/poise_languages/scl/mixin.rb', line 81

def provides_auto?(node, resource)
  # They don't build 32-bit versions for these and only for RHEL/CentOS.
  # TODO: What do I do about Fedora and/or Amazon?
  return false unless node['kernel']['machine'] == 'x86_64' && node.platform?('redhat', 'centos')
  version = inversion_options(node, resource)['version']
  !!find_scl_package(node, version)
end