From: Dominik Heidler Date: Tue, 24 May 2011 12:56:10 +0000 (+0200) Subject: add option --reboot-not-interact (bnc#665853) X-Git-Tag: 1.6.6~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a68cb07f2eac295dc19d0a7fa3f1b9476e233b4b;p=platform%2Fupstream%2Fzypper.git add option --reboot-not-interact (bnc#665853) allow installation of paches wich require a reboot non-interactively --- diff --git a/src/SolverRequester.cc b/src/SolverRequester.cc index 3479e4e..8f219ee 100644 --- a/src/SolverRequester.cc +++ b/src/SolverRequester.cc @@ -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; diff --git a/src/Zypper.cc b/src/Zypper.cc index 11ca86a..248ce14 100644 --- a/src/Zypper.cc +++ b/src/Zypper.cc @@ -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); diff --git a/src/Zypper.h b/src/Zypper.h index 3737d07..96cb63f 100644 --- a/src/Zypper.h +++ b/src/Zypper.h @@ -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; diff --git a/src/info.cc b/src/info.cc index 7166bc4..dbed35b 100644 --- a/src/info.cc +++ b/src/info.cc @@ -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()); diff --git a/src/update.cc b/src/update.cc index 0b87892..2c87feb 100755 --- a/src/update.cc +++ b/src/update.cc @@ -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 << " " << xml_encode(patch->summary()) << " " << endl; diff --git a/zypper.spec.cmake b/zypper.spec.cmake index d848f2f..bc6b606 100644 --- a/zypper.spec.cmake +++ b/zypper.spec.cmake @@ -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