Author: tgoettlicher
Date: Wed Jul 18 17:52:27 2007
New Revision: 6078
URL: http://svn.opensuse.org/viewcvs/zypp?rev=6078&view=rev
Log:
add "xml-updates-patches" command to zypper that creates output like zypp-checkpatches
Modified:
trunk/zypper/src/zypper-command.cc
trunk/zypper/src/zypper-command.h
trunk/zypper/src/zypper-misc.cc
trunk/zypper/src/zypper-misc.h
trunk/zypper/src/zypper.cc
Modified: trunk/zypper/src/zypper-command.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-command.cc?rev=6078&r1=6077&r2=6078&view=diff
==============================================================================
--- trunk/zypper/src/zypper-command.cc (original)
+++ trunk/zypper/src/zypper-command.cc Wed Jul 18 17:52:27 2007
@@ -32,6 +32,7 @@
const ZypperCommand ZypperCommand::LIST_UPDATES(ZypperCommand::LIST_UPDATES_e);
const ZypperCommand ZypperCommand::PATCH_CHECK(ZypperCommand::PATCH_CHECK_e);
const ZypperCommand ZypperCommand::SHOW_PATCHES(ZypperCommand::SHOW_PATCHES_e);
+const ZypperCommand ZypperCommand::XML_LIST_UPDATES_PATCHES(ZypperCommand::XML_LIST_UPDATES_PATCHES_e);
const ZypperCommand ZypperCommand::HELP(ZypperCommand::HELP_e);
const ZypperCommand ZypperCommand::SHELL(ZypperCommand::SHELL_e);
@@ -68,6 +69,7 @@
_table["list-updates"] = _table["lu"] = ZypperCommand::LIST_UPDATES_e;
_table["patch-check"] = _table["pchk"] = ZypperCommand::PATCH_CHECK_e;
_table["patches"] = _table["pch"] = ZypperCommand::SHOW_PATCHES_e;
+ _table["xml-updates-patches"] = _table["x"] = ZypperCommand::XML_LIST_UPDATES_PATCHES_e;
_table["help"] = ZypperCommand::HELP_e;
_table["shell"] = _table["sh"] = ZypperCommand::SHELL_e;
Modified: trunk/zypper/src/zypper-command.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-command.h?rev=6078&r1=6077&r2=6078&view=diff
==============================================================================
--- trunk/zypper/src/zypper-command.h (original)
+++ trunk/zypper/src/zypper-command.h Wed Jul 18 17:52:27 2007
@@ -26,6 +26,7 @@
static const ZypperCommand LIST_UPDATES;
static const ZypperCommand PATCH_CHECK;
static const ZypperCommand SHOW_PATCHES;
+ static const ZypperCommand XML_LIST_UPDATES_PATCHES;
static const ZypperCommand HELP;
static const ZypperCommand SHELL;
@@ -58,6 +59,7 @@
LIST_UPDATES_e,
PATCH_CHECK_e,
SHOW_PATCHES_e,
+ XML_LIST_UPDATES_PATCHES_e,
HELP_e,
SHELL_e,
Modified: trunk/zypper/src/zypper-misc.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-misc.cc?rev=6078&r1=6077&r2=6078&view=diff
==============================================================================
--- trunk/zypper/src/zypper-misc.cc (original)
+++ trunk/zypper/src/zypper-misc.cc Wed Jul 18 17:52:27 2007
@@ -9,6 +9,7 @@
#include
#include
#include
+#include
#include "zypper.h"
#include "zypper-misc.h"
@@ -117,6 +118,13 @@
return true;
}
+static std::string xml_escape( const std::string &text )
+{
+ iobind::parser::xml_escape_parser parser;
+ return parser.escape(text);
+}
+
+
// this does only resolvables with this _name_.
// we could also act on _provides_
@@ -565,6 +573,45 @@
// ----------------------------------------------------------------------------
+void xml_list_patches ()
+{
+ const zypp::ResPool& pool = God->pool();
+ ResPool::byKind_iterator
+ it = pool.byKindBegin<Patch> (),
+ e = pool.byKindEnd<Patch> ();
+
+ for (; it != e; ++it )
+ {
+ ResObject::constPtr res = it->resolvable();
+ if ( it->status().isNeeded() ) {
+ Patch::constPtr patch = asKind<Patch>(res);
+
+ cout << " name () << "\" " ;
+ cout << "edition=\"" << res->edition ().asString() << "\" ";
+ cout << "category=\"" << patch->category() << "\" ";
+ cout << "pkgmanager=\"" << ((patch->affects_pkg_manager()) ? "true" : "false") << "\" ";
+ cout << "restart=\"" << ((patch->reboot_needed()) ? "true" : "false") << "\" ";
+ cout << "interactive=\"" << ((patch->interactive()) ? "true" : "false") << "\" ";
+ cout << "resolvabletype=\"" << "patch" << "\" ";
+ cout << ">" << endl;
+ cout << " <summary>" << xml_escape(patch->summary()) << " </summary>" << endl;
+ cout << " <description>" << xml_escape(patch->description()) << "</description>" << endl;
+
+ if ( patch->repository() != Repository::noRepository )
+ {
+ cout << "