author | ar <ar> | 2004-05-02 21:32:48 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-02 21:32:48 (UTC) |
commit | 0a4cac124105a5732e55cb34c6b37be75083a395 (patch) (side-by-side diff) | |
tree | 33b4d2cab08c9b58893540b4ddee089b69fc9c61 /core/launcher/packageslave.cpp | |
parent | 109ed5f2a1cdfeb3680c9ec057a1083fcf8fab95 (diff) | |
download | opie-0a4cac124105a5732e55cb34c6b37be75083a395.zip opie-0a4cac124105a5732e55cb34c6b37be75083a395.tar.gz opie-0a4cac124105a5732e55cb34c6b37be75083a395.tar.bz2 |
- convert qWarning to owarn
Diffstat (limited to 'core/launcher/packageslave.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/packageslave.cpp | 191 |
1 files changed, 95 insertions, 96 deletions
diff --git a/core/launcher/packageslave.cpp b/core/launcher/packageslave.cpp index a11ac86..0461432 100644 --- a/core/launcher/packageslave.cpp +++ b/core/launcher/packageslave.cpp @@ -54,5 +54,5 @@ PackageHandler::PackageHandler( QObject *parent, char* name ) packageChannel = new QCopChannel( "QPE/Package", this ); connect( packageChannel, SIGNAL( received(const QCString&,const QByteArray&) ), - this, SLOT( qcopMessage(const QCString&,const QByteArray&) ) ); + this, SLOT( qcopMessage(const QCString&,const QByteArray&) ) ); #endif } @@ -67,28 +67,28 @@ void PackageHandler::qcopMessage( const QCString &msg, const QByteArray &data ) installPackage( file ); } else if ( msg == "removePackage(QString)" ) { - QString file; + QString file; stream >> file; removePackage( file ); } else if ( msg == "addPackageFiles(QString,QString)" ) { - QString location, listfile; + QString location, listfile; stream >> location >> listfile; addPackageFiles( location, listfile); } else if ( msg == "addPackages(QString)" ) { - QString location; + QString location; stream >> location; addPackages( location ); } else if ( msg == "cleanupPackageFiles(QString)" ) { - QString listfile; + QString listfile; stream >> listfile; - cleanupPackageFiles( listfile ); + cleanupPackageFiles( listfile ); } else if ( msg == "cleanupPackages(QString)" ) { - QString location; + QString location; stream >> location; cleanupPackages( location ); } else if ( msg == "prepareInstall(QString,QString)" ) { - QString size, path; - stream >> size; - stream >> path; - prepareInstall( size, path ); + QString size, path; + stream >> size; + stream >> path; + prepareInstall( size, path ); } } @@ -97,10 +97,10 @@ void PackageHandler::installPackage( const QString &package ) { if ( mNoSpaceLeft ) { - mNoSpaceLeft = FALSE; - // Don't emit that for now, I still couldn't test it (Wener) - //sendReply( "installFailed(QString)", package ); - //return; + mNoSpaceLeft = FALSE; + // Don't emit that for now, I still couldn't test it (Wener) + //sendReply( "installFailed(QString)", package ); + //return; } - + currentProcess = new QProcess( QStringList() << "ipkg" << "install" << package ); // No tr connect( currentProcess, SIGNAL( processExited() ), SLOT( iProcessExited() ) ); @@ -135,6 +135,6 @@ void PackageHandler::sendReply( const QCString& msg, const QString& arg ) } -void PackageHandler::addPackageFiles( const QString &location, - const QString &listfile ) +void PackageHandler::addPackageFiles( const QString &location, + const QString &listfile ) { QFile f(listfile); @@ -145,42 +145,41 @@ void PackageHandler::addPackageFiles( const QString &location, #else QDir d; - //#### revise + //#### revise odebug << "Copy file at " << __FILE__ << ": " << __LINE__ << "" << oendl; - d.mkdir(("/usr/lib/ipkg/info/" + location).ascii()); + d.mkdir(("/usr/lib/ipkg/info/" + location).ascii()); system(("copy " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); #endif - - if ( f.open(IO_ReadOnly) ) { - QTextStream ts(&f); - QString s; - while ( !ts.eof() ) { // until end of file... - s = ts.readLine(); // line of text excluding '\n' - // for s, do link/mkdir. - if ( s.right(1) == "/" ) { + if ( f.open(IO_ReadOnly) ) { + QTextStream ts(&f); + + QString s; + while ( !ts.eof() ) { // until end of file... + s = ts.readLine(); // line of text excluding '\n' + // for s, do link/mkdir. + if ( s.right(1) == "/" ) { odebug << "do mkdir for " << s.ascii() << "" << oendl; #ifndef Q_OS_WIN32 - mkdir( s.ascii(), 0777 ); - //possible optimization: symlink directories - //that don't exist already. -- Risky. + mkdir( s.ascii(), 0777 ); + //possible optimization: symlink directories + //that don't exist already. -- Risky. #else - d.mkdir( s.ascii()); + d.mkdir( s.ascii()); #endif - } else { + } else { #ifndef Q_OS_WIN32 odebug << "do symlink for " << s.ascii() << "" << oendl; - symlink( (location + s).ascii(), s.ascii() ); + symlink( (location + s).ascii(), s.ascii() ); #else odebug << "Copy file instead of a symlink for WIN32" << oendl; - if (!CopyFile((TCHAR*)qt_winTchar((location + s), TRUE), (TCHAR*)qt_winTchar(s, TRUE), FALSE)) - qWarning("Unable to create symlinkfor %s", - (location + s).ascii()); + if (!CopyFile((TCHAR*)qt_winTchar((location + s), TRUE), (TCHAR*)qt_winTchar(s, TRUE), FALSE)) + owarn << "Unable to create symlinkfor " << (location + s).ascii() << oendl; #endif - } - } - f.close(); - } + } + } + f.close(); + } } @@ -189,12 +188,12 @@ void PackageHandler::addPackages( const QString &location ) // get list of *.list in location/usr/lib/ipkg/info/*.list QDir dir(location + "/usr/lib/ipkg/info", "*.list", // No tr - QDir::Name, QDir::Files); + QDir::Name, QDir::Files); if ( !dir.exists() ) - return; - + return; + QStringList packages = dir.entryList(); for ( QStringList::Iterator it = packages.begin(); - it != packages.end(); ++it ) { - addPackageFiles( location, *it ); + it != packages.end(); ++it ) { + addPackageFiles( location, *it ); } } @@ -204,33 +203,33 @@ void PackageHandler::cleanupPackageFiles( const QString &listfile ) { QFile f(listfile); - - if ( f.open(IO_ReadOnly) ) { - QTextStream ts(&f); - - QString s; - while ( !ts.eof() ) { // until end of file... - s = ts.readLine(); // line of text excluding '\n' - // for s, do link/mkdir. - if ( s.right(1) == "/" ) { - //should rmdir if empty, after all files have been removed - } else { + + if ( f.open(IO_ReadOnly) ) { + QTextStream ts(&f); + + QString s; + while ( !ts.eof() ) { // until end of file... + s = ts.readLine(); // line of text excluding '\n' + // for s, do link/mkdir. + if ( s.right(1) == "/" ) { + //should rmdir if empty, after all files have been removed + } else { #ifndef Q_OS_WIN32 odebug << "remove symlink for " << s.ascii() << "" << oendl; - //check if it is a symlink first (don't remove /etc/passwd...) - char buf[10]; //we don't care about the contents - if ( ::readlink( s.ascii(),buf, 10 >= 0 ) ) - ::unlink( s.ascii() ); -#else - // ### revise + //check if it is a symlink first (don't remove /etc/passwd...) + char buf[10]; //we don't care about the contents + if ( ::readlink( s.ascii(),buf, 10 >= 0 ) ) + ::unlink( s.ascii() ); +#else + // ### revise owarn << "Unable to remove symlink " << __FILE__ << ":" << __LINE__ << "" << oendl; #endif - } - } - f.close(); + } + } + f.close(); //remove the list file - ::unlink( listfile.ascii() ); - - } + ::unlink( listfile.ascii() ); + + } } @@ -239,15 +238,15 @@ void PackageHandler::cleanupPackages( const QString &location ) // get list of *.list in location/usr/lib/ipkg/info/*.list QDir dir( "/usr/lib/ipkg/info/"+location, "*.list", // No tr - QDir::Name, QDir::Files); + QDir::Name, QDir::Files); if ( !dir.exists() ) - return; - + return; + QStringList packages = dir.entryList(); for ( QStringList::Iterator it = packages.begin(); - it != packages.end(); ++it ) { - cleanupPackageFiles( *it ); + it != packages.end(); ++it ) { + cleanupPackageFiles( *it ); } - - //remove the backup directory + + //remove the backup directory //### } @@ -258,7 +257,7 @@ void PackageHandler::prepareInstall( const QString& size, const QString& path ) bool ok; unsigned int s = size.toUInt( &ok ); - + if ( !ok ) - return; + return; // Shamelessly stolen from the sysinfo application (Werner) @@ -266,8 +265,8 @@ void PackageHandler::prepareInstall( const QString& size, const QString& path ) struct statfs fs; if ( statfs( path.latin1(), &fs ) == 0 ) - if ( s > fs.f_bsize * fs.f_bavail ) { + if ( s > fs.f_bsize * fs.f_bavail ) { //odebug << "############### Not enough space left ###############" << oendl; - mNoSpaceLeft = TRUE; - } + mNoSpaceLeft = TRUE; + } #endif } @@ -276,13 +275,13 @@ void PackageHandler::iProcessExited() { if ( currentProcess->normalExit() && currentProcess->exitStatus() == 0 ) - sendReply( "installDone(QString)", currentPackage ); + sendReply( "installDone(QString)", currentPackage ); else { #ifndef QT_NO_COP - QCopEnvelope e( "QPE/Desktop", "installFailed(QString,int,QString)" ); - e << currentPackage << currentProcess->exitStatus() - << currentProcessError; + QCopEnvelope e( "QPE/Desktop", "installFailed(QString,int,QString)" ); + e << currentPackage << currentProcess->exitStatus() + << currentProcessError; #endif } - + delete currentProcess; currentProcess = 0; @@ -299,7 +298,7 @@ void PackageHandler::rmProcessExited() { if ( currentProcess->normalExit() && currentProcess->exitStatus() == 0 ) - sendReply( "removeDone(QString)", currentPackage ); + sendReply( "removeDone(QString)", currentPackage ); else - sendReply( "removeFailed(QString)", currentPackage ); + sendReply( "removeFailed(QString)", currentPackage ); #ifndef QT_NO_COP @@ -313,10 +312,10 @@ void PackageHandler::readyReadStdout() { while ( currentProcess->canReadLineStdout() ) { - QString line = currentProcess->readLineStdout(); - currentProcessError.append("OUT:"+line); - if ( line.contains( "Unpacking" ) ) // No tr - sendReply( "installStep(QString)", "one" ); // No tr - else if ( line.contains( "Configuring" ) ) // No tr - sendReply( "installStep(QString)", "two" ); // No tr + QString line = currentProcess->readLineStdout(); + currentProcessError.append("OUT:"+line); + if ( line.contains( "Unpacking" ) ) // No tr + sendReply( "installStep(QString)", "one" ); // No tr + else if ( line.contains( "Configuring" ) ) // No tr + sendReply( "installStep(QString)", "two" ); // No tr } } @@ -325,6 +324,6 @@ void PackageHandler::readyReadStderr() { while ( currentProcess->canReadLineStderr() ) { - QString line = currentProcess->readLineStderr(); - currentProcessError.append("ERR:"+line); + QString line = currentProcess->readLineStderr(); + currentProcessError.append("ERR:"+line); } } |