[Aptitude-devel] r3005 - in branches/aptitude-0.3/aptitude: . src/generic

Daniel Burrows dburrows@costa.debian.org
Sun, 10 Apr 2005 13:29:46 +0000


Author: dburrows
Date: Sun Apr 10 13:29:43 2005
New Revision: 3005

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/aptitude_resolver.h
Log:
Only iterate over critical revdeps.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sun Apr 10 13:29:43 2005
@@ -1,5 +1,10 @@
 2005-04-10  Daniel Burrows  <dburrows@debian.org>
 
+	* src/generic/aptitude_resolver.h:
+
+	  Only iterate over critical revdeps (I was iterating over *all*
+	  revdeps, which is what caused all the weirdness before).
+
 	* src/generic/problemresolver/problemresolver.h:
 
 	  Add more debugging, to make it easy to find out where

Modified: branches/aptitude-0.3/aptitude/src/generic/aptitude_resolver.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/aptitude_resolver.h	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/aptitude_resolver.h	Sun Apr 10 13:29:43 2005
@@ -332,6 +332,10 @@
   /** Advance to the next valid iterator. */
   void normalize()
   {
+    while(!dep_lst.end() &&
+	  !dep_lst.IsCritical())
+      ++dep_lst;
+
     // When we've run out of provides, give up..
     while(dep_lst.end() && !prv_lst.end())
       {
@@ -344,7 +348,13 @@
 	  ++prv_lst;
 
 	if(!prv_lst.end())
-	  dep_lst=prv_lst.ParentPkg().RevDependsList();
+	  {
+	    dep_lst=prv_lst.ParentPkg().RevDependsList();
+
+	    while(!dep_lst.end() &&
+		  !dep_lst.IsCritical())
+	      ++dep_lst;
+	  }
       }
   }
 
@@ -912,18 +922,24 @@
 
 	  if(!pkg.end())
 	    {
+	      // Examine just the InstVer of the package.
 	      pkgCache::VerIterator ver=(*apt_cache_file)[pkg].InstVerIter(*apt_cache_file);
 
 	      if(!ver.end())
 		the_dep=ver.DependsList();
 
 	      while(!the_dep.end() &&
-		     !(the_dep.IsCritical() &&
-		       dep_is_inst_broken(the_dep)))
+		    !(the_dep.IsCritical() &&
+		      dep_is_inst_broken(the_dep)))
 		++the_dep;
+
+	      if(the_dep.end())
+		++ver;
 	    }
 	}
 
+      assert(the_dep.end() || the_dep.IsCritical());
+
       // Now dep is a broken critical dep or an end dep.  If it is a
       // conflicts, we might need to push down into Provides...
       if(!the_dep.end() && the_dep->Type == pkgCache::Dep::Conflicts)