add option --reboot-not-interact (bnc#665853)
authorDominik Heidler <dheidler@suse.de>
Tue, 24 May 2011 12:56:10 +0000 (14:56 +0200)
committerDominik Heidler <dheidler@suse.de>
Tue, 24 May 2011 12:56:10 +0000 (14:56 +0200)
allow installation of paches wich require a reboot non-interactively

src/SolverRequester.cc
src/Zypper.cc
src/Zypper.h
src/info.cc
src/update.cc
zypper.spec.cmake

index 3479e4e..8f219ee 100644 (file)
@@ -25,6 +25,8 @@
 
 #include "SolverRequester.h"
 
+#include "Zypper.h"
+
 // libzypp logger settings
 #undef  ZYPP_BASE_LOGGER_LOGGROUP
 #define ZYPP_BASE_LOGGER_LOGGROUP "zypper:req"
@@ -398,7 +400,7 @@ bool SolverRequester::installPatch(
     if (ignore_pkgmgmt || patch->restartSuggested())
     {
       // bnc #221476
-      if (_opts.skip_interactive && patch->interactive())
+      if (_opts.skip_interactive && patch->interactive(Zypper::instance()->globalOpts().reboot_req_non_interactive))
       {
         addFeedback(Feedback::PATCH_INTERACTIVE_SKIPPED, patchspec, selected);
         return false;
index 11ca86a..248ce14 100644 (file)
@@ -164,6 +164,8 @@ void print_main_help(Zypper & zypper)
     "\t--rug-compatible, -r\tTurn on rug compatibility.\n"
     "\t--non-interactive, -n\tDo not ask anything, use default answers\n"
     "\t\t\t\tautomatically.\n"
+    "\t--reboot-not-interact\tDo not treat patches as interactive, which have\n"
+    "\t\t\t\tthe rebootSuggested-flag set.\n"
     "\t--xmlout, -x\t\tSwitch to XML output.\n"
   );
 
@@ -332,6 +334,7 @@ void Zypper::processGlobalOptions()
     {"table-style",                required_argument, 0, 's'},
     {"rug-compatible",             no_argument,       0, 'r'},
     {"non-interactive",            no_argument,       0, 'n'},
+    {"reboot-not-interact",        no_argument,       0, '0'},
     {"no-gpg-checks",              no_argument,       0,  0 },
     {"gpg-auto-import-keys",       no_argument,       0,  0 },
     {"root",                       required_argument, 0, 'R'},
@@ -469,6 +472,12 @@ void Zypper::processGlobalOptions()
     MIL << "Entering non-interactive mode" << endl;
   }
 
+  if (gopts.count("reboot-not-interact")) {
+    _gopts.reboot_req_non_interactive = true;
+    out().info(_("Patches having the flag rebootSuggested set will not be treated as interactive."), Out::HIGH);
+    MIL << "Patches having the flag rebootSuggested set will not be treated as interactive" << endl;
+  }
+
   if (gopts.count("no-gpg-checks")) {
     _gopts.no_gpg_checks = true;
     out().info(_("Entering 'no-gpg-checks' mode."), Out::HIGH);
index 3737d07..96cb63f 100644 (file)
@@ -44,6 +44,7 @@ struct GlobalOptions
   disable_system_resolvables(false),
   is_rug_compatible(false),
   non_interactive(false),
+  reboot_req_non_interactive(false),
   no_gpg_checks(false),
   gpg_auto_import_keys(false),
   machine_readable(false),
@@ -73,6 +74,7 @@ struct GlobalOptions
   bool disable_system_resolvables;
   bool is_rug_compatible;
   bool non_interactive;
+  bool reboot_req_non_interactive;
   bool no_gpg_checks;
   bool gpg_auto_import_keys;
   bool machine_readable;
index 7166bc4..dbed35b 100644 (file)
@@ -267,7 +267,7 @@ void printPatchInfo(Zypper & zypper, const ui::Selectable & s )
     cout << _("Restart Required: ");
   cout << (patch->restartSuggested() ? _("Yes") : _("No")) << endl;
 
-  cout << _("Interactive: ") << (patch->interactive() ? _("Yes") : _("No")) << endl;
+  cout << _("Interactive: ") << (patch->interactive(zypper.globalOpts().reboot_req_non_interactive) ? _("Yes") : _("No")) << endl;
 
   printSummaryDesc(pool_item.resolvable());
 
index 0b87892..2c87feb 100755 (executable)
@@ -138,7 +138,7 @@ static bool xml_list_patches (Zypper & zypper)
         cout << "category=\"" <<  patch->category() << "\" ";
         cout << "pkgmanager=\"" << (patch->restartSuggested() ? "true" : "false") << "\" ";
         cout << "restart=\"" << (patch->rebootSuggested() ? "true" : "false") << "\" ";
-        cout << "interactive=\"" << (patch->interactive() ? "true" : "false") << "\" ";
+        cout << "interactive=\"" << (patch->interactive(zypper.globalOpts().reboot_req_non_interactive) ? "true" : "false") << "\" ";
         cout << "kind=\"patch\"";
         cout << ">" << endl;
         cout << "  <summary>" << xml_encode(patch->summary()) << "  </summary>" << endl;
index d848f2f..bc6b606 100644 (file)
@@ -11,7 +11,7 @@
 # norootforbuild
 
 Name:           @PACKAGE@
-BuildRequires:  libzypp-devel >= 8.12.0
+BuildRequires:  libzypp-devel >= 9.2.0
 BuildRequires:  boost-devel >= 1.33.1
 BuildRequires:  gettext-devel >= 0.15
 BuildRequires:  readline-devel >= 5.1