Seth Vidal 719dcfd
commit 63540521709205dd601994e2b05b7ddd3712b3a1
Seth Vidal 719dcfd
Author: Seth Vidal <skvidal@fedoraproject.org>
Seth Vidal 719dcfd
Date:   Thu Jul 10 12:21:29 2008 -0400
Seth Vidal 719dcfd
Seth Vidal 719dcfd
    make sure the reqpo exists before we compare it
Seth Vidal 719dcfd
Seth Vidal 719dcfd
diff --git a/yum/depsolve.py b/yum/depsolve.py
Seth Vidal 719dcfd
index 8bb2cf1..2577cef 100644
Seth Vidal 719dcfd
--- a/yum/depsolve.py
Seth Vidal 719dcfd
+++ b/yum/depsolve.py
Seth Vidal 719dcfd
@@ -986,8 +986,13 @@ class Depsolve(object):
Seth Vidal 719dcfd
                     if obsoleted:
Seth Vidal 719dcfd
                         pkgresults[po] -= 1024
Seth Vidal 719dcfd
                         break
Seth Vidal 719dcfd
-
Seth Vidal 719dcfd
-                for thisarch in (reqpo.arch, getBestArch()):
Seth Vidal 719dcfd
+                
Seth Vidal 719dcfd
+                if reqpo:
Seth Vidal 719dcfd
+                    arches = (reqpo.arch, getBestArch())
Seth Vidal 719dcfd
+                else:
Seth Vidal 719dcfd
+                    arches = (getBestArch())
Seth Vidal 719dcfd
+                
Seth Vidal 719dcfd
+                for thisarch in arches:
Seth Vidal 719dcfd
                     res = _compare_arch_distance(po, nextpo, thisarch)
Seth Vidal 719dcfd
                     if not res:
Seth Vidal 719dcfd
                         continue
Seth Vidal 719dcfd
@@ -1001,13 +1006,13 @@ class Depsolve(object):
Seth Vidal 719dcfd
                 self.verbose_logger.log(logginglevels.DEBUG_4,
Seth Vidal 719dcfd
                     _('common sourcerpm %s and %s' % (po, reqpo)))
Seth Vidal 719dcfd
                 pkgresults[po] += 20
Seth Vidal 719dcfd
-            
Seth Vidal 719dcfd
-            cpl = _common_prefix_len(po.name, reqpo.name)
Seth Vidal 719dcfd
-            if cpl > 2:
Seth Vidal 719dcfd
-                self.verbose_logger.log(logginglevels.DEBUG_4,
Seth Vidal 719dcfd
-                    _('common prefix of %s between %s and %s' % (cpl, po, reqpo)))
Seth Vidal 719dcfd
-            
Seth Vidal 719dcfd
-                pkgresults[po] += cpl*2
Seth Vidal 719dcfd
+            if reqpo:
Seth Vidal 719dcfd
+                cpl = _common_prefix_len(po.name, reqpo.name)
Seth Vidal 719dcfd
+                if cpl > 2:
Seth Vidal 719dcfd
+                    self.verbose_logger.log(logginglevels.DEBUG_4,
Seth Vidal 719dcfd
+                        _('common prefix of %s between %s and %s' % (cpl, po, reqpo)))
Seth Vidal 719dcfd
+                
Seth Vidal 719dcfd
+                    pkgresults[po] += cpl*2
Seth Vidal 719dcfd
             
Seth Vidal 719dcfd
             pkgresults[po] += (len(po.name)*-1)
Seth Vidal 719dcfd