[zypp-commit] r6402 - in /trunk/updater-kde/updater/zypp: ZYppUpdater.cpp ZYppUpdater.h
Author: tgoettlicher
Date: Thu Aug 2 17:15:49 2007
New Revision: 6402
URL: http://svn.opensuse.org/viewcvs/zypp?rev=6402&view=rev
Log:
cleanup
Modified:
trunk/updater-kde/updater/zypp/ZYppUpdater.cpp
trunk/updater-kde/updater/zypp/ZYppUpdater.h
Modified: trunk/updater-kde/updater/zypp/ZYppUpdater.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/updater-kde/updater/zypp/ZYppUpdater.cpp?rev=6402&r1=6401&r2=6402&view=diff
==============================================================================
--- trunk/updater-kde/updater/zypp/ZYppUpdater.cpp (original)
+++ trunk/updater-kde/updater/zypp/ZYppUpdater.cpp Thu Aug 2 17:15:49 2007
@@ -53,7 +53,6 @@
ZYppUpdater::ZYppUpdater( QObject *parent, const char* name, const QStringList& ) : Updater( parent, name )
, _process(0L)
- , _install_process(0L)
, _state(Unknown)
, _update_counter(0)
, _patchList(0)
@@ -70,8 +69,6 @@
kdDebug() << "Initializing zypp backend" << endl;
_xml_reader.setContentHandler(this);
- _xml_reader.parse( &_xml_source,
- true /* incremental parsing*/);
}
@@ -88,8 +85,6 @@
kdDebug() << "install process exited." << endl;
emit(showProgress(false));
-
-
if (p->exitStatus() == 0 && _install_stderr_buffer.isEmpty() && _install_stdout_buffer.isEmpty() )
{
// Everything is fine
@@ -98,23 +93,12 @@
doCheckForUpdates();
}
-
if (p->exitStatus() == 103 )
{
- QMessageBox::information( NULL, PROGRAM_DISPLAY_NAME, i18n("One of installed patches affects the package manager itself, thus it requires to restart %1.").arg(PROGRAM_DISPLAY_NAME));
-
system("( sleep 2; opensuseupdater-kde ) & ");
-
kapp->quit();
}
- if (p->exitStatus() == 102)
- {
- QMessageBox::information( NULL, PROGRAM_DISPLAY_NAME,
- i18n("One of installed patches requires reboot of your machine. Please, do it as soon as possible."));
- doCheckForUpdates();
- }
-
if ( !_install_stderr_buffer.isEmpty() || !_install_stdout_buffer.isEmpty() )
{
// some errors/warnings occured
@@ -139,7 +123,6 @@
_install_stderr_buffer.truncate(0);
_install_stdout_buffer.truncate(0);
delete p;
- _install_process = 0L;
}
@@ -158,9 +141,8 @@
kdDebug() << _buffer << endl;
delete _process;
_process = 0L;
- // parse the xml
-
+ // parse the xml
if ( ! _last_xml_parse_code )
{
@@ -170,19 +152,9 @@
else
updateAppletError(i18n("helper program returned:\n%1").arg(_buffer) );
- if ( _stderr_buffer.find("Forgot to chmod this program") != -1 )
- QMessageBox::critical( NULL, PROGRAM_DISPLAY_NAME, i18n("Unable to check for patches and updates because /usr/sbin/zypp-checkpatches-wrapper helper programm is not set SUID root.\nThis problem might be solved by setting \"File Permissons\" in YaST \"Local Security\" tab to \"easy\" or by modifying /etc/permissions.local."));
-
-
// clear the buffer
_stderr_buffer.truncate(0);
_buffer.truncate(0);
-
- // remove if 2 programs are run at the same time
- _xml_source.setData(QString());
- _last_xml_parse_code = true;
- _xml_reader.parse( &_xml_source,
- true /* incremental parsing*/);
emit(populateDone());
return;
@@ -191,8 +163,6 @@
// clear the buffer
_stderr_buffer.truncate(0);
_buffer.truncate(0);
- _xml_source.setData(QString());
- _last_xml_parse_code = true;
if ( ! _patchList || !_packageList )
{
@@ -203,7 +173,8 @@
_patchList->clear();
_packageList->clear();
- bool pkgmgr_avail=false;
+ bool pkgmgr_available=false;
+ bool critical_available=false;
kdDebug() << "populating... " << _resolvables.count() << " resolvables" << endl;
@@ -224,30 +195,39 @@
newItem->setText(COLUMN_RESTART, ((*it)->restart == true ) ? "Yes" : "No" ) ;
newItem->setText(COLUMN_RESTART_HIDDEN, ((*it)->restart == true) ? "restart" : "norestart" );
+ if ((*it)->category == "security")
+ critical_available=true;
+
if ((*it)->pkgmanager)
{
- pkgmgr_avail=true;
+ pkgmgr_available=true;
newItem->setText(COLUMN_TYPE, "packagemanager" );
}
-
-
}
- if (pkgmgr_avail)
+
+ if (pkgmgr_available)
emit(updateApplet(APPLET_PKGMGR_UPDATES, _patchList->childCount(), _packageList->childCount()));
+ else if (critical_available)
+ emit(updateApplet(APPLET_CRITICAL_UPDATES, _patchList->childCount(), _packageList->childCount()));
else if ( _patchList->childCount() > 0 )
emit(updateApplet(APPLET_UPDATES, _patchList->childCount(), _packageList->childCount()));
else
emit(updateApplet(APPLET_NO_UPDATES, 0, 0));
+ // TODO
+ if ( _message )
+ {
+ emit(updateAppletError(_error_buffer));
+ _message_buffer.truncate(0);
+ }
+
if ( _error )
{
- emit(updateAppletError(_error_message_buffer));
- _error_message_buffer.truncate(0);
+ emit(updateAppletError(_error_buffer));
+ _error_buffer.truncate(0);
}
emit(populateDone());
- _xml_reader.parse( &_xml_source,
- true /* incremental parsing*/);
}
void ZYppUpdater::slotReceivedStdout(KProcess *proc, char *buffer, int buflen)
@@ -307,18 +287,15 @@
if ( _process )
{
- kdDebug() << "Check process still running. Will not run this time." << endl;
+ kdDebug() << "Process still running. Will not run this time." << endl;
emit(updateApplet(APPLET_CHECKING, 0, 0));
return;
}
-
- if ( _install_process )
- {
- kdDebug() << "Install process running. Will not run check this time." << endl;
- emit(updateApplet(APPLET_INSTALLING, 0, 0));
- return;
- }
-
+ // remove if 2 programs are run at the same time
+ _xml_source.setData(QString());
+ _last_xml_parse_code = true;
+ _xml_reader.parse( &_xml_source,
+ true /* incremental parsing*/);
_process = new KProcess;
*_process << "/usr/sbin/zypp-checkpatches-wrapper";
@@ -374,6 +351,13 @@
void ZYppUpdater::startInstall()
{
+ if ( _process )
+ {
+ // TODO update still running
+ kdDebug() << "Process still running. Will not run this time." << endl;
+ return;
+ }
+
if (!_patchList || !_packageList)
{
kdDebug() << "!_patchList || !_packageList!!! " << endl;
@@ -383,9 +367,10 @@
QStringList installPatchList;
QStringList installPackageList;
- QStringList installPkgMgrList;
QCheckListItem *item = (QCheckListItem*)_patchList->firstChild();
+ kdDebug() << "patchlist elements: " << _patchList->childCount() << endl;
+
while (item != NULL)
{
if (item->isOn())
@@ -395,19 +380,14 @@
{
ZYppResolvable *patch = zi->resolvable();
+ kdDebug() << patch->name << endl;
if ( patch->license.stripWhiteSpace().isEmpty())
- if (patch->pkgmanager)
- installPkgMgrList += item->text();
- else
- installPatchList += item->text();
+ installPatchList += item->text();
else
{
licenseDialog->setText(i18n("License of %1").arg(patch->name), patch->license);
if ( licenseDialog->exec() )
- if (patch->pkgmanager)
- installPkgMgrList += item->text();
- else
- installPatchList += item->text();
+ installPatchList += item->text();
}
}
}
@@ -423,12 +403,12 @@
ZYppListItem *zi = dynamic_cast
participants (1)
-
tgoettlicher@svn.opensuse.org