Hello community,
here is the log from the commit of package libyui-ncurses-pkg for
openSUSE:Factory checked in at 2018-08-02 14:55:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libyui-ncurses-pkg (Old)
and /work/SRC/openSUSE:Factory/.libyui-ncurses-pkg.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libyui-ncurses-pkg"
Thu Aug 2 14:55:10 2018 rev:31 rq:626439 version:2.48.8
Changes:
--------
--- /work/SRC/openSUSE:Factory/libyui-ncurses-pkg/libyui-ncurses-pkg.changes
2018-07-28 12:37:01.824037178 +0200
+++
/work/SRC/openSUSE:Factory/.libyui-ncurses-pkg.new/libyui-ncurses-pkg.changes
2018-08-02 14:55:14.779985994 +0200
@@ -1,0 +2,7 @@
+Fri Jul 27 07:16:41 UTC 2018 - [email protected]
+
+- Fix for the new FSize class (avoid the 8EiB limit, bsc#991090)
+- Update the package version
+- 2.48.8
+
+-------------------------------------------------------------------
Old:
----
libyui-ncurses-pkg-2.48.7.tar.bz2
New:
----
libyui-ncurses-pkg-2.48.8.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libyui-ncurses-pkg-doc.spec ++++++
--- /var/tmp/diff_new_pack.Xw5wZR/_old 2018-08-02 14:55:15.303986870 +0200
+++ /var/tmp/diff_new_pack.Xw5wZR/_new 2018-08-02 14:55:15.307986876 +0200
@@ -17,10 +17,10 @@
%define parent libyui-ncurses-pkg
-%define so_version 8
+%define so_version 9
Name: %{parent}-doc
-Version: 2.48.7
+Version: 2.48.8
Release: 0
Source: %{parent}-%{version}.tar.bz2
++++++ libyui-ncurses-pkg.spec ++++++
--- /var/tmp/diff_new_pack.Xw5wZR/_old 2018-08-02 14:55:15.319986896 +0200
+++ /var/tmp/diff_new_pack.Xw5wZR/_new 2018-08-02 14:55:15.319986896 +0200
@@ -17,11 +17,11 @@
Name: libyui-ncurses-pkg
-Version: 2.48.7
+Version: 2.48.8
Release: 0
Source: %{name}-%{version}.tar.bz2
-%define so_version 8
+%define so_version 9
%define bin_name %{name}%{so_version}
%if 0%{?suse_version} > 1325
++++++ libyui-ncurses-pkg-2.48.7.tar.bz2 -> libyui-ncurses-pkg-2.48.8.tar.bz2
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.7/VERSION.cmake
new/libyui-ncurses-pkg-2.48.8/VERSION.cmake
--- old/libyui-ncurses-pkg-2.48.7/VERSION.cmake 2018-07-18 16:48:33.000000000
+0200
+++ new/libyui-ncurses-pkg-2.48.8/VERSION.cmake 2018-07-30 11:38:20.000000000
+0200
@@ -1,6 +1,6 @@
SET( VERSION_MAJOR "2" )
SET( VERSION_MINOR "48" )
-SET( VERSION_PATCH "7" )
+SET( VERSION_PATCH "8" )
SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
##### This is need for the libyui core, ONLY.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libyui-ncurses-pkg-2.48.7/package/libyui-ncurses-pkg-doc.spec
new/libyui-ncurses-pkg-2.48.8/package/libyui-ncurses-pkg-doc.spec
--- old/libyui-ncurses-pkg-2.48.7/package/libyui-ncurses-pkg-doc.spec
2018-07-18 16:48:33.000000000 +0200
+++ new/libyui-ncurses-pkg-2.48.8/package/libyui-ncurses-pkg-doc.spec
2018-07-30 11:38:20.000000000 +0200
@@ -16,10 +16,10 @@
#
%define parent libyui-ncurses-pkg
-%define so_version 8
+%define so_version 9
Name: %{parent}-doc
-Version: 2.48.7
+Version: 2.48.8
Release: 0
Source: %{parent}-%{version}.tar.bz2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libyui-ncurses-pkg-2.48.7/package/libyui-ncurses-pkg.changes
new/libyui-ncurses-pkg-2.48.8/package/libyui-ncurses-pkg.changes
--- old/libyui-ncurses-pkg-2.48.7/package/libyui-ncurses-pkg.changes
2018-07-18 16:48:33.000000000 +0200
+++ new/libyui-ncurses-pkg-2.48.8/package/libyui-ncurses-pkg.changes
2018-07-30 11:38:20.000000000 +0200
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Fri Jul 27 07:16:41 UTC 2018 - [email protected]
+
+- Fix for the new FSize class (avoid the 8EiB limit, bsc#991090)
+- Update the package version
+- 2.48.8
+
+-------------------------------------------------------------------
Tue Jul 3 12:07:43 UTC 2018 - [email protected]
- Fixes for file systems >8EiB (bsc#991090):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libyui-ncurses-pkg-2.48.7/package/libyui-ncurses-pkg.spec
new/libyui-ncurses-pkg-2.48.8/package/libyui-ncurses-pkg.spec
--- old/libyui-ncurses-pkg-2.48.7/package/libyui-ncurses-pkg.spec
2018-07-18 16:48:33.000000000 +0200
+++ new/libyui-ncurses-pkg-2.48.8/package/libyui-ncurses-pkg.spec
2018-07-30 11:38:20.000000000 +0200
@@ -17,11 +17,11 @@
Name: libyui-ncurses-pkg
-Version: 2.48.7
+Version: 2.48.8
Release: 0
Source: %{name}-%{version}.tar.bz2
-%define so_version 8
+%define so_version 9
%define bin_name %{name}%{so_version}
%if 0%{?suse_version} > 1325
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.7/src/NCPackageSelector.cc
new/libyui-ncurses-pkg-2.48.8/src/NCPackageSelector.cc
--- old/libyui-ncurses-pkg-2.48.7/src/NCPackageSelector.cc 2018-07-18
16:48:33.000000000 +0200
+++ new/libyui-ncurses-pkg-2.48.8/src/NCPackageSelector.cc 2018-07-30
11:38:20.000000000 +0200
@@ -1633,7 +1633,7 @@
++it )
{
if ( (*it)->candidateObj() )
- totalSize += (*it)->candidateObj()->installSize();
+ totalSize +=
zypp::ByteCount::SizeType((*it)->candidateObj()->installSize());
}
// show the download size
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.7/src/NCPkgPopupDiskspace.cc
new/libyui-ncurses-pkg-2.48.8/src/NCPkgPopupDiskspace.cc
--- old/libyui-ncurses-pkg-2.48.7/src/NCPkgPopupDiskspace.cc 2018-07-18
16:48:33.000000000 +0200
+++ new/libyui-ncurses-pkg-2.48.8/src/NCPkgPopupDiskspace.cc 2018-07-30
11:38:20.000000000 +0200
@@ -62,6 +62,9 @@
// zypp::str::form()
#include <zypp/base/String.h>
+// arbitrary precision integer
+#include <boost/multiprecision/cpp_int.hpp>
+
// set values as set in YQPkgDiskUsageList.cc
#define MIN_FREE_MB_WARN 400
#define MIN_FREE_MB_PROXIMITY 700
@@ -78,6 +81,81 @@
Textdomain "ncurses-pkg"
*/
+namespace
+{
+ /**
+ * Local helper method, obtain the current disk usage. Initializes the
libzypp
+ * disk usage with the current values from the system if needed.
+ * @return Libzypp disk usage
+ */
+ ZyppDuSet get_du()
+ {
+ ZyppDuSet diskUsage = zypp::getZYpp()->diskUsage();
+
+ if ( diskUsage.empty() )
+ {
+ zypp::getZYpp()->setPartitions(
zypp::DiskUsageCounter::detectMountPoints() );
+ diskUsage = zypp::getZYpp()->diskUsage();
+ }
+
+ return diskUsage;
+ }
+
+ /**
+ * Compute used percent for the used and the total size.
+ * @param used the used size
+ * @param total the total size
+ * @return used percent (returns zero when 'total' is zero to avoid
+ * division by zero)
+ */
+ int usedPercentInt(const FSize &used, const FSize &total)
+ {
+ int percent = 0;
+
+ if ( total != 0 )
+ percent = int(( 100 * used ) / total);
+
+ return percent;
+ }
+
+ /**
+ * Compute the dialog width, try to make all fields visible. Make it
+ * dependant on the longest mount point path.
+ * @return width
+ */
+ int dialogWidth()
+ {
+ int width = 0;
+ for (const ZyppPartitionDu &du: get_du())
+ {
+ if( int(du.dir.length()) > width )
+ width = du.dir.length();
+ }
+ yuiDebug() << "The longest mount point path: " << width << "
characters" << endl;
+
+ // add the width of the other columns + small extra space
+ // (e.g. buffer for longer translations)
+ width += 50;
+
+ // cannot be wider than the screen, keep some minimal space around the
popup
+ if (width > NCurses::cols() - 6)
+ width = NCurses::cols() - 6;
+
+ yuiDebug() << "Dialog width: " << width << endl;
+
+ return width;
+ }
+
+ /**
+ * Compute the dialog X position on the screen.
+ * @return X position
+ */
+ int dialogXpos()
+ {
+ return (NCurses::cols() - dialogWidth()) / 2;
+ }
+}
+
///////////////////////////////////////////////////////////////////
//
//
@@ -111,42 +189,6 @@
{
}
-namespace {
- std::string formatSize(double size, int width = 0)
- {
- // FSize::bestUnit does not work for huge numbers so only use it for
small ones
- FSize::Unit unit = (size >= FSize::TB) ? FSize::T :
FSize(size).bestUnit();
- int prec = unit == FSize::B ? 0 : 2;
-
- return zypp::str::form( "%*.*f %s", width, prec, size /
FSize::factor(unit), FSize::unit(unit));
- }
-
- /**
- * Compute percent usage
- * @param used used size (any unit, but the same as the "total")
- * @param total total size (any unit, but the same as the "used")
- * @return percent, might be more than 100 if the size of the
selected
- * packages is bigger than the available free size
- */
- int usedPercentInt(long long used, long long total)
- {
- int percent = 0;
-
- if ( total != 0 )
- // temporarily use double to avoid overflow
- percent = ( 100.0 * used ) / total;
-
- return percent;
- }
-
- // see usedPercentInt()
- std::string usedPercentStr(long long used, long long total)
- {
- int percent = usedPercentInt(used, total);
- return zypp::str::form( "%2d%%", percent );
- }
-}
-
///////////////////////////////////////////////////////////////////
//
//
@@ -160,30 +202,21 @@
NCTable * partitions = popupWin->Partitions();
partitions->deleteAllItems(); // clear table
- zypp::ZYpp::Ptr z = zypp::getZYpp();
- ZyppDuSet du = z->diskUsage ();
-
- if (du.empty())
- {
- // retry after detecting from the target
- z->setPartitions(zypp::DiskUsageCounter::detectMountPoints ());
- du = z->diskUsage();
- }
-
+ ZyppDuSet du = get_du();
for (const ZyppPartitionDu &item: du)
{
- if (item.readonly)
- continue;
+ if (item.readonly)
+ continue;
- double pkg_used = double(item.pkg_size) * FSize::KB;
- double pkg_available = double(item.total_size - item.pkg_size) *
FSize::KB;
- double total = double(item.total_size) * FSize::KB;
-
- YTableItem * newItem = new YTableItem( item.dir,
- formatSize(pkg_used, 8),
- formatSize(pkg_available, 8),
- formatSize(total, 8),
- usedPercentStr( item.pkg_size,
item.total_size ) );
+ FSize pkg_used (item.pkg_size, FSize::Unit::K);
+ FSize pkg_available ((item.total_size - item.pkg_size), FSize::Unit::K);
+ FSize total (item.total_size, FSize::Unit::K);
+
+ YTableItem *newItem = new YTableItem( item.dir,
+ pkg_used.form(8),
+ pkg_available.form(8),
+ total.form(8),
+ usedPercent( pkg_used, total ) );
partitions->addItem( newItem );
}
@@ -200,39 +233,30 @@
//
std::string NCPkgDiskspace::checkDiskSpace()
{
- std::string text;
-
- zypp::ZYpp::Ptr z = zypp::getZYpp();
- ZyppDuSet du = z->diskUsage ();
+ ZyppDuSet diskUsage = get_du();
- if (du.empty())
+ std::string text = "";
+ for (const ZyppPartitionDu &du: diskUsage)
{
- // retry after detecting from the target
- z->setPartitions(zypp::DiskUsageCounter::detectMountPoints ());
- du = z->diskUsage();
- }
+ if (du.readonly)
+ continue;
- for (const ZyppPartitionDu &item: du)
- {
- if (item.readonly)
- continue;
-
- // available size (in KiB!)
- long long pkg_available = item.total_size - item.pkg_size;
- if ( pkg_available < 0 )
- {
- text += "\"";
- text += item.dir;
- text += "\"";
- text += " ";
- text += NCPkgStrings::MoreText();
- text += " ";
- // make positive, use double to avoid overflow
- text += formatSize(-1.0 * double(pkg_available) * FSize::KB);
- text += " ";
- text += NCPkgStrings::MoreSpaceText();
- text += "<br>";
- }
+ FSize pkg_available(du.total_size - du.pkg_size, FSize::Unit::K);
+ if ( pkg_available < 0 )
+ {
+ // make it positive
+ pkg_available *= -1;
+ text += "\"";
+ text += du.dir;
+ text += "\"";
+ text += " ";
+ text += NCPkgStrings::MoreText();
+ text += " ";
+ text += pkg_available.asString();
+ text += " ";
+ text += NCPkgStrings::MoreSpaceText();
+ text += "<br>";
+ }
}
return text;
}
@@ -251,14 +275,16 @@
if ( partition.readonly )
return;
- int percent = usedPercentInt(partition.pkg_size, partition.total_size);
+ FSize usedSize ( partition.pkg_size, FSize::Unit::K );
+ FSize totalSize ( partition.total_size, FSize::Unit::K );
+
+ int percent = usedPercentInt(usedSize, totalSize);
- // free in MiB - libzyp sizes are already in KiB, divide by 1024 to get MiB
- long long free = (partition.total_size - partition.pkg_size) / 1024;
+ // free size in MiB
+ boost::multiprecision::cpp_int free = ( totalSize - usedSize
).in_unit(FSize::Unit::M);
- yuiMilestone() << "Partition: " << partition.dir << " Total (MiB): "
- << partition.total_size / 1024 << " Used (MiB): " <<
partition.pkg_size / 1024
- << " Used percent: " << percent << "% Free (MiB): " << free << endl;
+ yuiMilestone() << "Partition: " << partition.dir << " Used percent: "
+ << percent << " Free: " << free << endl;
if ( percent > MIN_PERCENT_WARN )
{
@@ -308,7 +334,9 @@
// set diskspace values in ZyppDuSet testDiskSpace
for ( const ZyppPartitionDu &partitionDu: testDiskUsage )
{
- int percent = usedPercentInt(partitionDu.pkg_size, partitionDu.total_size);
+ FSize usedSize ( partitionDu.pkg_size, FSize::Unit::K );
+ FSize totalSize ( partitionDu.total_size, FSize::Unit::K );
+ int percent = usedPercentInt(usedSize, totalSize);
if ( ch == '+' )
percent += 3;
@@ -318,11 +346,12 @@
if ( percent < 0 )
percent = 0;
- partitionDu.pkg_size = partitionDu.total_size / 100 * percent;
+ partitionDu.pkg_size = partitionDu.total_size / 100 * percent;
- // libzyp sizes are already in KiB, divide by 1024 to get MiB
- yuiMilestone() << "Used size (MiB): " << partitionDu.pkg_size / 1024 <<
endl;
- yuiMilestone() << "Total size (MiB): " << partitionDu.total_size / 1024
<< endl;
+ FSize newSize ( partitionDu.pkg_size, FSize::Unit::K );
+
+ yuiMilestone() << "Used size (MiB): " <<
newSize.in_unit(FSize::Unit::M) << endl;
+ yuiMilestone() << "Total size (MiB): " <<
totalSize.in_unit(FSize::Unit::M) << endl;
}
}
@@ -346,14 +375,12 @@
else
diskUsage = zypp::getZYpp()->diskUsage();
- for ( ZyppDuSetIterator it = diskUsage.begin();
- it != diskUsage.end();
- ++it )
+ for (const ZyppPartitionDu &du: diskUsage)
{
//Exclude readonly dirs from the check (#384368)
- if( it->readonly )
+ if( du.readonly )
continue;
- checkRemainingDiskSpace( *it );
+ checkRemainingDiskSpace( du );
}
// see YQPkgDiskUsageList::postPendingWarnings()
@@ -388,20 +415,13 @@
}
}
-// FIXME: do not use this, contains overflow bug, use usedPercentStr() instead!
-std::string NCPkgDiskspace::usedPercent( FSize used, FSize total )
+std::string NCPkgDiskspace::usedPercent( const FSize &used, const FSize &total
)
{
- int percent = 0;
- char percentStr[10];
-
- if ( total != 0 )
- percent = ( 100 * used ) / total;
-
- sprintf( percentStr, "%d%%", percent );
-
- return percentStr;
+ int percent = usedPercentInt(used, total);
+ return zypp::str::form( "%2d%%", percent );
}
+
///////////////////////////////////////////////////////////////////
//
//
@@ -413,30 +433,21 @@
void NCPkgDiskspace::showInfoPopup( std::string headline )
{
- popupWin = new NCPkgPopupDiskspace (wpos( (NCurses::lines() - 15)/2,
NCurses::cols()/6 ), headline );
+ popupWin = new NCPkgPopupDiskspace (wpos( (NCurses::lines() - 15)/2,
dialogXpos() ), headline );
// update values in partition table
fillPartitionTable();
popupWin->doit();
YDialog::deleteTopmostDialog();
}
-zypp::ByteCount NCPkgDiskspace::calculateDiff()
+FSize NCPkgDiskspace::calculateDiff()
{
- zypp::ZYpp::Ptr z = zypp::getZYpp();
- ZyppDuSet du = z->diskUsage ();
+ ZyppDuSet diskUsage = get_du();
- if (du.empty())
- {
- // retry after detecting from the target
- z->setPartitions(zypp::DiskUsageCounter::detectMountPoints ());
- du = z->diskUsage();
- }
-
- zypp::ByteCount diff = 0;
- for (const ZyppPartitionDu &item: du)
+ FSize diff = 0;
+ for (const ZyppPartitionDu &du: diskUsage)
{
- // the diff should be normally very small, the "long long" limit
should be never reached (TM)
- diff += (item.pkg_size - item.used_size) * 1024;
+ diff += FSize(du.pkg_size - du.used_size, FSize::Unit::K);
}
return diff;
@@ -508,7 +519,7 @@
//
int NCPkgPopupDiskspace::preferredWidth()
{
- return NCurses::cols()*2/3;
+ return dialogWidth();
}
///////////////////////////////////////////////////////////////////
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.7/src/NCPkgPopupDiskspace.h
new/libyui-ncurses-pkg-2.48.8/src/NCPkgPopupDiskspace.h
--- old/libyui-ncurses-pkg-2.48.7/src/NCPkgPopupDiskspace.h 2018-07-18
16:48:33.000000000 +0200
+++ new/libyui-ncurses-pkg-2.48.8/src/NCPkgPopupDiskspace.h 2018-07-30
11:38:20.000000000 +0200
@@ -204,8 +204,7 @@
NCPkgPopupDiskspace *popupWin;
ZyppDuSet testDiskUsage;
- // FIXME: not used anymore, might overflow
- std::string usedPercent( FSize used, FSize total );
+ std::string usedPercent( const FSize &used, const FSize &total );
/**
* Warning range notifier about running out of disk space warning.
@@ -237,7 +236,7 @@
void checkRemainingDiskSpace( const ZyppPartitionDu & partition );
- zypp::ByteCount calculateDiff();
+ FSize calculateDiff();
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.7/src/NCPkgTable.cc
new/libyui-ncurses-pkg-2.48.8/src/NCPkgTable.cc
--- old/libyui-ncurses-pkg-2.48.7/src/NCPkgTable.cc 2018-07-18
16:48:33.000000000 +0200
+++ new/libyui-ncurses-pkg-2.48.8/src/NCPkgTable.cc 2018-07-30
11:38:20.000000000 +0200
@@ -592,8 +592,8 @@
status = slbPtr->status(); // the package status
yuiMilestone() << "Status of " << slbPtr->name() << ": " << status
<< endl;
- zypp::ByteCount size = pkgPtr->installSize(); // installed
size
- pkgLine.push_back( size.asString( 8 ) ); // format size
+ FSize size(zypp::ByteCount::SizeType(pkgPtr->installSize())); //
installed size
+ pkgLine.push_back( size.form( 8 ) ); // format size
break;
}
@@ -623,8 +623,8 @@
++it;
}
- zypp::ByteCount size = pkgPtr->installSize(); // installed
size
- pkgLine.push_back( size.asString( 8 ) ); // format size
+ FSize size(zypp::ByteCount::SizeType(pkgPtr->installSize())); //
installed size
+ pkgLine.push_back( size.form( 8 ) ); // format size
pkgLine.push_back( pkgPtr->arch().asString()); // architecture
break;
@@ -639,8 +639,8 @@
status = slbPtr->pickStatus( itemPtr );
yuiMilestone() << "Multi version: status of " << version << ": "
<< status << endl;
- zypp::ByteCount size = pkgPtr->installSize(); // installed
size
- pkgLine.push_back( size.asString( 8 ) ); // format size
+ FSize size(zypp::ByteCount::SizeType(pkgPtr->installSize()));
// installed size
+ pkgLine.push_back( size.form( 8 ) ); // format size
pkgLine.push_back( pkgPtr->arch().asString()); // architecture
break;
}
@@ -670,8 +670,8 @@
status = slbPtr->status(); // the package status
- zypp::ByteCount size = pkgPtr->installSize(); // installed size
- pkgLine.push_back( size.asString( 8 ) ); // format size
+ FSize size(zypp::ByteCount::SizeType(pkgPtr->installSize())); //
installed size
+ pkgLine.push_back( size.form( 8 ) ); // format size
// Selectable does not have source_install
#ifdef FIXME