Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Need an example program that implements rpm -pql via import rpm

Reply
Thread Tools

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

 
 
Steven W. Orr
Guest
Posts: n/a
 
      03-04-2011
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
 
Reply With Quote
 
 
 
 
Steven W. Orr
Guest
Posts: n/a
 
      03-04-2011
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
Ruby program installed via RPM Joe Van Dyk Ruby 5 08-31-2006 10:20 PM
pystone: pydotorg's RPM scores better than Fedora 2's RPM Zhi Min Python 0 06-11-2004 08:40 AM
Re: Python 2.3.2 RPM's for Redhat 8.0 or Python source RPM andupgrade procedure? Cliff Wells Python 1 10-13-2003 01:03 PM
Python 2.3.2 RPM's for Redhat 8.0 or Python source RPM and upgrade procedure? Scott Chapman Python 0 10-03-2003 05:43 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57