Skip to content

Commit

Permalink
Merge pull request #16 from yast/disk_usage
Browse files Browse the repository at this point in the history
Disk usage fix (bnc#852943)
  • Loading branch information
lslezak committed Jan 15, 2014
2 parents 854e401 + 6265b3c commit d0da9e0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 26 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.17.58
2.17.58.1
6 changes: 6 additions & 0 deletions package/yast2-pkg-bindings.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jan 15 11:50:30 UTC 2014 - lslezak@suse.cz

- fixed package disk usage computation (bnc#852943)
- 2.17.58.1

-------------------------------------------------------------------
Thu Mar 8 08:16:23 UTC 2012 - lslezak@suse.cz

Expand Down
26 changes: 3 additions & 23 deletions src/Package.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2626,9 +2626,6 @@ YCPBoolean PkgFunctions::RpmChecksig( const YCPString & filename )
YCPValue
PkgFunctions::PkgDU(const YCPString& package)
{
// get partitioning
zypp::DiskUsageCounter::MountPointSet mps = zypp_ptr()->getPartitions();

zypp::Package::constPtr pkg = find_package(package->value());

// the package was not found
Expand All @@ -2637,26 +2634,9 @@ PkgFunctions::PkgDU(const YCPString& package)
return YCPVoid();
}

zypp::DiskUsage du = pkg->diskusage();

if (du.size() == 0)
{
y2warning("Disk usage for package %s is unknown", package->value().c_str());
return YCPVoid();
}

// iterate trough all mount points, add usage to each directory
// directory tree must be processed from leaves to the root directory
// so iterate in reverse order so e.g. /usr is used before /
for (zypp::DiskUsageCounter::MountPointSet::reverse_iterator mpit = mps.rbegin(); mpit != mps.rend(); mpit++)
{
// get usage for the mount point
zypp::DiskUsage::Entry entry = du.extract(mpit->dir);

mpit->pkg_size += entry._size;
}

return MPS2YCPMap(mps);
// get partitioning
zypp::DiskUsageCounter ducounter( zypp_ptr()->getPartitions() );
return MPS2YCPMap( ducounter.disk_usage( pkg ) );
}

// helper function - create a symbolic link to the created base product (by SourceCreateBase() function)
Expand Down
4 changes: 2 additions & 2 deletions yast2-pkg-bindings.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
@HEADER@
Group: System/YaST
BuildRequires: blocxx-devel docbook-xsl-stylesheets doxygen gcc-c++ libgcrypt-devel libxcrypt-devel libxslt perl-XML-Writer sgml-skel yast2-core-devel yast2-devtools
BuildRequires: libzypp-devel >= 9.10.0
BuildRequires: libzypp-devel >= 9.16.4

Requires: libzypp >= 6.22.0
Requires: libzypp >= 9.16.4

Summary: YaST2 - Package Manager Access

Expand Down

0 comments on commit d0da9e0

Please sign in to comment.