kdenonbeta/kdedebian/kapture
CVS commit by mornfall:
Robustness ++. Catch error conditions from dpkg and various scripts.
M +1 -1 libcapture/pkgmanager.cpp 1.38
M +1 -1 libcapture/pkgmanager.h 1.26
M +21 -21 libkapture/dpkgpm.cpp 1.13
M +1 -0 libkapture/kapturemanager.cpp 1.30
--- kdenonbeta/kdedebian/kapture/libcapture/pkgmanager.cpp #1.37:1.38
@@ -391,5 +391,5 @@ bool PkgManager::_commit (CommitStatus *
notifyCacheWriteableChange ();
bool res = doCommit (st);
- if (_config->FindB("APT::Get::Download-Only",false) == false)
+ if (_config->FindB("APT::Get::Download-Only",false) == false && res)
loadAll ();
return res;
--- kdenonbeta/kdedebian/kapture/libcapture/pkgmanager.h #1.25:1.26
@@ -103,5 +103,4 @@ namespace capture {
bool loadCache (void);
bool loadTags (void);
- bool loadAll (void);
void closeCache (void);
TagCollection <std::string, std::string> *m_tagColl;
@@ -116,4 +115,5 @@ namespace capture {
void unregisterCSWatcher (CSWatcher *);
void notifyCacheWriteableChange (void);
+ bool loadAll (void);
/* instance {{{ */
--- kdenonbeta/kdedebian/kapture/libkapture/dpkgpm.cpp #1.12:1.13
@@ -39,25 +39,19 @@ bool kapture::DPkgPM::forkDpkg (char *co
l . append (argv [i]);
m_se -> run (argv [0], l);
- // UNUSED: int Child = m_se -> sessionPID ();
+ int chld = m_se -> sessionPID ();
+ TEPty *proc = m_se -> getPty ();
// UNUSED: int Status; int ret;
- while (! m_se -> getPty () -> wait (0)) {
+ while (! proc -> wait (0)) {
dpkgMonitor ();
usleep (100000);
}
+ if (proc -> normalExit () && proc -> exitStatus () == 0)
return true;
- // connect (m_se, SIGNAL (processExited ()), this, SLOT (dpkgExit ()));
- /* while ((ret = waitpid (Child, &Status, WNOHANG)) != Child) {
- if (errno == EINTR || ret == 0) {
- dpkgMonitor ();
- usleep (100000); // 0.1 second hang
- continue;
- }
- // m_se -> getPty () -> wait (0);
- RunScripts ("DPkg::Post-Invoke");
-
- // signal(SIGQUIT,old_SIGQUIT);
- // signal(SIGINT,old_SIGINT);
- return _error -> Errno ("waitpid","Couldn't wait for subprocess");
- } */
+ runScripts ("DPkg::Post-Invoke", false);
+ if (proc -> normalExit ())
+ return _error -> Error ("Child %d for %s exited with error %d", chld,
+ argv [0], proc -> exitStatus ());
+ return _error -> Error ("Child %d for %s was killed by signal %d", chld,
+ argv [0], proc -> exitSignal ());
}
@@ -77,6 +71,7 @@ bool kapture::DPkgPM::forkScript (const
if (fP)
m_se -> setPty (new ScriptProcess (m_pipe [0]));
+ TEPty *proc = m_se -> getPty ();
m_se -> run ("/bin/sh", l);
- // UNUSED: int Child = m_se -> sessionPID ();
+ int chld = m_se -> sessionPID ();
/* if (Process == 0)
{
@@ -89,10 +84,15 @@ bool kapture::DPkgPM::forkScript (const
}
- while (! m_se -> getPty () -> wait (0)) {
+ while (! proc -> wait (0)) {
kapp -> processEvents ();
usleep (100000);
}
+ if (proc -> normalExit () && proc -> exitStatus () == 0)
return true;
- // XXX...
+ if (proc -> normalExit ())
+ return _error -> Error ("Child %d for %s exited with error %d", chld,
+ cmd, proc -> exitStatus ());
+ return _error -> Error ("Child %d for %s was killed by signal %d", chld,
+ cmd, proc -> exitSignal ());
}
--- kdenonbeta/kdedebian/kapture/libkapture/kapturemanager.cpp #1.29:1.30
@@ -70,4 +70,5 @@ void KaptureManager::commit (void)
delete st;
ErrorDialog::dumpErrors (m_top);
+ PkgManager::instance () -> loadAll ();
}
/* }}} */
Reply to: