Need an example program that implements rpm -pql via import rpm

S

Steven W. Orr

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

--
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
 
S

Steven W. Orr

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,821
Messages
2,569,748
Members
45,726
Latest member
RaleighAll

Latest Threads

Top