[packagekit] [PATCH 1/6] Transfer the size of patch for get-details
Zhang Qiang
qiang.z.zhang at intel.com
Tue Sep 7 01:55:54 PDT 2010
Transfer the patch size for get-detail operations, and the patch
size is the sum of all collections for that patch.
Related MeeGo bug: http://bugs.meego.com/show_bug.cgi?id=2281
---
backends/zypp/pk-backend-zypp.cpp | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 4d94fd1..7f9550c 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -497,7 +497,24 @@ backend_get_details_thread (PkBackend *backend)
rpmHeader->tag_url (). c_str (), // const gchar *url
(gulong)rpmHeader->tag_archivesize ()); // gulong size
- } else {
+ } else if (zypp::isKind<zypp::Patch>(package)) {
+ gulong size = 0;
+ zypp::PoolItem item = zypp::ResPool::instance ().find (package);
+ zypp::Patch::constPtr patch = zypp::asKind<zypp::Patch>(item);
+
+ zypp::sat::SolvableSet content = patch->contents ();
+ for (zypp::sat::SolvableSet::const_iterator it = content.begin (); it != content.end (); it++){
+ size += it->lookupNumAttribute (zypp::sat::SolvAttr::downloadsize);
+ }
+
+ pk_backend_details (backend,
+ package_ids[i],
+ "TODO", //No special license for patch
+ group,
+ package.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str (),
+ "TODO", //No url for patch
+ size * 1024);
+ } else {
pk_backend_details (backend,
package_ids[i],
package.lookupStrAttribute (zypp::sat::SolvAttr::license).c_str (), //pkg->license ().c_str (),
--
1.7.1.1
More information about the PackageKit
mailing list