--debug-solver added for generating solver test case
authorJan Kupec <jkupec@suse.cz>
Tue, 31 Jul 2007 09:04:29 +0000 (09:04 +0000)
committerJan Kupec <jkupec@suse.cz>
Tue, 31 Jul 2007 09:04:29 +0000 (09:04 +0000)
doc/zypper.8
src/zypper-misc.cc
src/zypper.cc

index 94342e8..a3dd17d 100644 (file)
@@ -69,6 +69,12 @@ Select resolvables by older method, considering just names, not capabilities.
 .TP
 .I \-l, \-\-auto\-agree\-with\-licenses
 Automatically say 'yes' to third party license confirmation prompt. By using this option, you choose to agree with licenses of all third-party software this command will install. This option is particularly useful for administators installing the same set of packages on multiple machines (by an automated process) and have the licenses confirmed before.
+.TP
+.I      \-\-debug\-solver
+Create solver test case for debugging. Use this option, if you think the
+dependencies were not solved all right and attach the resulting /var/log/zypper.solverTestCase
+directory to your bug report. To use this option, simply add it to the problematic
+install or remove command. 
 
 .TP
 .B list-updates (lu) [options]
@@ -86,14 +92,17 @@ See also the NOTE at
 .TP
 .B remove (rm) <capability> ...
 Remove resolvables.
+.PP
+Capability is usually a plain name, for details see the install command.
 .TP
 \fI\-t, -\-type\fR <resolvable_type>
 Type of resolvable (default: package)
 .TP
 .I \-n, \-\-name
 Select resolvables by older method, considering just names, not capabilities.
-
-Capability is usually a plain name, for details see the install command.
+.TP
+.I      \-\-debug\-solver
+Create solver test case for debugging. See the install command for details.
 
 .TP
 .B update (up) [options]
index a3597d0..b485b3d 100644 (file)
@@ -537,7 +537,7 @@ void load_target_resolvables()
 
 void establish ()
 {
-  cerr_v << _("Establishing status of aggregates") << endl;
+  cout_v << _("Establishing status of aggregates") << endl;
   God->resolver()->establishPool();
   dump_pool ();
 }
@@ -545,7 +545,7 @@ void establish ()
 bool resolve( bool have_extra_deps )
 {
   establish ();
-  cerr_v << _("Resolving dependencies...") << endl;
+  cout_v << _("Resolving dependencies...") << endl;
   if (have_extra_deps)
     return God->resolver()->resolvePool( true, true );
 
index c8a8cab..c52131d 100644 (file)
@@ -270,14 +270,16 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
       {"auto-agree-with-licenses",  no_argument,       0, 'l'},
       // rug compatibility, we have --auto-agree-with-licenses
       {"agree-to-third-party-licenses",  no_argument,  0, 0},
+      {"debug-solver",              no_argument,       0, 0},
       {"help",                      no_argument,       0, 'h'},
       {0, 0, 0, 0}
     };
     specific_options = install_options;
     specific_help = _(
-      "install [options] <name> ...\n"
+      "install [options] <capability> ...\n"
       "\n"
-      "'install' - Install resolvabe(s) with specified name(s).\n"
+      "'install' - Install resolvables with specified capabilities. A capability is\n"
+      "            NAME[ OP <VERSION>], where OP is one of <, <=, =, >=, >.\n"
       "\n"
       "  Command options:\n"
       "\t--catalog,-c\t\t\tOnly from this catalog (under development)\n"
@@ -285,25 +287,30 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
       "\t--name,-n\t\t\tSelect resolvables by plain name, not by capability\n"
       "\t--auto-agree-with-licenses,-l\tAutomatically say 'yes' to third party license confirmation prompt.\n"
       "\t\t\t\t\tSee man zypper for more details.\n"
+      "\t--debug-solver\t\t\tCreate solver test case for debugging\n"  
     );
   }
   else if (command == ZypperCommand::REMOVE) {
     static struct option remove_options[] = {
       {"type",       required_argument, 0, 't'},
       {"name",      no_argument,       0, 'n'},
+      // rug compatibility, we have global --non-interactive
       {"no-confirm", no_argument,       0, 'y'},
+      {"debug-solver", no_argument,     0, 0},
       {"help",       no_argument,       0, 'h'},
       {0, 0, 0, 0}
     };
     specific_options = remove_options;
     specific_help = _(
-      "remove [options] <name> ...\n"
+      "remove [options] <capability> ...\n"
       "\n"
-      "'remove' - Remove resolvabe(s) with specified name(s).\n"
+      "'remove' - Remove resolvables with specified capabilities. A capability is\n"
+      "            NAME[ OP <VERSION>], where OP is one of <, <=, =, >=, >.\n"
       "\n"
       "  Command options:\n"
       "\t--type,-t <resolvable_type>\tType of resolvable (package, patch, pattern, product) (default: package)\n"
       "\t--name,-n\t\t\tSelect resolvables by plain name, not by capability\n"
+      "\t--debug-solver\t\t\tCreate solver test case for debugging\n"  
       );
   }
   else if (command == ZypperCommand::ADD_REPO) {
@@ -435,8 +442,9 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
       {"type",                     required_argument, 0, 't'},
       {"skip-interactive",          no_argument,       0, 0},
       {"auto-agree-with-licenses",  no_argument,       0, 'l'},
-      { "from-repo",                required_argument, 0, 0 },
-      { "best-effort",              no_argument,       0, 0 },
+      {"from-repo",                 required_argument, 0, 0},
+      {"best-effort",               no_argument,       0, 0},
+      {"debug-solver",              no_argument,       0, 0},
       {"help", no_argument, 0, 'h'},
       {0, 0, 0, 0}
     };
