[Aptitude-svn-commit] r3797 - in branches/aptitude-0.3/aptitude: . src/generic src/generic/problemresolver

Daniel Burrows dburrows at costa.debian.org
Wed Aug 10 03:53:10 UTC 2005


Author: dburrows
Date: Wed Aug 10 03:53:06 2005
New Revision: 3797

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/aptitude_resolver.h
   branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h
Log:
Add backend support for retrieving justifications for actions and putting them in a sensible order.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Aug 10 03:53:06 2005
@@ -1,5 +1,10 @@
 2005-08-09  Daniel Burrows  <dburrows at debian.org>
 
+	* src/generic/problemresolver/problemresolver.h:
+
+	  Add support for reading off dependencies and placing them in
+	  "story order".
+
 	* src/defaults.cc, src/solution_fragment.cc:
 
 	  Use the new methods to allow the user to interactively narrow

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	Wed Aug 10 03:53:06 2005
@@ -248,12 +248,13 @@
    */
   pkgCache::PrvIterator prv;
 public:
-#if 0
+  /** \todo this is a dreadful hack, but it's needed to avoid crashing
+   *        until PrvIterators get a sensible default constructor.
+   */
   aptitude_resolver_dep()
-    :cache(0)
+    :cache(0), prv(*apt_cache_file, (pkgCache::Provides *) 1, (pkgCache::Package *) 0)
   {
   }
-#endif
 
   aptitude_resolver_dep(const pkgCache::DepIterator dep,
 			const pkgCache::PrvIterator _prv,

Modified: branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h	Wed Aug 10 03:53:06 2005
@@ -120,9 +120,19 @@
   {
     version ver;
 
+    /** The dependency that triggered this action. */
+    dep d;
+
+    /** The order in which this action should be placed.  Used when
+     *  presenting a "story" about a solution.
+     */
+    int id;
+
     action() {}
 
-    action(const version &_ver):ver(_ver) {}
+    action(const version &_ver,
+	   const dep &_d,
+	   int _id):ver(_ver), d(_d), id(_id) {}
 
     bool operator<(const action &other) const {return ver<other.ver;}
   };
@@ -863,7 +873,7 @@
   }
 
   /** Enqueues a single successor node to the given solution by
-   *  installing the given package version.
+   *  installing the given package versions.
    *
    *  \param s the predecessor of the new solution
    *  \param v the version to install
@@ -977,7 +987,7 @@
 	      if(debug)
 		std::cout << "  Trying to resolve " << d << " by installing " << (*vi).get_package().get_name() << " version " << (*vi).get_name() << std::endl;
 
-	      action act(*vi);
+	      action act(*vi, d, s.get_actions().size());
 	      if(try_install(s, &act, (&act)+1, d.solvers_begin()))
 		++count;
 	    }
@@ -1009,7 +1019,7 @@
 	    if(debug)
 	      std::cout << "  Trying to resolve " << d << " by installing " << (*si).get_package().get_name() << " version " << (*si).get_name() << std::endl;
 
-	    action act(*si);
+	    action act(*si, d, s.get_actions().size());
 	    if(try_install(s, &act, (&act)+1, dummy_end_iterator<version>()))
 	      ++count;
 	  }
@@ -1097,7 +1107,7 @@
 	      !si.end(); ++si)
 	    toforbid.insert(*si);
 
-	actions.insert(action(v));
+	actions.insert(action(v, d, s.get_actions().size()+actions.size()));
 
 	return false;
       }



More information about the Aptitude-svn-commit mailing list