Hello community,
here is the log from the commit of package libyui-ncurses-pkg for
openSUSE:Factory checked in at 2018-07-28 12:36:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libyui-ncurses-pkg (Old)
and /work/SRC/openSUSE:Factory/.libyui-ncurses-pkg.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libyui-ncurses-pkg"
Sat Jul 28 12:36:59 2018 rev:30 rq:623728 version:2.48.7
Changes:
--------
--- /work/SRC/openSUSE:Factory/libyui-ncurses-pkg/libyui-ncurses-pkg.changes
2017-08-12 20:02:03.027473846 +0200
+++
/work/SRC/openSUSE:Factory/.libyui-ncurses-pkg.new/libyui-ncurses-pkg.changes
2018-07-28 12:37:01.824037178 +0200
@@ -1,0 +2,21 @@
+Tue Jul 3 12:07:43 UTC 2018 - [email protected]
+
+- Fixes for file systems >8EiB (bsc#991090):
+ - Do not display "out of disk space" error at start when such
+ a large disk is present in the system
+ - Fixed displaying negative disk sizes in the disk usage dialog
+- 2.48.7
+
+-------------------------------------------------------------------
+Fri Jun 29 12:13:46 UTC 2018 - [email protected]
+
+- Added new "Services" filter, displayed only when at least one
+ repository service is present (FATE#321043)
+
+-------------------------------------------------------------------
+Mon Jun 25 09:58:08 CEST 2018 - [email protected]
+
+- use long long instead of int for free disk space with MiB base
+- 2.48.6
+
+-------------------------------------------------------------------
Old:
----
libyui-ncurses-pkg-2.48.5.tar.bz2
New:
----
libyui-ncurses-pkg-2.48.7.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libyui-ncurses-pkg-doc.spec ++++++
--- /var/tmp/diff_new_pack.I3Qepn/_old 2018-07-28 12:37:02.328038146 +0200
+++ /var/tmp/diff_new_pack.I3Qepn/_new 2018-07-28 12:37:02.328038146 +0200
@@ -1,7 +1,7 @@
#
# spec file for package libyui-ncurses-pkg-doc
#
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -20,7 +20,7 @@
%define so_version 8
Name: %{parent}-doc
-Version: 2.48.5
+Version: 2.48.7
Release: 0
Source: %{parent}-%{version}.tar.bz2
++++++ libyui-ncurses-pkg.spec ++++++
--- /var/tmp/diff_new_pack.I3Qepn/_old 2018-07-28 12:37:02.344038177 +0200
+++ /var/tmp/diff_new_pack.I3Qepn/_new 2018-07-28 12:37:02.348038184 +0200
@@ -1,7 +1,7 @@
#
# spec file for package libyui-ncurses-pkg
#
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: libyui-ncurses-pkg
-Version: 2.48.5
+Version: 2.48.7
Release: 0
Source: %{name}-%{version}.tar.bz2
++++++ libyui-ncurses-pkg-2.48.5.tar.bz2 -> libyui-ncurses-pkg-2.48.7.tar.bz2
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.5/SOURCECONF.cmake
new/libyui-ncurses-pkg-2.48.7/SOURCECONF.cmake
--- old/libyui-ncurses-pkg-2.48.5/SOURCECONF.cmake 2017-08-07
16:02:58.000836040 +0200
+++ new/libyui-ncurses-pkg-2.48.7/SOURCECONF.cmake 2018-07-18
16:48:33.000000000 +0200
@@ -9,6 +9,7 @@
NCPkgFilterPattern.cc
NCPkgFilterRPMGroups.cc
NCPkgFilterRepo.cc
+ NCPkgFilterService.cc
NCPkgFilterSearch.cc
NCPkgMenuAction.cc
NCPkgMenuConfig.cc
@@ -41,6 +42,7 @@
NCPkgFilterPattern.h
NCPkgFilterRPMGroups.h
NCPkgFilterRepo.h
+ NCPkgFilterService.h
NCPkgFilterSearch.h
NCPkgMenuAction.h
NCPkgMenuConfig.h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.5/VERSION.cmake
new/libyui-ncurses-pkg-2.48.7/VERSION.cmake
--- old/libyui-ncurses-pkg-2.48.5/VERSION.cmake 2017-08-07 17:02:51.675828526
+0200
+++ new/libyui-ncurses-pkg-2.48.7/VERSION.cmake 2018-07-18 16:48:33.000000000
+0200
@@ -1,6 +1,6 @@
SET( VERSION_MAJOR "2" )
SET( VERSION_MINOR "48" )
-SET( VERSION_PATCH "5" )
+SET( VERSION_PATCH "7" )
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.5/package/libyui-ncurses-pkg-doc.spec
new/libyui-ncurses-pkg-2.48.7/package/libyui-ncurses-pkg-doc.spec
--- old/libyui-ncurses-pkg-2.48.5/package/libyui-ncurses-pkg-doc.spec
2017-08-07 17:02:51.675828526 +0200
+++ new/libyui-ncurses-pkg-2.48.7/package/libyui-ncurses-pkg-doc.spec
2018-07-18 16:48:33.000000000 +0200
@@ -19,7 +19,7 @@
%define so_version 8
Name: %{parent}-doc
-Version: 2.48.5
+Version: 2.48.7
Release: 0
Source: %{parent}-%{version}.tar.bz2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libyui-ncurses-pkg-2.48.5/package/libyui-ncurses-pkg.changes
new/libyui-ncurses-pkg-2.48.7/package/libyui-ncurses-pkg.changes
--- old/libyui-ncurses-pkg-2.48.5/package/libyui-ncurses-pkg.changes
2017-08-07 17:02:51.675828526 +0200
+++ new/libyui-ncurses-pkg-2.48.7/package/libyui-ncurses-pkg.changes
2018-07-18 16:48:33.000000000 +0200
@@ -1,4 +1,25 @@
-------------------------------------------------------------------
+Tue Jul 3 12:07:43 UTC 2018 - [email protected]
+
+- Fixes for file systems >8EiB (bsc#991090):
+ - Do not display "out of disk space" error at start when such
+ a large disk is present in the system
+ - Fixed displaying negative disk sizes in the disk usage dialog
+- 2.48.7
+
+-------------------------------------------------------------------
+Fri Jun 29 12:13:46 UTC 2018 - [email protected]
+
+- Added new "Services" filter, displayed only when at least one
+ repository service is present (FATE#321043)
+
+-------------------------------------------------------------------
+Mon Jun 25 09:58:08 CEST 2018 - [email protected]
+
+- use long long instead of int for free disk space with MiB base
+- 2.48.6
+
+-------------------------------------------------------------------
Mon Aug 7 14:50:35 UTC 2017 - [email protected]
- Adjusted to increased so version of the base library (bsc#1052217)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/libyui-ncurses-pkg-2.48.5/package/libyui-ncurses-pkg.spec
new/libyui-ncurses-pkg-2.48.7/package/libyui-ncurses-pkg.spec
--- old/libyui-ncurses-pkg-2.48.5/package/libyui-ncurses-pkg.spec
2017-08-07 17:02:51.675828526 +0200
+++ new/libyui-ncurses-pkg-2.48.7/package/libyui-ncurses-pkg.spec
2018-07-18 16:48:33.000000000 +0200
@@ -17,7 +17,7 @@
Name: libyui-ncurses-pkg
-Version: 2.48.5
+Version: 2.48.7
Release: 0
Source: %{name}-%{version}.tar.bz2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.5/src/NCPackageSelector.cc
new/libyui-ncurses-pkg-2.48.7/src/NCPackageSelector.cc
--- old/libyui-ncurses-pkg-2.48.5/src/NCPackageSelector.cc 2017-08-07
16:02:58.000836040 +0200
+++ new/libyui-ncurses-pkg-2.48.7/src/NCPackageSelector.cc 2018-07-18
16:48:33.000000000 +0200
@@ -53,6 +53,7 @@
#include "NCPkgFilterPattern.h"
#include "NCPkgFilterLocale.h"
#include "NCPkgFilterRepo.h"
+#include "NCPkgFilterService.h"
#include "NCPkgFilterClassification.h"
#include "NCPkgPopupDeps.h"
#include "NCPkgPopupDiskspace.h"
@@ -1026,6 +1027,7 @@
patternPopup = 0;
languagePopup = 0;
repoPopup = 0;
+ servicePopup = 0;
searchPopup = 0;
}
@@ -1065,6 +1067,16 @@
repoPopup->setKeyboardFocus();
break;
}
+ case Services:
+ {
+ YTableHeader *hhh = new YTableHeader ();
+ servicePopup = new NCPkgServiceTable( replPoint, hhh, this );
+ servicePopup->setSize( oldSize.Sze.W, oldSize.Sze.H );
+ servicePopup->Redraw();
+ servicePopup->showServicePackages();
+ servicePopup->setKeyboardFocus();
+ break;
+ }
case RPMGroups:
{
filterPopup = new NCPkgFilterRPMGroups ( replPoint, " ", this);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.5/src/NCPackageSelector.h
new/libyui-ncurses-pkg-2.48.7/src/NCPackageSelector.h
--- old/libyui-ncurses-pkg-2.48.5/src/NCPackageSelector.h 2017-08-07
16:02:58.000836040 +0200
+++ new/libyui-ncurses-pkg-2.48.7/src/NCPackageSelector.h 2018-07-18
16:48:33.000000000 +0200
@@ -76,6 +76,7 @@
class NCPkgFilterPattern;
class NCPkgLocaleTable;
class NCPkgRepoTable;
+class NCPkgServiceTable;
class LangCode;
class NCPkgPopupDeps;
class NCPkgDiskspace;
@@ -136,6 +137,7 @@
NCPkgFilterPattern * patternPopup; // the pattern popup
NCPkgLocaleTable * languagePopup; // language popup
NCPkgRepoTable * repoPopup;
+ NCPkgServiceTable * servicePopup;
NCPkgDiskspace * diskspacePopup; // the popup showing the disk usage
@@ -210,6 +212,7 @@
Patterns,
Languages,
Repositories,
+ Services,
RPMGroups,
Search,
Summary,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.5/src/NCPkgFilterLocale.cc
new/libyui-ncurses-pkg-2.48.7/src/NCPkgFilterLocale.cc
--- old/libyui-ncurses-pkg-2.48.5/src/NCPkgFilterLocale.cc 2017-08-07
16:02:58.004836040 +0200
+++ new/libyui-ncurses-pkg-2.48.7/src/NCPkgFilterLocale.cc 2018-07-18
16:48:33.000000000 +0200
@@ -87,9 +87,9 @@
tabItem->addCell( new NCPkgLocaleTag ( l, status ) );
// and append the rest (name, URL and stuff)
- for ( unsigned i = 1; i < cols.size() + 1; ++i ) {
- tabItem->addCell( cols[ i-1 ]);
- }
+ for(const std::string& s: cols) {
+ tabItem->addCell(s);
+ };
// this is NCTable::addItem( tabItem );
//it actually appends the line to the table
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.5/src/NCPkgFilterMain.cc
new/libyui-ncurses-pkg-2.48.7/src/NCPkgFilterMain.cc
--- old/libyui-ncurses-pkg-2.48.5/src/NCPkgFilterMain.cc 2017-08-07
16:02:58.004836040 +0200
+++ new/libyui-ncurses-pkg-2.48.7/src/NCPkgFilterMain.cc 2018-07-18
16:48:33.000000000 +0200
@@ -43,6 +43,7 @@
#include <YUILog.h>
#include "NCPkgFilterMain.h"
+#include "NCPkgFilterService.h"
using std::endl;
@@ -77,6 +78,12 @@
repositories = new YItem( _( "Repositories" ) );
items.push_back( repositories );
+ if (NCPkgServiceTable::any_service())
+ {
+ services = new YItem( _( "Services" ) );
+ items.push_back( services );
+ }
+
search = new YItem( _( "Search" ) );
search->setSelected();
items.push_back( search );
@@ -104,6 +111,8 @@
pkg->replaceFilter ( NCPackageSelector::Languages );
else if ( currentItem == repositories )
pkg->replaceFilter ( NCPackageSelector::Repositories );
+ else if ( currentItem == services )
+ pkg->replaceFilter ( NCPackageSelector::Services );
else if ( currentItem == search )
pkg->replaceFilter ( NCPackageSelector::Search );
else if ( currentItem == inst_summary )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.5/src/NCPkgFilterMain.h
new/libyui-ncurses-pkg-2.48.7/src/NCPkgFilterMain.h
--- old/libyui-ncurses-pkg-2.48.5/src/NCPkgFilterMain.h 2017-08-07
16:02:58.004836040 +0200
+++ new/libyui-ncurses-pkg-2.48.7/src/NCPkgFilterMain.h 2018-07-18
16:48:33.000000000 +0200
@@ -64,6 +64,7 @@
YItem *languages;
YItem *rpmgroups;
YItem *repositories;
+ YItem *services;
YItem *search;
YItem *inst_summary;
YItem *pkg_class;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.5/src/NCPkgFilterRepo.cc
new/libyui-ncurses-pkg-2.48.7/src/NCPkgFilterRepo.cc
--- old/libyui-ncurses-pkg-2.48.5/src/NCPkgFilterRepo.cc 2017-08-07
16:02:58.004836040 +0200
+++ new/libyui-ncurses-pkg-2.48.7/src/NCPkgFilterRepo.cc 2018-07-18
16:48:33.000000000 +0200
@@ -127,9 +127,9 @@
tabItem->addCell( new NCPkgRepoTag ( r ) );
// and append the rest (name, URL and stuff)
- for ( unsigned i = 1; i < cols.size() + 1; ++i ) {
- tabItem->addCell( cols[ i-1 ]);
- }
+ for(const std::string& s: cols) {
+ tabItem->addCell(s);
+ };
// this is NCTable::addItem( tabItem );
//it actually appends the line to the table
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.5/src/NCPkgFilterService.cc
new/libyui-ncurses-pkg-2.48.7/src/NCPkgFilterService.cc
--- old/libyui-ncurses-pkg-2.48.5/src/NCPkgFilterService.cc 1970-01-01
01:00:00.000000000 +0100
+++ new/libyui-ncurses-pkg-2.48.7/src/NCPkgFilterService.cc 2018-07-18
16:48:33.000000000 +0200
@@ -0,0 +1,305 @@
+/****************************************************************************
+|
+| Copyright (c) [2002-2011] Novell, Inc.
+| Copyright (c) [2018] SUSE LLC
+| All Rights Reserved.
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of version 2 of the GNU General Public License as
+| published by the Free Software Foundation.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; if not, contact SUSE.
+|
+| To contact SUSE about this file by physical or electronic mail,
+| you may find current contact information at www.suse.com
+|
+|***************************************************************************/
+
+#define YUILogComponent "ncurses-pkg"
+#include <YUILog.h>
+
+#include <zypp/ServiceInfo.h>
+#include <boost/algorithm/string.hpp>
+
+#include "NCPkgFilterService.h"
+
+#include "YDialog.h"
+#include "NCLayoutBox.h"
+#include "NCSpacing.h"
+#include "NCPackageSelector.h"
+
+#include "NCZypp.h"
+
+using std::endl;
+
+/*
+ Textdomain "ncurses-pkg"
+*/
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCPkgServiceTag::NCPkgServiceTag
+// METHOD TYPE : Constructor
+//
+// DESCRIPTION :
+//
+
+NCPkgServiceTag::NCPkgServiceTag ( ZyppService servicePtr)
+ : YTableCell(std::string(" "))
+ , service (servicePtr)
+{
+
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCPkgServiceTable::NCPkgServiceTable
+// METHOD TYPE : Constructor
+//
+// DESCRIPTION :
+//
+
+NCPkgServiceTable::NCPkgServiceTable( YWidget *parent, YTableHeader
*tableHeader, NCPackageSelector *pkg )
+ :NCTable( parent, tableHeader )
+ ,packager(pkg)
+ ,repo_manager(new zypp::RepoManager())
+{
+ fillHeader();
+ fillServiceList();
+}
+
+bool NCPkgServiceTable::any_service()
+{
+ bool ret = std::any_of(ZyppRepositoriesBegin(), ZyppRepositoriesEnd(),
[](const zypp::Repository& repo) {
+ // if the repository does not belong to any service then the service
name is empty
+ return !repo.info().service().empty();
+ });
+
+ yuiMilestone() << "Found a libzypp service: " << ret << std::endl;
+ return ret;
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCPkgServiceTable::fillHeader
+// METHOD TYPE : void
+//
+// DESCRIPTION : Fill header of servicesitories table (name + URL)
+//
+
+void NCPkgServiceTable::fillHeader()
+{
+ std::vector <std::string> header;
+
+ header.reserve(2);
+ header.push_back( "L" );
+ header.push_back( "L" + NCPkgStrings::PkgName() );
+
+ setHeader( header);
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCPkgServiceTable::addLine
+// METHOD TYPE : void
+//
+// DESCRIPTION : Add one line (with tag) to the service table
+//
+
+void NCPkgServiceTable::addLine ( ZyppService svc, const std::vector
<std::string> & cols )
+{
+ //use default ctor, add cell in the next step
+ YTableItem *tabItem = new YTableItem();
+
+ //place tag (with service reference) to the 0th column
+ tabItem->addCell( new NCPkgServiceTag (svc) );
+
+ // and append the rest (name, URL and stuff)
+ for(const std::string& s: cols) {
+ tabItem->addCell(s);
+ };
+
+ // this is NCTable::addItem( tabItem );
+ //it actually appends the line to the table
+ addItem( tabItem );
+
+
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCPkgServiceTable::getTag
+// METHOD TYPE : NCPkgServiceTag *
+//
+// DESCRIPTION : Get tag of service table line on current index,
+// (contains service reference)
+//
+
+NCPkgServiceTag* NCPkgServiceTable::getTag (int index)
+{
+ NCTableLine *line = myPad()->ModifyLine( index );
+ if ( !line )
+ {
+ return nullptr;
+ }
+
+ YTableItem *it = line->origItem();
+
+ //get actual service tag from 0th column of the table
+ YTableCell *tcell = it->cell(0);
+ NCPkgServiceTag *tag = static_cast<NCPkgServiceTag *>( tcell );
+
+ return tag;
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCPkgServiceTable::getService
+// METHOD TYPE : ZyppService
+//
+// DESCRIPTION : Get service reference from selected line's tag
+//
+
+ZyppService NCPkgServiceTable::getService( int index )
+{
+ NCPkgServiceTag *t = getTag( index );
+
+ return t ? t->getService() : ZyppService();
+}
+
+static std::string html_escape(const std::string& s)
+{
+ std::string escaped = boost::replace_all_copy(s, "&", "&");
+ boost::replace_all(escaped, "<", "<");
+ boost::replace_all(escaped, ">", ">");
+ return escaped;
+}
+
+std::string NCPkgServiceTable::getDescription(ZyppService svc)
+{
+ zypp::ServiceInfo si = repo_manager->getService(svc);
+
+ std::string label = _( "<b>Service URL:</b>" );
+ std::string ret = label + html_escape(si.url().asString());
+ return ret;
+}
+
+/////////////////////////////////////////////////////////////////////
+////
+////
+//// METHOD NAME : NCPkgFilterService::fillServiceList
+//// METHOD TYPE : bool
+////
+//// DESCRIPTION : Add items to the service list (assoc.
+//// product name, if any, and URL)
+////
+//
+bool NCPkgServiceTable::fillServiceList()
+{
+ yuiMilestone() << "Filling service list" << endl;
+
+ std::set<std::string> seen_services;
+
+ std::for_each(ZyppRepositoriesBegin(), ZyppRepositoriesEnd(), [&](const
zypp::Repository& repo)
+ {
+ const std::string &service_name(repo.info().service());
+ if (!service_name.empty())
+ {
+ if (seen_services.find(service_name) == seen_services.end())
+ {
+ seen_services.insert(service_name);
+
+ std::vector <std::string> oneLine;
+ oneLine.push_back( service_name );
+ addLine( service_name, oneLine);
+ }
+ }
+ });
+
+ return true;
+}
+
+void NCPkgServiceTable::showServicePackages( )
+{
+ int index = getCurrentItem();
+ ZyppService service = getService( index );
+
+ yuiMilestone() << "Selected service " << service << endl;
+ yuiMilestone() << "Collecting packages in selected service" << endl;
+
+ NCPkgTable *pkgList = packager->PackageList();
+ //clean the pkg table first
+ pkgList->itemsCleared ();
+
+ zypp::PoolQuery query;
+ query.addKind( zypp::ResKind::package );
+
+ std::for_each(ZyppRepositoriesBegin(), ZyppRepositoriesEnd(), [&](const
zypp::Repository& repo)
+ {
+ if (service == repo.info().service())
+ {
+ yuiMilestone() << "Adding repo filter: " << repo.info().alias() <<
std::endl;
+ query.addRepo( repo.info().alias() );
+ }
+ });
+
+ for( zypp::PoolQuery::Selectable_iterator it = query.selectableBegin();
+ it != query.selectableEnd(); it++)
+ {
+ ZyppPkg pkg = tryCastToZyppPkg( (*it)->theObj() );
+ pkgList->createListEntry ( pkg, *it);
+ }
+
+ packager->FilterDescription()->setText( getDescription( service ) );
+
+ pkgList->setCurrentItem( 0 );
+ pkgList->drawList();
+ pkgList->showInformation();
+}
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : NCPkgFilterService::wHandleInput
+// METHOD TYPE : NCursesEvent
+//
+// DESCRIPTION : default boring handle-input
+//
+
+NCursesEvent NCPkgServiceTable::wHandleInput( wint_t ch )
+{
+ NCursesEvent ret = NCursesEvent::none;
+ handleInput( ch );
+
+ switch ( ch )
+ {
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_NPAGE:
+ case KEY_PPAGE:
+ case KEY_END:
+ case KEY_HOME: {
+ ret = NCursesEvent::handled;
+ showServicePackages();
+ break;
+ }
+
+ default:
+ ret = NCTable::wHandleInput( ch ) ;
+ }
+
+ return ret;
+}
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.5/src/NCPkgFilterService.h
new/libyui-ncurses-pkg-2.48.7/src/NCPkgFilterService.h
--- old/libyui-ncurses-pkg-2.48.5/src/NCPkgFilterService.h 1970-01-01
01:00:00.000000000 +0100
+++ new/libyui-ncurses-pkg-2.48.7/src/NCPkgFilterService.h 2018-07-18
16:48:33.000000000 +0200
@@ -0,0 +1,153 @@
+/****************************************************************************
+|
+| Copyright (c) [2002-2011] Novell, Inc.
+| Copyright (c) [2018] SUSE LLC
+| All Rights Reserved.
+|
+| This program is free software; you can redistribute it and/or
+| modify it under the terms of version 2 of the GNU General Public License as
+| published by the Free Software Foundation.
+|
+| This program is distributed in the hope that it will be useful,
+| but WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+| GNU General Public License for more details.
+|
+| You should have received a copy of the GNU General Public License
+| along with this program; if not, contact SUSE.
+|
+| To contact SUSE about this file by physical or electronic mail,
+| you may find current contact information at www.suse.com
+|
+|***************************************************************************/
+
+#ifndef NCPkgFilterService_h
+#define NCPkgFilterService_h
+
+#include <iosfwd>
+
+#include <vector>
+#include <string>
+#include <algorithm>
+#include <zypp/RepoManager.h>
+
+#include "NCPadWidget.h"
+#include "NCPopup.h"
+#include "NCPushButton.h"
+#include "NCTable.h"
+#include "NCTablePad.h"
+#include "NCZypp.h"
+
+class NCTable;
+class NCPushButton;
+class NCPackageSelector;
+
+// represent a service by its name
+typedef std::string ZyppService;
+
+class NCPkgServiceTag : public YTableCell
+{
+
+private:
+
+ ZyppService service;
+
+public:
+ /**
+ * A helper class to hold a reference to zypp::Service
+ * for each service table line
+ * (actually it's a dummy column of the table)
+ * @param service zypp::Service reference
+ */
+
+ NCPkgServiceTag ( ZyppService service);
+
+ ~NCPkgServiceTag() { };
+
+ /*
+ * Get service reference from the line tag
+ * @return ZyppService
+ */
+
+ ZyppService getService() const { return service; }
+
+};
+
+class NCPkgServiceTable : public NCTable
+{
+private:
+
+ NCPkgServiceTable & operator=( const NCPkgServiceTable & );
+ NCPkgServiceTable ( const NCPkgServiceTable & );
+
+ NCPackageSelector *packager;
+ zypp::shared_ptr<zypp::RepoManager> repo_manager;
+
+public:
+
+ /**
+ * A helper class to hold service data in a neat table
+ * widget
+ * @param parent A parent widget
+ * @param tableHeader table header
+ * @param pkg the master object
+ */
+
+ NCPkgServiceTable ( YWidget *parent, YTableHeader *tableHeader,
NCPackageSelector *pkg);
+
+ virtual ~NCPkgServiceTable() {};
+
+ /**
+ * @return bool any service is present at all
+ */
+ static bool any_service();
+
+ /**
+ * Add one line (with tag) to the services table
+ * @param ZyppService Reference to zypp::Service
+ * @param cols String std::vector with service data (name + URL)
+ */
+ virtual void addLine( ZyppService r, const std::vector<std::string> & cols
);
+
+ /*
+ * Fill header of services table (name + URL)
+ */
+ void fillHeader();
+
+ /**
+ * Get tag of service table line on current index,
+ * (contains service reference)
+ * @param index Index of selected table line
+ * @return NCPkgServiceTag* Tag of selected line
+ */
+ NCPkgServiceTag * getTag ( int index );
+
+ /**
+ * Get service reference from selected line's tag
+ * @param index Index of selected table line
+ * @return ZyppService Associated zypp::Service reference
+ */
+ ZyppService getService( int index );
+
+ /**
+ * @return HTML contents for the description pane
+ */
+ std::string getDescription (ZyppService r);
+
+ virtual NCursesEvent wHandleInput ( wint_t ch );
+
+ /**
+ * Add items to the service list (assoc.
+ * product name, if any, and URL)
+ * @return bool (always true ;-) )
+ */
+ bool fillServiceList( );
+
+ /**
+ * Make the Package List show the packages
+ * for the currently selected service
+ */
+ void showServicePackages( );
+
+};
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.5/src/NCPkgPopupDiskspace.cc
new/libyui-ncurses-pkg-2.48.7/src/NCPkgPopupDiskspace.cc
--- old/libyui-ncurses-pkg-2.48.5/src/NCPkgPopupDiskspace.cc 2017-08-07
16:02:58.008836040 +0200
+++ new/libyui-ncurses-pkg-2.48.7/src/NCPkgPopupDiskspace.cc 2018-07-18
16:48:33.000000000 +0200
@@ -1,6 +1,7 @@
/****************************************************************************
|
| Copyright (c) [2002-2011] Novell, Inc.
+| Copyright (c) 2018 SUSE LLC
| All Rights Reserved.
|
| This program is free software; you can redistribute it and/or
@@ -58,6 +59,9 @@
#include "NCi18n.h"
+// zypp::str::form()
+#include <zypp/base/String.h>
+
// set values as set in YQPkgDiskUsageList.cc
#define MIN_FREE_MB_WARN 400
#define MIN_FREE_MB_PROXIMITY 700
@@ -107,6 +111,42 @@
{
}
+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 );
+ }
+}
+
///////////////////////////////////////////////////////////////////
//
//
@@ -120,44 +160,32 @@
NCTable * partitions = popupWin->Partitions();
partitions->deleteAllItems(); // clear table
- YTableItem * newItem;
- int i = 0;
-
zypp::ZYpp::Ptr z = zypp::getZYpp();
ZyppDuSet du = z->diskUsage ();
- ZyppDuSetIterator
- b = du.begin (),
- e = du.end (),
- it;
- if (b == e)
- {
- // retry after detecting from the target
- z->setPartitions(zypp::DiskUsageCounter::detectMountPoints ());
- du = z->diskUsage();
- b = du.begin ();
- e = du.end ();
- }
- for (it = b; it != e; ++it)
+ if (du.empty())
{
- if (it->readonly)
- continue;
-
- zypp::ByteCount pkg_used (it->pkg_size * 1024);
+ // retry after detecting from the target
+ z->setPartitions(zypp::DiskUsageCounter::detectMountPoints ());
+ du = z->diskUsage();
+ }
- zypp::ByteCount pkg_available ((it->total_size - it->pkg_size) * 1024);
+ for (const ZyppPartitionDu &item: du)
+ {
+ if (item.readonly)
+ continue;
- zypp::ByteCount total (it->total_size * 1024);
+ 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;
- newItem = new YTableItem( it->dir,
- pkg_used.asString (8),
- pkg_available.asString (8),
- total.asString (8),
- usedPercent( it->pkg_size, it->total_size ) );
+ YTableItem * newItem = new YTableItem( item.dir,
+ formatSize(pkg_used, 8),
+ formatSize(pkg_available, 8),
+ formatSize(total, 8),
+ usedPercentStr( item.pkg_size,
item.total_size ) );
partitions->addItem( newItem );
-
- i++;
}
}
@@ -172,39 +200,35 @@
//
std::string NCPkgDiskspace::checkDiskSpace()
{
- std::string text = "";
+ std::string text;
zypp::ZYpp::Ptr z = zypp::getZYpp();
ZyppDuSet du = z->diskUsage ();
- ZyppDuSetIterator
- b = du.begin (),
- e = du.end (),
- it;
- if (b == e)
- {
- // retry after detecting from the target
- z->setPartitions(zypp::DiskUsageCounter::detectMountPoints ());
- du = z->diskUsage();
- b = du.begin ();
- e = du.end ();
+
+ if (du.empty())
+ {
+ // retry after detecting from the target
+ z->setPartitions(zypp::DiskUsageCounter::detectMountPoints ());
+ du = z->diskUsage();
}
- for (it = b; it != e; ++it)
+ for (const ZyppPartitionDu &item: du)
{
- if (it->readonly)
+ if (item.readonly)
continue;
- zypp::ByteCount pkg_available = (it->total_size - it->pkg_size) * 1024;
+ // available size (in KiB!)
+ long long pkg_available = item.total_size - item.pkg_size;
if ( pkg_available < 0 )
{
text += "\"";
- text += it->dir;
+ text += item.dir;
text += "\"";
text += " ";
text += NCPkgStrings::MoreText();
text += " ";
- std::string available = pkg_available.asString();
- text += available.replace( 0, 1, " " ); // clear the minus sign??
+ // make positive, use double to avoid overflow
+ text += formatSize(-1.0 * double(pkg_available) * FSize::KB);
text += " ";
text += NCPkgStrings::MoreSpaceText();
text += "<br>";
@@ -224,18 +248,17 @@
//
void NCPkgDiskspace::checkRemainingDiskSpace( const ZyppPartitionDu &
partition )
{
- FSize usedSize ( partition.pkg_size, FSize::K );
- FSize totalSize ( partition.total_size, FSize::K );
-
- int percent = 0;
+ if ( partition.readonly )
+ return;
- if ( totalSize != 0 )
- percent = ( 100 * usedSize ) / totalSize;
+ int percent = usedPercentInt(partition.pkg_size, partition.total_size);
- int free = ( totalSize - usedSize ) / FSize::MB;
+ // 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;
- yuiMilestone() << "Partition: " << partition.dir << " Used percent: "
- << percent << " Free: " << free << endl;
+ yuiMilestone() << "Partition: " << partition.dir << " Total (MiB): "
+ << partition.total_size / 1024 << " Used (MiB): " <<
partition.pkg_size / 1024
+ << " Used percent: " << percent << "% Free (MiB): " << free << endl;
if ( percent > MIN_PERCENT_WARN )
{
@@ -243,10 +266,12 @@
// can be misleading - check the absolute value, too.
if ( free < MIN_FREE_MB_PROXIMITY )
{
+ yuiWarning() << "free < MIN_FREE_MB_PROXIMITY (" <<
MIN_FREE_MB_PROXIMITY << ")" << endl;
runningOutWarning.enterProximity();
}
if ( free < MIN_FREE_MB_WARN )
{
+ yuiWarning() << "free < MIN_FREE_MB_WARN (" << MIN_FREE_MB_WARN << ")"
<< endl;
runningOutWarning.enterRange();
}
}
@@ -280,20 +305,10 @@
//
void NCPkgDiskspace::setDiskSpace( wint_t ch )
{
- int percent = 0;
-
// set diskspace values in ZyppDuSet testDiskSpace
- for ( ZyppDuSetIterator it = testDiskUsage.begin();
- it != testDiskUsage.end();
- ++it )
+ for ( const ZyppPartitionDu &partitionDu: testDiskUsage )
{
- const ZyppPartitionDu & partitionDu = *it;
-
- FSize usedSize ( partitionDu.pkg_size, FSize::K );
- FSize totalSize ( partitionDu.total_size, FSize::K );
-
- if ( totalSize != 0 )
- percent = ( 100 * usedSize ) / totalSize;
+ int percent = usedPercentInt(partitionDu.pkg_size, partitionDu.total_size);
if ( ch == '+' )
percent += 3;
@@ -303,12 +318,11 @@
if ( percent < 0 )
percent = 0;
- partitionDu.pkg_size = partitionDu.total_size * percent / 100;
-
- FSize newSize ( partitionDu.pkg_size, FSize::K );
+ partitionDu.pkg_size = partitionDu.total_size / 100 * percent;
- yuiMilestone() << "Used size (MB): " << newSize / FSize::MB << endl;
- yuiMilestone() << "Total size (MB): " << totalSize / FSize::MB << endl;
+ // 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;
}
}
@@ -374,6 +388,7 @@
}
}
+// FIXME: do not use this, contains overflow bug, use usedPercentStr() instead!
std::string NCPkgDiskspace::usedPercent( FSize used, FSize total )
{
int percent = 0;
@@ -409,23 +424,19 @@
{
zypp::ZYpp::Ptr z = zypp::getZYpp();
ZyppDuSet du = z->diskUsage ();
- ZyppDuSetIterator
- b = du.begin (),
- e = du.end (),
- it;
- if (b == e)
- {
- // retry after detecting from the target
- z->setPartitions(zypp::DiskUsageCounter::detectMountPoints ());
- du = z->diskUsage();
- b = du.begin ();
- e = du.end ();
+
+ if (du.empty())
+ {
+ // retry after detecting from the target
+ z->setPartitions(zypp::DiskUsageCounter::detectMountPoints ());
+ du = z->diskUsage();
}
zypp::ByteCount diff = 0;
- for (it = b; it != e; ++it)
+ for (const ZyppPartitionDu &item: du)
{
- diff += (it->pkg_size - it->used_size) * 1024;
+ // the diff should be normally very small, the "long long" limit
should be never reached (TM)
+ diff += (item.pkg_size - item.used_size) * 1024;
}
return diff;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.5/src/NCPkgPopupDiskspace.h
new/libyui-ncurses-pkg-2.48.7/src/NCPkgPopupDiskspace.h
--- old/libyui-ncurses-pkg-2.48.5/src/NCPkgPopupDiskspace.h 2017-08-07
16:02:58.008836040 +0200
+++ new/libyui-ncurses-pkg-2.48.7/src/NCPkgPopupDiskspace.h 2018-07-18
16:48:33.000000000 +0200
@@ -204,6 +204,7 @@
NCPkgPopupDiskspace *popupWin;
ZyppDuSet testDiskUsage;
+ // FIXME: not used anymore, might overflow
std::string usedPercent( FSize used, FSize total );
/**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/libyui-ncurses-pkg-2.48.5/src/NCPkgTable.cc
new/libyui-ncurses-pkg-2.48.7/src/NCPkgTable.cc
--- old/libyui-ncurses-pkg-2.48.5/src/NCPkgTable.cc 2017-08-07
16:02:58.008836040 +0200
+++ new/libyui-ncurses-pkg-2.48.7/src/NCPkgTable.cc 2018-07-18
16:48:33.000000000 +0200
@@ -164,9 +164,9 @@
tabItem->addCell( new NCPkgTableTag( objPtr, slbPtr, stat ));
- for ( unsigned i = 1; i < elements.size()+1; ++i ) {
- tabItem->addCell( elements[i-1] );
- }
+ for(const std::string& s: elements) {
+ tabItem->addCell(s);
+ };
// use all-at-once insertion mode - DrawPad() is called only after the loop
addItem(tabItem, true);