On Jan 25, 2008 10:58 AM, Tim Lauridsen <[EMAIL PROTECTED]>
wrote:
>
>
> 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
The attached patch seem to solve it
Tim
diff --git a/yum/__init__.py b/yum/__init__.py
index 29e00df..23c4f91 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2545,6 +2545,18 @@ class YumBase(depsolve.Depsolve):
def _doTestTransaction(self,callback,display=None):
''' Do the RPM test transaction '''
# This can be overloaded by a subclass.
+
+ tsConf = {}
+ for feature in ['diskspacecheck']: # more to come, I'm sure
+ tsConf[feature] = getattr( self.conf, feature )
+
+ self.initActionTs()
+ # save our dsCallback out
+ dscb = self.dsCallback
+ self.dsCallback = None # dumb, dumb dumb dumb!
+ self.populateTs( keepold=0 ) # sigh
+ tserrors = self.ts.test( RPMTransaction(self, test=True), conf=tsConf )
+
if self.conf.rpm_check_debug:
self.verbose_logger.log(logginglevels.INFO_2,
'Running rpm_check_debug')
@@ -2555,24 +2567,10 @@ class YumBase(depsolve.Depsolve):
retmsgs.append('Please report this error in bugzilla')
raise Errors.YumRPMCheckError,retmsgs
- tsConf = {}
- for feature in ['diskspacecheck']: # more to come, I'm sure
- tsConf[feature] = getattr( self.conf, feature )
- #
- testcb = RPMTransaction(self, test=True)
+
# overwrite the default display class
if display:
testcb.display = display
- # clean out the ts b/c we have to give it new paths to the rpms
- del self.ts
-
- self.initActionTs()
- # save our dsCallback out
- dscb = self.dsCallback
- self.dsCallback = None # dumb, dumb dumb dumb!
- self.populateTs( keepold=0 ) # sigh
- tserrors = self.ts.test( testcb, conf=tsConf )
- del testcb
if len( tserrors ) > 0:
errstring = 'Test Transaction Errors: '
@@ -2601,10 +2599,6 @@ class YumBase(depsolve.Depsolve):
def _run_rpm_check_debug(self):
import rpm
results = []
- # save our dsCallback out
- dscb = self.dsCallback
- self.dsCallback = None # dumb, dumb dumb dumb!
- self.populateTs(test=1)
deps = self.ts.check()
for deptuple in deps:
((name, version, release), (needname, needversion), flags,
@@ -2619,6 +2613,5 @@ class YumBase(depsolve.Depsolve):
(name, rpmUtils.miscutils.formatRequire(needname,
needversion, flags))
results.append(msg)
- self.dsCallback = dscb
return results
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel