Author: dmacvicar Date: Tue Aug 21 10:50:38 2007 New Revision: 6773 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6773&view=rev Log: - If no mount information is available, then parse all DU entries Modified: trunk/libzypp/zypp/parser/susetags/PackagesDuFileReader.cc Modified: trunk/libzypp/zypp/parser/susetags/PackagesDuFileReader.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/PackagesDuFileReader.cc?rev=6773&r1=6772&r2=6773&view=diff ============================================================================== --- trunk/libzypp/zypp/parser/susetags/PackagesDuFileReader.cc (original) +++ trunk/libzypp/zypp/parser/susetags/PackagesDuFileReader.cc Tue Aug 21 10:50:38 2007 @@ -46,6 +46,8 @@ , _discarded_entries(0) { _mounts = getZYpp()->getPartitions(); + + // try to detect partitions if empty if (_mounts.empty() ) _mounts = DiskUsageCounter::detectMountPoints(); @@ -147,31 +149,39 @@ str::strtonum<unsigned>(what[2]) + str::strtonum<unsigned>(what[3]), str::strtonum<unsigned>(what[4]) + str::strtonum<unsigned>(what[5]) ); - // iterate over important mounts in reverse order, from the leaves to - // the root - for ( DiskUsageCounter::MountPointSet::reverse_iterator mit = _mounts.rbegin(); - mit != _mounts.rend(); - ++ mit ) + if ( _mounts.empty() ) { - // if the directory we are adding is below one of the mount points - // just add the mount point so it gets summed. - //MIL << "is '" << entry.path << "' == '" << (*mit).dir << "' ?" << endl; - // FIXME make this more clear - if ( entry.path == ( ((*mit).dir[(*mit).dir.size()-1] == '/') ? (*mit).dir : ((*mit).dir + '/' ) ) ) - { - // entry is a mountpoint, so we need to keep it - //MIL << "yes" << endl; - // just discard it - _discarded_entries++; - skip = false; - break; - } - else + // if no mount information, parse it all + // FIXME at least detect levels? + skip = false; + } + else + { + // iterate over important mounts in reverse order, from the leaves to + // the root + for ( DiskUsageCounter::MountPointSet::reverse_iterator mit = _mounts.rbegin(); + mit != _mounts.rend(); + ++ mit ) { - //MIL << "no" << endl; + // if the directory we are adding is below one of the mount points + // just add the mount point so it gets summed. + //MIL << "is '" << entry.path << "' == '" << (*mit).dir << "' ?" << endl; + // FIXME make this more clear + if ( entry.path == ( ((*mit).dir[(*mit).dir.size()-1] == '/') ? (*mit).dir : ((*mit).dir + '/' ) ) ) + { + // entry is a mountpoint, so we need to keep it + //MIL << "yes" << endl; + // just discard it + _discarded_entries++; + skip = false; + break; + } + else + { + //MIL << "no" << endl; + } } } - // try next entry if ( skip ) continue; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org