Comment 0 for bug 992826

Revision history for this message
ric (richard077) wrote :

outer "for" cycle uses same control variable

this patch changes name of control variable of "for" cycle to resolve this problem:

--- transaction.py.orig 2012-05-01 14:04:42.346473898 +0200
+++ transaction.py 2012-05-01 14:20:27.939162930 +0200
@@ -641,15 +641,15 @@
                 # Check if someone installed is still providing it.
                 prvpkgs = {}
                 found = False
- for prv in req.providedby:
- for prvpkg in prv.packages:
- if prvpkg is pkg:
+ for prvreq in req.providedby:
+ for prvreqpkg in prvreq.packages:
+ if prvreqpkg is pkg:
                             continue
- if isinst(prvpkg):
+ if isinst(prvreqpkg):
                             found = True
                             break
- if prvpkg not in locked:
- prvpkgs[prvpkg] = True
+ if prvreqpkg not in locked:
+ prvpkgs[prvreqpkg] = True
                     else:
                         continue
                     break
@@ -662,7 +662,7 @@

                 if prvpkgs:
                     # There are other options, besides removing.
- pending.append((PENDING_REMOVE, pkg, prv, req.packages,
+ pending.append((PENDING_REMOVE, pkg, prvreq, prvreq.packages,
                                     prvpkgs.keys()))
                 else:
                     # Remove every requiring package, or
@@ -1245,11 +1245,11 @@
                 # selected for installation provide the
                 # needed dependency.
                 found = False
- for prv in req.providedby:
- for prvpkg in prv.packages:
- if (subset.get(prvpkg) is INSTALL or
- (prvpkg.installed and not
- subset.get(prvpkg) is REMOVE)):
+ for prvreq in req.providedby:
+ for prvreqpkg in prvreq.packages:
+ if (subset.get(prvreqpkg) is INSTALL or
+ (prvreqpkg.installed and not
+ subset.get(prvreqpkg) is REMOVE)):
                             found = True
                             break
                     else:
@@ -1261,12 +1261,12 @@
                 # Try to include some providing package
                 # that is selected for installation.
                 found = False
- for prv in req.providedby:
- for prvpkg in prv.packages:
- if (set.get(prvpkg) is INSTALL and
- prvpkg not in locked):
+ for prvreq in req.providedby:
+ for prvreqpkg in prvreq.packages:
+ if (set.get(prvreqpkg) is INSTALL and
+ prvreqpkg not in locked):
                             try:
- self.include(subset, prvpkg, locked)
+ self.include(subset, prvreqpkg, locked)
                             except Error:
                                 pass
                             else:
@@ -1282,16 +1282,16 @@
                 # providing package which is already installed.
                 found = False
                 wasbroken = True
- for prv in req.providedby:
- for prvpkg in prv.packages:
- if set.get(prvpkg) is not REMOVE:
+ for prvreq in req.providedby:
+ for prvreqpkg in prvreq.packages:
+ if set.get(prvreqpkg) is not REMOVE:
                             continue
                         wasbroken = False
                         # Package is necessarily in subset
                         # otherwise we wouldn't get here.
- if prvpkg not in locked:
+ if prvreqpkg not in locked:
                             try:
- self.exclude(subset, prvpkg, locked)
+ self.exclude(subset, prvreqpkg, locked)
                             except Error:
                                 pass
                             else: