1 # Copyright 2007, Red Hat, Inc
2 # Michael DeHaan <mdehaan@redhat.com>
4 # This software may be freely redistributed under the terms of the GNU
5 # general public license.
7 # You should have received a copy of the GNU General Public License
8 # along with this program; if not, write to the Free Software
9 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
14 class RpmModule(func_module
.FuncModule
):
18 description
= "RPM related commands."
20 def inventory(self
, flatten
=True):
22 Returns information on all installed packages.
23 By default, 'flatten' is passed in as True, which makes printouts very
24 clean in diffs for use by func-inventory. If you are writting another
25 software application, using flatten=False will prevent the need to
28 # I have not been able to get flatten=False to work if there
29 # is more than 491 entries in the dict -- ashcrow
30 ts
= rpm
.TransactionSet()
35 epoch
= (hdr
['epoch'] or 0)
36 version
= hdr
['version']
37 release
= hdr
['release']
40 results
.append("%s %s %s %s %s" % (name
, epoch
, version
,
43 results
.append([name
, epoch
, version
, release
, arch
])