[Yum-devel] Making yum quiet - yum.logginglevels.setDebugLevel(0) seemingly not working...

James Antill james at fedoraproject.org
Thu Jun 11 17:58:37 UTC 2009


On Thu, 2009-06-11 at 17:19 +0100, MacCana, Mike (London) wrote:

> OK, I've had a crack at this borrowing the ProcessTransNoOutputCallback from a while back.
> 
> def install():
>     class ProcessTransNoOutputCallback:
>         def __init__(self):
>             pass        
>         def event(self,state,data=None):
>             pass
>     yb = yum.YumBase()
>     yb.install(name='zlib-devel')
>     yb.resolveDeps()
>     yb.processTransaction(callback=ProcessTransNoOutputCallback())
>     print('success\n')
> 
> install()
> 
> This works, but the output's still the same.

 You are being confused by the different usage of "callback". There is
more than one giant callback class. For instance processTransaction()
has an argument called callback, however if you don't pass anything
(your initial code) it uses callbacks.ProcessTransNoOutputCallback() ...
which does the same thing as the above code.

 However the "Installing: <pkg> ..." lines are coming from
rpmtrans.SimpleCliCallBack(), which is the default from the code path
processTransaction() => _doTransaction() => runTransaction().
 To change that you can do what yum-updatesd does, which is have it's
own _doTransaction() locally, and pass
callback.RPMInstallCallback(output = 0) as the callback.
 Or you can still use processTransaction() but pass in a custom
"rpmDisplay callback", which is passed down to _doTransaction() and
overrides SimpleCliCallBack() from the above code path (Eg. use:
rpmtrans.NoOutputCallBack).

-- 
James Antill <james at fedoraproject.org>
Fedora


More information about the Yum-devel mailing list