Unification and clean up of XML output
authorThomas Goettlicher <tgoettlicher@suse.de>
Tue, 21 Aug 2007 11:48:02 +0000 (11:48 +0000)
committerThomas Goettlicher <tgoettlicher@suse.de>
Tue, 21 Aug 2007 11:48:02 +0000 (11:48 +0000)
src/zypp-checkpatches-wrapper.c
src/zypper-misc.cc
src/zypper-rpm-callbacks.h
src/zypper.cc

index ad325e8..6322402 100644 (file)
@@ -30,14 +30,12 @@ int main (void) {
     /* set minimal environment... done */
     /* prevent the user from sending signals */
     if (setuid (0)) {
-       perror ("setuid");
-       fprintf (stderr, "Forgot to chmod this program?\n");
+//     perror ("setuid");
+//     fprintf (stderr, "Forgot to chmod this program?\n");
        fprintf (stdout, "<?xml version='1.0'?>\n");
-       fprintf (stdout, "<update-status version=\"0.5\">\n");
-       fprintf (stdout, " <errors>");
-       fprintf (stdout, "  <error>Unable to check for patches and updates because /usr/sbin/zypp-checkpatches-wrapper helper programm is not set SUID root.\nThis problem might be solved by setting \"File Permissons\" in YaST \"Local Security\" tab to \"easy\" or by modifying /etc/permissions.local</error>");
-       fprintf (stdout, " </errors>");
-       fprintf (stdout, " </update-status>");
+       fprintf (stdout, "<stream>\n");
+       fprintf (stdout, "<message type=\"error\">Unable to check for patches and updates because /usr/sbin/zypp-checkpatches-wrapper helper programm is not set SUID root.\nThis problem might be solved by setting \"File Permissons\" in YaST \"Local Security\" tab to \"easy\" or by modifying /etc/permissions.local</message>\n");
+       fprintf (stdout, "</stream>\n");
        return WRAPPER_ERROR;
     }
  
index b92c54f..deab5b5 100644 (file)
@@ -617,7 +617,7 @@ int show_summary()
   if (retv == -1)
   {
     if (gSettings.machine_readable)
-      cout << "<message type=\"warning\" text=\"" << _("Nothing to do.") << "\">" << endl;
+      cout << "<message type=\"warning\">" << _("Nothing to do.") << "</message>" << endl;
     else
       cout << _("Nothing to do.") << endl;
 
@@ -1408,8 +1408,8 @@ int solve_and_commit () {
   else if (retv == ZYPPER_EXIT_INF_REBOOT_NEEDED)
   {
     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;
+      cout << "<message type=\"warning\">" << _("One of installed patches requires reboot of"
+          " your machine. Please, do it as soon as possible.") << "</message>" << endl;
     else
       cout << _("WARNING: One of installed patches requires a reboot of"
           " your machine. Please do it as soon as possible.") << endl;
index d6e76af..512686b 100644 (file)
@@ -42,7 +42,7 @@ struct MessageResolvableReportReceiver : public zypp::callback::ReceiveReport<zy
       return;
     }
     
-    cout << "<message>" << message->text() << "</message>" << endl;
+    cout << "<message type=\"info\">" << message->text() << "</message>" << endl;
     
     //! \todo in interactive mode, wait for ENTER?
   }
index 19cba45..25da576 100644 (file)
@@ -733,7 +733,7 @@ int one_command(int argc, char **argv)
         " using this command.");
 
     if ( gSettings.machine_readable )
-      cout << "<message type=\"error\" text=\"" << msg  << "\">" <<  endl;
+      cout << "<message type=\"error\">" << msg  << "</message>" <<  endl;
     else
       cerr << msg << endl;
 
@@ -1294,7 +1294,7 @@ int one_command(int argc, char **argv)
     cond_load_resolvables();
     establish ();
 
-    cout << "<update-status version=\"0.4\">" << endl;
+    cout << "<update-status version=\"0.6\">" << endl;
     cout << "<update-list>" << endl;
     if (!xml_list_patches ())  // Only list updates if no
       xml_list_updates ();     // affects-pkg-mgr patches are available