@@ -452,7 +460,8 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
       "\t\t\t\t\tSee man zypper for more details.\n"
       "\t--from-repo <repository_alias>\tRestrict updates to named repository (default: get updates from all repositories)\n"
       "\t--best-effort\t\t\tDo a 'best effort' approach to update, updates to a lower than latest-and-greatest version are also acceptable\n"
-      );
+      "\t--debug-solver\t\t\tCreate solver test case for debugging\n"  
+    );
   }
   else if (command == ZypperCommand::SEARCH) {
     static struct option search_options[] = {
@@ -980,8 +989,22 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
       else
        mark_by_capability (install_not_remove, kind, *it);
     }
-    
-    solve_and_commit (!just_name);
+
+    if (copts.count("debug-solver"))
+    {
+      establish();
+      cout_n << _("Generating solver test case...") << endl;
+      if (God->resolver()->createSolverTestcase("/var/log/zypper.solverTestCase"))
+        cout_n << _("Solver test case generated successfully.") << endl;
+      else
+      {
+        cerr << _("Error creating the solver test case.") << endl;
+        return ZYPPER_EXIT_ERR_ZYPP;
+      }
+    }
+    else
+      return solve_and_commit (!just_name);
+
     return ZYPPER_EXIT_OK;
   }
 
@@ -1189,10 +1212,22 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
     bool skip_interactive = copts.count("skip-interactive") || gSettings.non_interactive;
     mark_updates( kind, srepo, skip_interactive, best_effort );
 
+
+    if (copts.count("debug-solver"))
+    {
+      cout_n << _("Generating solver test case...") << endl;
+      if (God->resolver()->createSolverTestcase("/var/log/zypper.solverTestCase"))
+        cout_n << _("Solver test case generated successfully.") << endl;
+      else
+        cerr << _("Error creating the solver test case.") << endl;
+    }
     // commit
     // returns ZYPPER_EXIT_OK, ZYPPER_EXIT_ERR_ZYPP,
     // ZYPPER_EXIT_INF_REBOOT_NEEDED, or ZYPPER_EXIT_INF_RESTART_NEEDED
-    return solve_and_commit(best_effort);
+    else
+      return solve_and_commit(best_effort);
+
+    return ZYPPER_EXIT_OK; 
   }
 
   // -----------------------------( info )------------------------------------