Blob Blame History Raw
commit 63540521709205dd601994e2b05b7ddd3712b3a1
Author: Seth Vidal <skvidal@fedoraproject.org>
Date:   Thu Jul 10 12:21:29 2008 -0400

    make sure the reqpo exists before we compare it

diff --git a/yum/depsolve.py b/yum/depsolve.py
index 8bb2cf1..2577cef 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -986,8 +986,13 @@ class Depsolve(object):
                     if obsoleted:
                         pkgresults[po] -= 1024
                         break
-
-                for thisarch in (reqpo.arch, getBestArch()):
+                
+                if reqpo:
+                    arches = (reqpo.arch, getBestArch())
+                else:
+                    arches = (getBestArch())
+                
+                for thisarch in arches:
                     res = _compare_arch_distance(po, nextpo, thisarch)
                     if not res:
                         continue
@@ -1001,13 +1006,13 @@ class Depsolve(object):
                 self.verbose_logger.log(logginglevels.DEBUG_4,
                     _('common sourcerpm %s and %s' % (po, reqpo)))
                 pkgresults[po] += 20
-            
-            cpl = _common_prefix_len(po.name, reqpo.name)
-            if cpl > 2:
-                self.verbose_logger.log(logginglevels.DEBUG_4,
-                    _('common prefix of %s between %s and %s' % (cpl, po, reqpo)))
-            
-                pkgresults[po] += cpl*2
+            if reqpo:
+                cpl = _common_prefix_len(po.name, reqpo.name)
+                if cpl > 2:
+                    self.verbose_logger.log(logginglevels.DEBUG_4,
+                        _('common prefix of %s between %s and %s' % (cpl, po, reqpo)))
+                
+                    pkgresults[po] += cpl*2
             
             pkgresults[po] += (len(po.name)*-1)