# File lib/puppet/provider/package/sun.rb, line 64
 64:   def info2hash(device = nil)
 65:     names = {
 66:       "PKGINST" => :name,
 67:       "NAME" => nil,
 68:       "CATEGORY" => :category,
 69:       "ARCH" => :platform,
 70:       "VERSION" => :ensure,
 71:       "BASEDIR" => :root,
 72:       "HOTLINE" => nil,
 73:       "EMAIL" => nil,
 74:       "VSTOCK" => nil,
 75:       "VENDOR" => :vendor,
 76:       "DESC" => :description,
 77:       "PSTAMP" => nil,
 78:       "INSTDATE" => nil,
 79:       "STATUS" => nil,
 80:       "FILES" => nil
 81:     }
 82: 
 83:     hash = {}
 84:     cmd = "#{command(:pkginfo)} -l"
 85:     cmd += " -d #{device}" if device
 86:     cmd += " #{@resource[:name]}"
 87: 
 88:     begin
 89:       # list out all of the packages
 90:       execpipe(cmd) { |process|
 91:         # we're using the long listing, so each line is a separate
 92:         # piece of information
 93:         process.readlines.each { |line|
 94:           case line
 95:           when /^$/  # ignore
 96:           when /\s*([A-Z]+):\s+(.+)/
 97:             name = $1
 98:             value = $2
 99:             if names.include?(name)
100:               hash[names[name]] = value unless names[name].nil?
101:             end
102:           when /\s+\d+.+/
103:             # nothing; we're ignoring the FILES info
104:           end
105:         }
106:       }
107:       return hash
108:     rescue Puppet::ExecutionFailure => detail
109:       return {:ensure => :absent} if detail.message =~ /information for "#{Regexp.escape(@resource[:name])}" was not found/
110:       puts detail.backtrace if Puppet[:trace]
111:       raise Puppet::Error, "Unable to get information about package #{@resource[:name]} because of: #{detail}"
112:     end
113:   end