# File lib/chef/provider/package/portage.rb, line 59
        def parse_emerge(package, txt)
          availables = {}
          package_without_category = package.split("/").last
          found_package_name = nil

          txt.each_line do |line|
            if line =~ /\*\s+#{PACKAGE_NAME_PATTERN}/
              found_package_name = $&.strip
              if found_package_name == package || found_package_name.split("/").last == package_without_category
                availables[found_package_name] = nil
              end
            end

            if line =~ /Latest version available: (.*)/ && availables.has_key?(found_package_name)
              availables[found_package_name] = $1.strip
            end
          end

          if availables.size > 1
            # shouldn't happen if a category is specified so just use `package`
            raise Chef::Exceptions::Package, "Multiple emerge results found for #{package}: #{availables.keys.join(" ")}. Specify a category."
          end

          availables.values.first
        end