Author: jkupec Date: Fri Sep 12 13:34:31 2008 New Revision: 11030 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11030&view=rev Log: - --xmlout for 'products' Modified: trunk/zypper/src/info.cc trunk/zypper/src/search.cc Modified: trunk/zypper/src/info.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/info.cc?rev=11030&r1=11029&r2=11030&view=diff ============================================================================== --- trunk/zypper/src/info.cc (original) +++ trunk/zypper/src/info.cc Fri Sep 12 13:34:31 2008 @@ -335,8 +335,7 @@ if (zypper.out().type() == Out::TYPE_XML) { - Product::constPtr pp - = dynamic_pointer_cast<const Product>(pool_item.resolvable()); + Product::constPtr pp = asKind<Product>(pool_item.resolvable()); cout << asXML(*pp, pool_item.status().isInstalled()) << endl; Modified: trunk/zypper/src/search.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/search.cc?rev=11030&r1=11029&r2=11030&view=diff ============================================================================== --- trunk/zypper/src/search.cc (original) +++ trunk/zypper/src/search.cc Fri Sep 12 13:34:31 2008 @@ -461,7 +461,29 @@ cout << tbl; } -void list_products(Zypper & zypper) +static void list_products_xml(Zypper & zypper) +{ + bool installed_only = zypper.cOpts().count("installed-only"); + bool notinst_only = zypper.cOpts().count("uninstalled-only"); + + cout << "<product-list>" << endl; + ResPool::byKind_iterator + it = God->pool().byKindBegin(ResKind::product), + e = God->pool().byKindEnd(ResKind::product); + for (; it != e; ++it ) + { + if (it->status().isInstalled() && notinst_only) + continue; + else if (!it->status().isInstalled() && installed_only) + continue; + + Product::constPtr product = asKind<Product>(it->resolvable()); + cout << asXML(*product, it->status().isInstalled()) << endl; + } + cout << "</product-list>" << endl; +} + +static void list_product_table(Zypper & zypper) { MIL << "Going to list packages." << std::endl; @@ -516,6 +538,14 @@ cout << tbl; } +void list_products(Zypper & zypper) +{ + if (zypper.out().type() == Out::TYPE_XML) + list_products_xml(zypper); + else + list_product_table(zypper); +} + void list_what_provides(Zypper & zypper, const string & str) { -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org