Re: Command Line

seth vidal <skvidal-c/MNwgJ9CEH2fBVCVOL8/[email protected]> Wed, 24 Mar 2004 02:25:49 -0500
Newsgroups gmane.linux.redhat.rpm.python
Message-ID <1080113148.12459.57.camel@binkley>
On Wed, 2004-03-24 at 09:20 +0200, Panu Matilainen wrote:

> On Tue, 23 Mar 2004, Rick Kornfeld wrote:
> > 
> > Are the command line options of RPM available to the programmer in
> > rpm-python? For instance, can I use options like -force -nodeps etc..
> > Programmatically in python. I know they are available in C/C++.
> 
> The API is available in python as well, but very little to do with command 
> line options of rpm :)
> 
> > If so, can someone provide an example program?
> 
> You just set the same transaction/problemfilter flags as you would in 
> C/C++. For example the equivalent of --force would be 
> 
> ts = rpm.TransactionSet()
> ts.setProbFilter(rpm.RPMPROB_FILTER_REPLACEPKG | 
>                  rpm.RPMPROB_FILTER_REPLACEOLDFILES | 
>                  rpm.RPMPROB_FILTER_REPLACENEWFILES)
> ...
> ts.run(...)
> 

where ... is a callback :)

-sv