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

Daniel Burrows dburrows@costa.debian.org
Fri, 08 Apr 2005 15:10:04 +0000


Author: dburrows
Date: Fri Apr  8 15:10:02 2005
New Revision: 2953

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h
   branches/aptitude-0.3/aptitude/src/generic/problemresolver/test.cc
Log:
Make dump_universe generic and fix its output format.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Fri Apr  8 15:10:02 2005
@@ -1,3 +1,10 @@
+2005-04-08  Daniel Burrows  <dburrows@debian.org>
+
+	* src/generic/problemresolver/problemresolver.h, src/generic/problemresolver/test.cc:
+
+	  Make dump_universe generic, move it to problemresolver.h, and
+	  output exactly the information expected by the test parser.
+
 2005-04-07  Daniel Burrows  <dburrows@debian.org>
 
 	* src/generic/problemresolver/problemresolver.h:

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	Fri Apr  8 15:10:02 2005
@@ -731,4 +731,35 @@
   }
 };
 
+
+template<class PackageUniverse>
+void dump_universe(const PackageUniverse &world, ostream &out)
+{
+  for(typename PackageUniverse::package_iterator p=world.packages_begin();
+      p!=world.packages_end(); ++p)
+    {
+      out << "PACKAGE " << (*p).get_name() << " < ";
+      for(typename PackageUniverse::package::version_iterator v=(*p).versions_begin();
+	  v!=(*p).versions_end(); ++v)
+	out << (*v).get_name() << " ";
+      out << ">" << " " << (*p).current_version().get_name() << endl;
+    }
+
+  for(typename PackageUniverse::dep_iterator d=world.deps_begin();
+      d!=world.deps_end(); ++d)
+    {
+      const typename PackageUniverse::version &sv=(*d).get_source();
+      const typename PackageUniverse::package &sp=sv.get_package();
+
+      out << "DEP " << sp.get_name() << " " << sv.get_name() << " < ";
+
+      for(typename PackageUniverse::dep::solver_iterator t=(*d).solvers_begin();
+	  t!=(*d).solvers_end(); ++t)
+	{
+	  out << " " << (*t).get_package().get_name() << " " << (*t).get_name() << " ";
+	}
+      out << " > " << endl;
+    }
+}
+
 #endif

Modified: branches/aptitude-0.3/aptitude/src/generic/problemresolver/test.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/problemresolver/test.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/problemresolver/test.cc	Fri Apr  8 15:10:02 2005
@@ -833,35 +833,6 @@
   return rval;
 }
 
-void dump_universe(const dummy_universe &world, ostream &out)
-{
-  for(dummy_universe::package_iterator p=world.packages_begin();
-      p!=world.packages_end(); ++p)
-    {
-      out << "PACKAGE " << (*p).get_name() << " < ";
-      for(dummy_universe::package::version_iterator v=(*p).versions_begin();
-	  v!=(*p).versions_end(); ++v)
-	out << (*v).get_name() << " ";
-      out << ">" << endl;
-    }
-
-  for(dummy_universe::dep_iterator d=world.deps_begin();
-      d!=world.deps_end(); ++d)
-    {
-      const dummy_universe::version &sv=(*d).get_source();
-      const dummy_universe::package &sp=sv.get_package();
-
-      out << "DEP " << sp.get_name() << " " << sv.get_name() << " < ";
-
-      for(dummy_universe::dep::solver_iterator t=(*d).solvers_begin();
-	  t!=(*d).solvers_end(); ++t)
-	{
-	  out << " " << (*t).get_package().get_name() << " " << (*t).get_name() << " ";
-	}
-      out << " > " << endl;
-    }
-}
-
 int main(int argc, char **argv)
 {
   int rval=0;