Author: mlandres Date: Mon Sep 17 15:54:23 2007 New Revision: 7266 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7266&view=rev Log: Improve estimated diskusage while there is no valid solver result. Modified: trunk/libzypp/VERSION.cmake trunk/libzypp/package/libzypp.changes trunk/libzypp/zypp/DiskUsageCounter.cc Modified: trunk/libzypp/VERSION.cmake URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/VERSION.cmake?rev=7266&r1=7265&r2=7266&view=diff ============================================================================== --- trunk/libzypp/VERSION.cmake (original) +++ trunk/libzypp/VERSION.cmake Mon Sep 17 15:54:23 2007 @@ -47,4 +47,4 @@ SET(LIBZYPP_MAJOR "3") SET(LIBZYPP_MINOR "24") SET(LIBZYPP_COMPATMINOR "24") -SET(LIBZYPP_PATCH "0") +SET(LIBZYPP_PATCH "1") Modified: trunk/libzypp/package/libzypp.changes URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=7266&r1=7265&r2=7266&view=diff ============================================================================== --- trunk/libzypp/package/libzypp.changes (original) +++ trunk/libzypp/package/libzypp.changes Mon Sep 17 15:54:23 2007 @@ -1,9 +1,16 @@ ------------------------------------------------------------------- +Mon Sep 17 15:51:04 CEST 2007 - ma@suse.de + +- Improve estimated diskusage while there is no valid + solver result. (#325617) +- version 3.24.1 + +------------------------------------------------------------------- Mon Sep 17 15:22:47 CEST 2007 - schubi@suse.de -Bugfix in vendor change of a required resolvable (Correct error message) Bug 310455 -- r 7262 +- r 7262 ------------------------------------------------------------------- Mon Sep 17 12:36:28 CEST 2007 - lslezak@suse.cz Modified: trunk/libzypp/zypp/DiskUsageCounter.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/DiskUsageCounter.cc?rev=7266&r1=7265&r2=7266&view=diff ============================================================================== --- trunk/libzypp/zypp/DiskUsageCounter.cc (original) +++ trunk/libzypp/zypp/DiskUsageCounter.cc Mon Sep 17 15:54:23 2007 @@ -30,7 +30,43 @@ namespace zypp { ///////////////////////////////////////////////////////////////// - DiskUsageCounter::MountPointSet DiskUsageCounter::disk_usage( const ResPool & pool_r ) + /////////////////////////////////////////////////////////////////// + namespace + { ///////////////////////////////////////////////////////////////// + + inline void addDu( DiskUsageCounter::MountPointSet & result_r, DiskUsage & du_r ) + { + // traverse mountpoints in reverse order. This is done beacuse + // DiskUsage::extract computes the mountpoint size, and then + // removes the entry. So we must process leaves first. + for_( mpit, result_r.rbegin(), result_r.rend() ) + { + // Extract usage for the mount point + DiskUsage::Entry entry = du_r.extract( mpit->dir ); + // Adjust the data. + mpit->pkg_size += entry._size; + } + } + + inline void delDu( DiskUsageCounter::MountPointSet & result_r, DiskUsage & du_r ) + { + // traverse mountpoints in reverse order. This is done beacuse + // DiskUsage::extract computes the mountpoint size, and then + // removes the entry. So we must process leaves first. + for_( mpit, result_r.rbegin(), result_r.rend() ) + { + // Extract usage for the mount point + DiskUsage::Entry entry = du_r.extract( mpit->dir ); + // Adjust the data. + mpit->pkg_size -= entry._size; + } + } + + ///////////////////////////////////////////////////////////////// + } // namespace + /////////////////////////////////////////////////////////////////// + + DiskUsageCounter::MountPointSet DiskUsageCounter::disk_usage( const ResPool & pool_r ) { DiskUsageCounter::MountPointSet result = mps; @@ -59,24 +95,37 @@ if ( ! it->status().transacts() ) continue; - // traverse mountpoints in reverse order. This is done beacuse - // DiskUsage::extract computes the mountpoint size, and then - // removes the entry. So we must process leaves first. - for_( mpit, result.rbegin(), result.rend() ) + // Adjust the data. + if ( it->status().isUninstalled() ) { - // Extract usage for the mount point - DiskUsage::Entry entry = du.extract( mpit->dir ); + // an uninstalled item gets installed: + addDu( result, du ); - // Adjust the data. - if ( it->status().isInstalled() ) + // While there is no valid solver result, items to update + // are selected, but installed old versions are not yet + // deselected. We try to compensate this: + if ( ! (*it)->installOnly() ) { - mpit->pkg_size -= entry._size; - } - else - { - mpit->pkg_size += entry._size; + // Item to update -> check the installed ones. + for_( nit, pool_r.byNameBegin((*it)->name()), pool_r.byNameEnd((*it)->name()) ) + { // same name + if ( (*nit)->kind() == (*it)->kind() // same kind + && nit->status().staysInstalled() ) // and unselected installed + { + DiskUsage ndu( (*nit)->diskusage() ); + if ( ! ndu.empty() ) + { + delDu( result, ndu ); + } + } + } } } + else + { + // an installed item gets deleted: + delDu( result, du ); + } } return result; } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org