Ignore:
Timestamp:
07/12/13 10:48:43 (15 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
4f9718b
Parents:
b5cfd4d
git-author:
Ken Moore <ken@…> (07/12/13 10:44:39)
git-committer:
Ken Moore <ken@…> (07/12/13 10:48:43)
Message:

Add a bunch of error loggin to the backend processes, and also add a new dialog for displaying these error logs. Also fix the detection of an update failure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-softwaremanager/processManager.cpp

    r78fa8b2 rc71b68c  
    7878  if( ID == UPDATE ){ 
    7979    qDebug() << "Update Process Started:" << cmd; 
     80    upLog.clear(); //clear the log for action 
    8081    upProc->start(cmd);    
    8182  }else if( ID == REMOVE ){ 
    8283    qDebug() << "Removal Process Started:" << cmd; 
     84    remLog.clear(); 
    8385    remProc->start(cmd);                   
    8486  }else if( ID == DOWNLOAD ){ 
    8587    qDebug() << "Download Process Started:" << cmd; 
     88    dlLog.clear(); 
    8689    dlProc->start(cmd);            
    8790  }else if( ID == INSTALL ){ 
    8891    qDebug() << "Install Process Started:" << cmd; 
     92    inLog.clear(); 
    8993    inProc->start(cmd);            
    9094  }else if( ID == OTHER ){ 
     
    113117} 
    114118 
     119QStringList ProcessManager::getProcessLog(ProcessID ID){ 
     120  if( ID == UPDATE ){ return upLog; } 
     121  else if( ID == REMOVE ){ return remLog; } 
     122  else if( ID == DOWNLOAD ){ return dlLog; } 
     123  else if( ID == INSTALL ){ return inLog; } 
     124  else{ return QStringList(); } 
     125} 
    115126 
    116127// ========================= 
     
    174185// == UPDATE PROCESS == 
    175186void ProcessManager::slotUpProcMessage(){ 
    176     while( upProc->canReadLine() ){ 
     187  while( upProc->canReadLine() ){ 
    177188    QString line = upProc->readLine().simplified(); 
     189    if(line.isEmpty()){ continue; } 
    178190    QString dl = parseDlLine(line); 
    179191    if(!dl.isEmpty()){ emit ProcessMessage(UPDATE,dl); } 
     192    else{ upLog << line; } //not a download line - add to the log 
    180193  } 
    181194} 
     
    183196void ProcessManager::slotUpProcFinished(){ 
    184197  if(upProc->exitStatus() != QProcess::NormalExit){ 
    185     QString msg = upProc->readAllStandardError(); 
    186     if(msg.isEmpty()){ msg = upProc->readAllStandardOutput(); } 
    187     if(msg.isEmpty()){ msg = tr("Unknown Error"); } 
    188     qDebug() << "Update Process Error:"<<msg; 
    189     emit ProcessError(UPDATE, msg); 
     198    //Emit the command log 
     199    qDebug() << "Update Process Error Log:\n"<<upLog.join("\n"); 
     200    emit ProcessError(UPDATE, upLog); 
    190201  }else{ 
    191202    qDebug() << "Update Process Finished"; 
     
    196207// == REMOVE PROCESS == 
    197208void ProcessManager::slotRemProcMessage(){ 
    198   QString msg = remProc->readAllStandardOutput(); 
    199   emit ProcessMessage(REMOVE,msg); 
     209  while( remProc->canReadLine() ){ 
     210    QString line = remProc->readLine().simplified(); 
     211    if(!line.isEmpty()){  
     212      remLog << line;  
     213      emit ProcessMessage(REMOVE,line); 
     214    } 
     215  } 
    200216} 
    201217 
    202218void ProcessManager::slotRemProcFinished(){ 
    203219  if(remProc->exitStatus() != QProcess::NormalExit){ 
    204     QString msg = remProc->readAllStandardError(); 
    205     if(msg.isEmpty()){ msg = remProc->readAllStandardOutput(); } 
    206     if(msg.isEmpty()){ msg = tr("Unknown Error"); } 
    207     qDebug() << "Removal Process Error:"<<msg; 
    208     emit ProcessError(REMOVE, msg); 
     220    qDebug() << "Removal Process Error Log:\n"<<remLog.join("\n"); 
     221    emit ProcessError(REMOVE, remLog); 
    209222  }else{ 
    210223    qDebug() << "Removal Process Finished"; 
     
    217230  while( dlProc->canReadLine() ){ 
    218231    QString line = dlProc->readLine().simplified(); 
     232    if(line.isEmpty()){ continue; } 
    219233    QString dl = parseDlLine(line); 
    220234    if(!dl.isEmpty()){ emit ProcessMessage(DOWNLOAD,dl); } 
     235    else{ dlLog << line; } //not a download line - add to the log 
    221236  } 
    222237} 
     
    224239void ProcessManager::slotDlProcFinished(){ 
    225240  if(dlProc->exitStatus() != QProcess::NormalExit){ 
    226     QString msg = dlProc->readAllStandardError(); 
    227     if(msg.isEmpty()){ msg = dlProc->readAllStandardOutput(); } 
    228     if(msg.isEmpty()){ msg = tr("Unknown Error"); } 
    229     qDebug() << "Download Process Error:"<<msg; 
    230     emit ProcessError(DOWNLOAD, msg); 
     241    qDebug() << "Download Process Error Log:\n"<<dlLog.join("\n"); 
     242    emit ProcessError(DOWNLOAD, dlLog); 
    231243  }else{ 
    232244    qDebug() << "Download Process Finished"; 
     
    237249// == INSTALL PROCESS == 
    238250void ProcessManager::slotInProcMessage(){ 
    239   QString msg = inProc->readAllStandardOutput(); 
    240   emit ProcessMessage(INSTALL,msg); 
     251  while( inProc->canReadLine() ){ 
     252    QString line = inProc->readLine().simplified(); 
     253    if(!line.isEmpty()){  
     254      inLog << line;  
     255      emit ProcessMessage(INSTALL,line); 
     256    } 
     257  } 
    241258} 
    242259 
    243260void ProcessManager::slotInProcFinished(){ 
    244261  if(inProc->exitStatus() != QProcess::NormalExit){ 
    245     QString msg = inProc->readAllStandardError(); 
    246     if(msg.isEmpty()){ msg = inProc->readAllStandardOutput(); } 
    247     if(msg.isEmpty()){ msg = tr("Unknown Error"); } 
    248     qDebug() << "Install Process Error:"<<msg; 
    249     emit ProcessError(INSTALL, msg); 
     262    qDebug() << "Install Process Error Log:\n"<<inLog.join("\n"); 
     263    emit ProcessError(INSTALL, inLog); 
    250264  }else{ 
    251265    qDebug() << "Install Process Finished"; 
     
    266280    if(msg.isEmpty()){ msg = tr("Unknown Error"); } 
    267281    qDebug() << "Other Process Error:"<<msg; 
    268     emit ProcessError(OTHER, msg); 
     282    emit ProcessError(OTHER, QStringList(msg)); 
    269283  }else{ 
    270284    qDebug() << "Other Process Finished"; 
Note: See TracChangeset for help on using the changeset viewer.