Method: Chef::Provider::Package::Portage#candidate_version

Defined in:
lib/chef/provider/package/portage.rb

#candidate_versionObject



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/chef/provider/package/portage.rb', line 82

def candidate_version
  return @candidate_version if @candidate_version

  status = popen4("emerge --color n --nospinner --search #{@new_resource.package_name.split('/').last}") do |pid, stdin, stdout, stderr|
    available, installed = parse_emerge(@new_resource.package_name, stdout.read)
    @candidate_version = available
  end

  unless status.exitstatus == 0
    raise Chef::Exceptions::Package, "emerge --search failed - #{status.inspect}!"
  end

  @candidate_version

end