added xml output for some messages
authorThomas Goettlicher <tgoettlicher@suse.de>
Fri, 3 Aug 2007 08:21:07 +0000 (08:21 +0000)
committerThomas Goettlicher <tgoettlicher@suse.de>
Fri, 3 Aug 2007 08:21:07 +0000 (08:21 +0000)
src/zypper-misc.cc
src/zypper.cc

index 7793001..3ae174c 100644 (file)
@@ -1146,12 +1146,25 @@ int solve_and_commit () {
   if (retv < 0)
     retv = ZYPPER_EXIT_OK;
   else if (retv == ZYPPER_EXIT_INF_REBOOT_NEEDED)
-    cout << _("WARNING: One of installed patches requires reboot of"
-      " your machine. Please, do it as soon as possible.") << endl;
+       {
+               if (gSettings.machine_readable)
+           cout << "<message type=\"warning\" text=\"" << _("One of installed patches requires reboot of"
+             " your machine. Please, do it as soon as possible.") << "\">" << endl;
+               else
+           cout << _("WARNING: One of installed patches requires reboot of"
+             " your machine. Please, do it as soon as possible.") << endl;
+       }
   else if (retv == ZYPPER_EXIT_INF_RESTART_NEEDED)
-    cout << _("WARNING: One of installed patches affects the package"
+       {
+               if (gSettings.machine_readable)
+           cout <<  "<message type=\"warning\" text=\"" << _("One of installed patches affects the package"
+      " manager itself, thus it requires restart before executing"
+      " next operations.") << "\">" << endl;
+               else    
+                       cout << _("WARNING: One of installed patches affects the package"
       " manager itself, thus it requires restart before executing"
       " next operations.") << endl;
+       }
 
   return retv;
 }
index 3ec6081..59d8bb8 100644 (file)
@@ -699,10 +699,18 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
   catch (Exception & excpt_r) {
     ZYPP_CAUGHT (excpt_r);
     ERR  << "A ZYpp transaction is already in progress." << endl;
-    cerr << _("A ZYpp transaction is already in progress."
-        "This means, there is another application using libzypp library for"
-        "package management running. All such applications must be closed before"
-        "using this command.") << endl;
+
+               if ( gSettings.machine_readable )
+    cout << "<message type=\"error\" text=\"" <<  _("A ZYpp transaction is already in progress."
+             "This means, there is another application using libzypp library for"
+           "package management running. All such applications must be closed before"
+         "using this command.") << "\">" <<  endl;
+               else
+           cerr << _("A ZYpp transaction is already in progress."
+             "This means, there is another application using libzypp library for"
+           "package management running. All such applications must be closed before"
+         "using this command.") << endl;
+
     return ZYPPER_EXIT_ERR_ZYPP;
   }