[Aptitude-devel] r2960 - in branches/aptitude-0.3/aptitude: . src src/cmdline

Daniel Burrows dburrows@costa.debian.org
Sat, 09 Apr 2005 14:44:21 +0000


Author: dburrows
Date: Sat Apr  9 14:44:19 2005
New Revision: 2960

Added:
   branches/aptitude-0.3/aptitude/src/cmdline/cmdline_dump_resolver.cc
   branches/aptitude-0.3/aptitude/src/cmdline/cmdline_dump_resolver.h
Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/cmdline/Makefile.am
   branches/aptitude-0.3/aptitude/src/main.cc
Log:
Add a debugging command to dump the resolver's state.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sat Apr  9 14:44:19 2005
@@ -1,5 +1,10 @@
 2005-04-09  Daniel Burrows  <dburrows@debian.org>
 
+	* src/main.cc, src/cmdline/Makefile.am, src/cmdline/cmdline_dump_resolver.cc, src/cmdline/cmdline_dump_resolver.h:
+
+	  Add a debugging command to dump the resolver's state
+	  (currently quite primitive).
+
 	* src/generic/problemresolver/aptitude_resolver.h:
 
 	  Fix some more missing stuff that turned up while trying to use

Modified: branches/aptitude-0.3/aptitude/src/cmdline/Makefile.am
==============================================================================
--- branches/aptitude-0.3/aptitude/src/cmdline/Makefile.am	(original)
+++ branches/aptitude-0.3/aptitude/src/cmdline/Makefile.am	Sat Apr  9 14:44:19 2005
@@ -14,6 +14,8 @@
 	cmdline_do_action.h \
 	cmdline_download.cc \
 	cmdline_download.h \
+	cmdline_dump_resolver.cc \
+	cmdline_dump_resolver.h \
 	cmdline_forget_new.cc \
 	cmdline_forget_new.h \
 	cmdline_moo.cc \

Added: branches/aptitude-0.3/aptitude/src/cmdline/cmdline_dump_resolver.cc
==============================================================================
--- (empty file)
+++ branches/aptitude-0.3/aptitude/src/cmdline/cmdline_dump_resolver.cc	Sat Apr  9 14:44:19 2005
@@ -0,0 +1,48 @@
+// cmdline_dump_resolver.cc
+//
+//   Copyright (C) 2005 Daniel Burrows
+
+//   This program is free software; you can redistribute it and/or
+//   modify it under the terms of the GNU General Public License as
+//   published by the Free Software Foundation; either version 2 of
+//   the License, or (at your option) any later version.
+
+//   This program is distributed in the hope that it will be useful,
+//   but WITHOUT ANY WARRANTY; without even the implied warranty of
+//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//   General Public License for more details.
+
+//   You should have received a copy of the GNU General Public License
+//   along with this program; see the file COPYING.  If not, write to
+//   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+//   Boston, MA 02111-1307, USA.
+//
+// Just print out the current resolver state (debugging tool)
+
+#include "cmdline_dump_resolver.h"
+
+#include <generic/problemresolver/aptitude_resolver.h>
+
+#include <apt-pkg/error.h>
+
+using namespace std;
+
+int cmdline_dump_resolver(int argc, char *argv[],
+			  const char *status_fname)
+{
+  _error->DumpErrors();
+
+  OpProgress progress;
+
+  apt_init(&progress, true, status_fname);
+
+  if(_error->PendingError())
+    {
+      _error->DumpErrors();
+      return -1;
+    }
+
+  aptitude_universe u;
+
+  dump_universe(u, cout);
+}

Added: branches/aptitude-0.3/aptitude/src/cmdline/cmdline_dump_resolver.h
==============================================================================
--- (empty file)
+++ branches/aptitude-0.3/aptitude/src/cmdline/cmdline_dump_resolver.h	Sat Apr  9 14:44:19 2005
@@ -0,0 +1,26 @@
+// cmdline_dump_resolver.h                     -*-c++-*-
+//
+//   Copyright (C) 2005 Daniel Burrows
+
+//   This program is free software; you can redistribute it and/or
+//   modify it under the terms of the GNU General Public License as
+//   published by the Free Software Foundation; either version 2 of
+//   the License, or (at your option) any later version.
+
+//   This program is distributed in the hope that it will be useful,
+//   but WITHOUT ANY WARRANTY; without even the implied warranty of
+//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//   General Public License for more details.
+
+//   You should have received a copy of the GNU General Public License
+//   along with this program; see the file COPYING.  If not, write to
+//   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+//   Boston, MA 02111-1307, USA.
+
+#ifndef CMDLINE_DUMP_RESOLVER
+#define CMDLINE_DUMP_RESOLVER
+
+int cmdline_dump_resolver(int argc, char *argv[], const char *status_fname);
+
+#endif
+

Modified: branches/aptitude-0.3/aptitude/src/main.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/main.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/main.cc	Sat Apr  9 14:44:19 2005
@@ -1,6 +1,6 @@
-// testscr.cc
+// main.cc  (ne้ testscr.cc)
 //
-//  Copyright 1999,2000,2001 Daniel Burrows
+//  Copyright 1999-2005 Daniel Burrows
 //
 //  This program is free software; you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
@@ -40,6 +40,7 @@
 #include <cmdline/cmdline_clean.h>
 #include <cmdline/cmdline_do_action.h>
 #include <cmdline/cmdline_download.h>
+#include <cmdline/cmdline_dump_resolver.h>
 #include <cmdline/cmdline_forget_new.h>
 #include <cmdline/cmdline_moo.h>
 #include <cmdline/cmdline_search.h>
@@ -382,6 +383,8 @@
 	return cmdline_moo(argc-optind, argv+optind, verbose);
       else if(!strcasecmp(argv[optind], "show"))
 	return cmdline_show(argc-optind, argv+optind, verbose);
+      else if(!strcasecmp(argv[optind], "dump-resolver"))
+	return cmdline_dump_resolver(argc-optind, argv+optind, status_fname);
       else if(!strcasecmp(argv[optind], "help"))
 	{
 	  usage();