- show correct patch list
authorJan Kupec <jkupec@suse.cz>
Tue, 20 May 2008 11:58:11 +0000 (11:58 +0000)
committerJan Kupec <jkupec@suse.cz>
Tue, 20 May 2008 11:58:11 +0000 (11:58 +0000)
src/zypper-misc.cc

index ae814bb..2c4d5ce 100644 (file)
@@ -1605,10 +1605,24 @@ bool xml_list_patches ()
 
   unsigned int patchcount=0;
   bool pkg_mgr_available = false;
+  Patch::constPtr patch;
 
   ResPool::byKind_iterator
     it = pool.byKindBegin(ResKind::patch),
     e  = pool.byKindEnd(ResKind::patch);
+
+  // check whether there are packages affecting the update stack
+  for (; it != e; ++it)
+  {
+    patch = asKind<Patch>(it->resolvable());
+    if (it->isRelevant() && !it->isSatisfied() && patch->restartSuggested())
+    {
+      pkg_mgr_available = true;
+      break;
+    }
+  }
+
+  it = pool.byKindBegin(ResKind::patch);
   for (; it != e; ++it, ++patchcount)
   {
     if (it->isRelevant() && !it->isSatisfied())
@@ -1616,9 +1630,6 @@ bool xml_list_patches ()
       ResObject::constPtr res = it->resolvable();
       Patch::constPtr patch = asKind<Patch>(res);
 
-      if (patch->restartSuggested())
-        pkg_mgr_available = true;
-
       // if updates stack patches are available, show only those
       if ((pkg_mgr_available && patch->restartSuggested()) || !pkg_mgr_available)
       {