# File lib/puppet/provider/package/dpkg.rb, line 14 14: def self.instances 15: packages = [] 16: 17: # list out all of the packages 18: cmd = "#{command(:dpkgquery)} -W --showformat '${Status} ${Package} ${Version}\\n'" 19: Puppet.debug "Executing '#{cmd}'" 20: execpipe(cmd) do |process| 21: # our regex for matching dpkg output 22: regex = %r{^(\S+) +(\S+) +(\S+) (\S+) (\S*)$} 23: fields = [:desired, :error, :status, :name, :ensure] 24: hash = {} 25: 26: # now turn each returned line into a package object 27: process.each { |line| 28: if hash = parse_line(line) 29: packages << new(hash) 30: end 31: } 32: end 33: 34: packages 35: end