[Aptitude-devel] r3227 - in branches/aptitude-0.3/aptitude: . doc/en src

Daniel Burrows dburrows@costa.debian.org
Sun, 01 May 2005 14:43:51 +0000


Author: dburrows
Date: Sun May  1 14:43:47 2005
New Revision: 3227

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/doc/en/aptitude.xml
   branches/aptitude-0.3/aptitude/src/defaults.cc
   branches/aptitude-0.3/aptitude/src/ui.cc
Log:
Add support for dumping the resolver state to a file from the visual interface.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sun May  1 14:43:47 2005
@@ -1,5 +1,10 @@
 2005-05-01  Daniel Burrows  <dburrows@debian.org>
 
+	* doc/en/aptitude.xml, src/defaults.cc, src/ui.cc:
+
+	  Add support for dumping the resolver state to a file from the
+	  visual interface.
+
 	* doc/en/aptitude.xml:
 
 	  Add a brief overview of the command-line resolver interface to

Modified: branches/aptitude-0.3/aptitude/doc/en/aptitude.xml
==============================================================================
--- branches/aptitude-0.3/aptitude/doc/en/aptitude.xml	(original)
+++ branches/aptitude-0.3/aptitude/doc/en/aptitude.xml	Sun May  1 14:43:47 2005
@@ -4762,6 +4762,16 @@
 	      </row>
 
 	      <row>
+		<entry><literal>DumpResolver</literal></entry>
+		<entry><literal>f6</literal></entry>
+		<entry>
+		  If packages are broken, writes the current state of
+		  the problem-resolver to a file (for debugging
+		  purposes).
+		</entry>
+	      </row>
+
+	      <row>
 		<entry><literal>EditHier</literal></entry>
 		<entry><literal>E</literal></entry>
 		<entry>

Modified: branches/aptitude-0.3/aptitude/src/defaults.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/defaults.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/defaults.cc	Sun May  1 14:43:47 2005
@@ -69,6 +69,7 @@
   global_bindings.set("PrevSolution", ',');
   global_bindings.set("ExamineSolution", 'e');
   global_bindings.set("ApplySolution", '!');
+  global_bindings.set("DumpResolver", KEY_F(6));
 
   pkg_tree::init_bindings();
   pkg_tree_node::init_bindings();

Modified: branches/aptitude-0.3/aptitude/src/ui.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/ui.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/ui.cc	Sun May  1 14:43:47 2005
@@ -38,6 +38,7 @@
 #include <sys/wait.h>
 #include <sys/stat.h>
 
+#include <fstream>
 #include <utility>
 
 #include "../config.h"
@@ -1296,6 +1297,37 @@
   popup_widget(make_solution_dialog(), true);
 }
 
+static void handle_dump_resolver_response(string s)
+{
+  if((*apt_cache_file)->resolver_exists())
+    {
+      ofstream out(s.c_str());
+
+      if(!out)
+	_error->Errno("dump_resolver", _("Unable to open %s"), s.c_str());
+      else
+	{
+	  (*apt_cache_file)->dump_resolver(out);
+
+	  if(!out)
+	    _error->Errno("dump_resolver", _("Error while dumping resolver state"));
+	}
+    }
+}
+
+static void do_dump_resolver()
+{
+  static vs_editline::history_list history;
+
+  if((*apt_cache_file)->resolver_exists())
+    prompt_string(_("File to which the resolver state should be dumped:"),
+		  "",
+		  arg(sigc::ptr_fun(handle_dump_resolver_response)),
+		  NULL,
+		  NULL,
+		  &history);
+}
+
 // NOTE ON TRANSLATIONS!
 //
 //   Implicitly translating stuff in the widget set would be ugly.  Everything
@@ -1683,6 +1715,9 @@
   main_stacked->connect_key_post("ExamineSolution",
 				 &global_bindings,
 				 sigc::ptr_fun(do_examine_solution));
+  main_stacked->connect_key_post("DumpResolver",
+				 &global_bindings,
+				 sigc::ptr_fun(do_dump_resolver));
 
   main_table=new vs_table;
   main_stacked->add_widget(main_table);