zypper patch --with-interactive added (bnc #497711)
authorJán Kupec <jkupec@suse.cz>
Fri, 3 Jul 2009 07:52:14 +0000 (09:52 +0200)
committerJán Kupec <jkupec@suse.cz>
Tue, 10 Nov 2009 14:34:45 +0000 (15:34 +0100)
src/Zypper.cc
src/update.cc

index 51b8ec5..f32bc8a 100644 (file)
@@ -1570,6 +1570,7 @@ void Zypper::processCommandOptions()
     static struct option update_options[] = {
       {"repo",                      required_argument, 0, 'r'},
       {"skip-interactive",          no_argument,       0,  0 },
+      {"with-interactive",          no_argument,       0,  0 },
       {"auto-agree-with-licenses",  no_argument,       0, 'l'},
       {"debug-solver",              no_argument,       0,  0 },
       {"no-recommends",             no_argument,       0,  0 },
@@ -1604,7 +1605,10 @@ void Zypper::processCommandOptions()
       "-r, --repo <alias|#|URI>    Load only the specified repository.\n"
       "-D, --dry-run               Test the update, do not actually update.\n"
       "-d, --download-only         Only download the packages, do not install.\n"
-    );
+    //! \todo merge this with the above string for 11.3
+    ) + string(_(
+      "    --with-interactive      Do not skip interactive patches.\n"
+    ));
     break;
   }
 
@@ -3712,6 +3716,22 @@ void Zypper::doCommand()
     if (copts.count("no-confirm"))
       _gopts.non_interactive = true;
 
+    bool skip_interactive = false;
+    if (copts.count("skip-interactive"))
+    {
+      if (copts.count("with-interactive"))
+      {
+        out().error(str::form(_("%s contradicts %s"), "--with-interactive", "--skip-interactive"));
+        setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS);
+        return;
+      }
+      skip_interactive = true;
+    }
+    // bnc #497711
+    else if (globalOpts().non_interactive && !copts.count("with-interactive"))
+      skip_interactive = true;
+    MIL << "Skipping interactive patches: " << (skip_interactive ? "yes" : "no") << endl;
+
     ResKindSet kinds;
     if (copts.count("type"))
     {
@@ -3758,8 +3778,6 @@ void Zypper::doCommand()
     load_resolvables(*this);
     resolve(*this); // needed to compute status of PPP
 
-    bool skip_interactive =
-      copts.count("skip-interactive") || globalOpts().non_interactive;
 
     if (copts.count("bugzilla") || copts.count("bz") || copts.count("cve"))
       mark_updates_by_issue(*this);
index 2cb6201..7e84c9c 100755 (executable)
@@ -596,7 +596,8 @@ mark_patch_update(ui::Selectable & s,
           && (patch->interactive() || !patch->licenseToConfirm().empty()))
       {
         // Skipping a patch because it is marked as interactive or has
-        // license to confirm and --skip-interactive is requested.
+        // license to confirm and --skip-interactive is requested
+        // (i.e. also --non-interactive, since it implies --skip-interactive)
         Zypper::instance()->out().warning(str::form(
           // translators: %s is the name of a patch
           _("'%s' is interactive, skipping."),