On Jan 24, 2008 4:20 PM, Florian Festi <[EMAIL PROTECTED]> wrote:
> Hi!
>
> Recent timings showed that we populate the transaction object several
> times.
> This was necessary in the past when we where working with predownloaded
> headers but doesn't make sense anymore. I also realized that we call
> ts.check twice (once in _run_rpm_check_debug and once before ts.order).
>
> The attached patch is the first step to get things into order again. It
> adds
> a .clearTsFlag() method to the Transaction object to set back the TEST
> flag
> and moves the _run_rpm_check_debug() call into the area where the
> .dsCallback is unset to get rid of the unsetting code in
> _run_rpm_check_debug() itself.
>
> The code paths in cli.py look good already. The code in __init__.py - that
> is suposed to be used by 3rd party programs - is not that elaborated yet.
>
> Can someone with a bit more "3rd party usage" experience look over the
> patch, please?
>
> Thanks
>
> Florian
>
> _______________________________________________
> Yum-devel mailing list
> [email protected]
> https://lists.dulug.duke.edu/mailman/listinfo/yum-devel
>
>
i have tested the patch using the attached test script.
and i get the following Traceback.
[EMAIL PROTECTED] yum]$ sudo python simple-cli.py yumex
Trying to install : yumex
Traceback (most recent call last):
File "simple-cli.py", line 45, in <module>
app.run(sys.argv[1])
File "simple-cli.py", line 17, in run
self._runYumTransaction()
File "simple-cli.py", line 35, in _runYumTransaction
self.yumbase.processTransaction()
File "/home/tim/dev/work/packagekit/backends/yum/helpers/yum/__init__.py",
line 2492, in processTransaction
self._doTestTransaction(callback,display=rpmTestDisplay)
File "/home/tim/dev/work/packagekit/backends/yum/helpers/yum/__init__.py",
line 2554, in _doTestTransaction
tserrors = self.ts.test( RPMTransaction(self, test=True), conf=tsConf )
UnboundLocalError: local variable 'tsConf' referenced before assignment
Tim
#!/usr/bin/python -tt
import sys
import yum
class SimpleYumCli:
def __init__(self):
self.yumbase = yum.YumBase()
self.yumbase.doConfigSetup()
def run(self,name):
try:
print "Trying to install : %s" % name
txmbr = self.yumbase.install(name=name)
if txmbr:
self._runYumTransaction()
else:
print "Nothing to do with %s" % name
except yum.Errors.InstallError,e:
print str(e)
def _runYumTransaction(self):
'''
Run the yum Transaction
This will only work with yum 3.2.4 or higher
'''
rc,msgs = self.yumbase.buildTransaction()
if rc !=2:
retmsg = "Error in Dependency Resolution;" +"\n".join(msgs)
print retmsg
else:
try:
self.yumbase.processTransaction()
except yum.Errors.YumBaseError, ye:
retmsg = "Error in Transaction:" +"\n".join(ye.value)
print retmesg
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage: simple-cli.py <packagename to install>"
sys.exit(1)
app = SimpleYumCli()
app.run(sys.argv[1])
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel