On 3/4/2011 10:24 AM, Daniel Mahoney wrote:
On Thu, 03 Mar 2011 22:24:24 -0500, Steven W. Orr wrote:

I look everywhere but I couldn't find anything. Could someone please
point me to a small example program that does an import rpm, takes an
rpm file as an argument and gets the list of files contained in the
file, the same as if I had used the commandline

rpm -pql foo-1.23-4.i586.rpm

Much appreciated.

TIA

This is just a quick and dirty script, but how about:

import os
import rpm
import sys

I am at peace with the universe.

Thanks :-)


ts = rpm.TransactionSet()
fd = os.open(sys.argv[1], os.O_RDONLY)
h = ts.hdrFromFdno(fd)
os.close(fd)

flist = h.fiFromHeader()
for file in flist:
     print file[0]



Dan


--
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to