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