From 720abdc63584cc0c449ad428b102bbd8a317f209 Mon Sep 17 00:00:00 2001 From: Thomas Goettlicher Date: Wed, 1 Aug 2007 09:17:05 +0000 Subject: [PATCH] - option xu only shows affect-package-manager patches when available because they have top priority - added installnotify message to xml --- src/zypper-misc.cc | 68 ++++++++++++++++++++++++++++++++++++++---------------- src/zypper-misc.h | 2 +- src/zypper.cc | 4 ++-- 3 files changed, 51 insertions(+), 23 deletions(-) diff --git a/src/zypper-misc.cc b/src/zypper-misc.cc index ca4d2cb..5a366c2 100644 --- a/src/zypper-misc.cc +++ b/src/zypper-misc.cc @@ -652,13 +652,19 @@ void show_patches() // ---------------------------------------------------------------------------- -void xml_list_patches () +bool xml_list_patches () { + // returns true if affects_pkg_manager patches are availble + + bool pkg_mgr_available = false; + + const zypp::ResPool& pool = God->pool(); ResPool::byKind_iterator it = pool.byKindBegin (), e = pool.byKindEnd (); + for (; it != e; ++it ) { ResObject::constPtr res = it->resolvable(); @@ -666,29 +672,51 @@ void xml_list_patches () { Patch::constPtr patch = asKind(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 << " " << xml_escape(patch->summary()) << " " << endl; - cout << " " << xml_escape(patch->description()) << "" << endl; - cout << " " << xml_escape(patch->licenseToConfirm()) << "" << endl; - - - if ( patch->repository() != Repository::noRepository ) + if (patch->affects_pkg_manager()) + pkg_mgr_available = true; + } + } + + + it = pool.byKindBegin (); + + for (; it != e; ++it ) + { + ResObject::constPtr res = it->resolvable(); + if ( it->status().isNeeded()) + { + Patch::constPtr patch = asKind(res); + if (pkg_mgr_available && patch->affects_pkg_manager() || + !pkg_mgr_available ) { - cout << " repository().info().baseUrlsBegin()); - cout << "\" alias=\"" << patch->repository().info().alias() << "\"/>" << endl; - } + 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 << " " << xml_escape(patch->summary()) << " " << endl; + cout << " " << xml_escape(patch->description()) << "" << endl; + cout << " " << xml_escape(patch->licenseToConfirm()) << "" << endl; + cout << " " << xml_escape(patch->insnotify()) << "" << endl; + - cout << " " << endl; + if ( patch->repository() != Repository::noRepository ) + { + cout << " repository().info().baseUrlsBegin()); + cout << "\" alias=\"" << patch->repository().info().alias() << "\"/>" << endl; + } + + cout << " " << endl; + } } } + + return pkg_mgr_available; + } diff --git a/src/zypper-misc.h b/src/zypper-misc.h index 0c783d9..27fb6a2 100644 --- a/src/zypper-misc.h +++ b/src/zypper-misc.h @@ -61,7 +61,7 @@ void establish (); bool resolve(); void dump_pool (); void show_patches(); -void xml_list_patches(); +bool xml_list_patches(); void xml_list_updates(); diff --git a/src/zypper.cc b/src/zypper.cc index 775920f..41a0ad6 100644 --- a/src/zypper.cc +++ b/src/zypper.cc @@ -1216,8 +1216,8 @@ int one_command(const ZypperCommand & command, int argc, char **argv) cout << "" << endl; cout << "" << endl; cout << "" << endl; - xml_list_patches (); - xml_list_updates (); + if (!xml_list_patches ()) // Only list updates if no + xml_list_updates (); // affects-pkg-mgr patches are available cout << "" << endl; cout << "" << endl; -- 2.7.4