summaryrefslogtreecommitdiff
authordrw <drw>2003-04-23 01:04:02 (UTC)
committer drw <drw>2003-04-23 01:04:02 (UTC)
commit43b2c74f7d32ce9c744e4d79e62a92e0181604c3 (patch) (unidiff)
tree894049bfdc5724ea167f3dbc437cf0d18b93f3c1
parent509ac60dfd2e0829f56fb65407ddbe57f7668d70 (diff)
downloadopie-43b2c74f7d32ce9c744e4d79e62a92e0181604c3.zip
opie-43b2c74f7d32ce9c744e4d79e62a92e0181604c3.tar.gz
opie-43b2c74f7d32ce9c744e4d79e62a92e0181604c3.tar.bz2
Fix for bug #864 and some other code tweaks to reduce executable size
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp80
1 files changed, 46 insertions, 34 deletions
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index 7df643e..e906653 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -174,3 +174,2 @@ bool Ipkg :: runIpkg( )
174 return ret; 174 return ret;
175
176} 175}
@@ -181,5 +180,6 @@ void Ipkg :: removeStatusEntry()
181 if ( statusFile.right( 1 ) != "/" ) 180 if ( statusFile.right( 1 ) != "/" )
182 statusFile += "/"; 181 statusFile.append( "/" );
183 statusFile += "usr/lib/ipkg/status"; 182 statusFile.append( "usr/lib/ipkg/status" );
184 QString outStatusFile = statusFile + ".tmp"; 183 QString outStatusFile = statusFile;
184 outStatusFile.append( ".tmp" );
185 185
@@ -187,4 +187,8 @@ void Ipkg :: removeStatusEntry()
187 emit outputText( "Removing status entry..." ); 187 emit outputText( "Removing status entry..." );
188 emit outputText( QString( "status file - " )+ statusFile ); 188 QString tempstr = "status file - ";
189 emit outputText( QString( "package - " )+ package ); 189 tempstr.append( statusFile );
190 emit outputText( tempstr );
191 tempstr = "package - ";
192 tempstr.append( package );
193 emit outputText( tempstr );
190 194
@@ -194,3 +198,5 @@ void Ipkg :: removeStatusEntry()
194 { 198 {
195 emit outputText( QString( "Couldn't open status file - " )+ statusFile ); 199 tempstr = "Couldn't open status file - ";
200 tempstr.append( statusFile );
201 emit outputText( tempstr );
196 return; 202 return;
@@ -200,3 +206,5 @@ void Ipkg :: removeStatusEntry()
200 { 206 {
201 emit outputText( QString( "Couldn't create tempory status file - " )+ outStatusFile ); 207 tempstr = "Couldn't create tempory status file - ";
208 tempstr.append( outStatusFile );
209 emit outputText( tempstr );
202 return; 210 return;
@@ -236,3 +244,3 @@ void Ipkg :: removeStatusEntry()
236 lines.push_back( QString( line ) ); 244 lines.push_back( QString( line ) );
237// out << line << endl; 245 out << line << endl;
238 } while ( !in.eof() ); 246 } while ( !in.eof() );
@@ -243,3 +251,2 @@ void Ipkg :: removeStatusEntry()
243 { 251 {
244 cout << "Writing " << (const char *)(*it) << endl;
245 out << (const char *)(*it) << endl; 252 out << (const char *)(*it) << endl;
@@ -281,6 +288,4 @@ int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ )
281 { 288 {
282 qDebug( "%s ", (*it).latin1() );
283 *proc << (*it).latin1(); 289 *proc << (*it).latin1();
284 } 290 }
285 cout << endl;
286 291
@@ -291,3 +296,2 @@ int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ )
291 emit outputText( QString( "Couldn't start ipkg process" ) ); 296 emit outputText( QString( "Couldn't start ipkg process" ) );
292 qDebug( "Couldn't start ipkg process!" );
293 } 297 }
@@ -301,4 +305,2 @@ void Ipkg::commandStdout(OProcess*, char *buffer, int buflen)
301{ 305{
302 qDebug("received stdout %d bytes", buflen);
303
304 QString lineStr = buffer; 306 QString lineStr = buffer;
@@ -322,4 +324,9 @@ void Ipkg::commandStdout(OProcess*, char *buffer, int buflen)
322 } 324 }
325 else if ( option == "remove" && !( flags & FORCE_DEPENDS ) &&
326 lineStr.find( "is depended upon by packages:" ) != -1 )
327 {
328 // Ipkg should send this to STDERR, but doesn't - so trap here
329 error = true;
330 }
323 331
324 qDebug(lineStr);
325 buffer[0] = '\0'; 332 buffer[0] = '\0';
@@ -329,4 +336,2 @@ void Ipkg::commandStderr(OProcess*, char *buffer, int buflen)
329{ 336{
330 qDebug("received stderrt %d bytes", buflen);
331
332 QString lineStr = buffer; 337 QString lineStr = buffer;
@@ -344,2 +349,3 @@ void Ipkg::processFinished()
344 // to workaround an ipkg bug which stops reinstall to a different location 349 // to workaround an ipkg bug which stops reinstall to a different location
350
345 if ( !error && option == "remove" ) 351 if ( !error && option == "remove" )
@@ -373,3 +379,2 @@ int Ipkg :: executeIpkgCommand( QString &cmd, const QString option )
373 { 379 {
374 cout << "Couldn't execute " << cmd << "! err = " << fp << endl;
375 QString text; 380 QString text;
@@ -443,6 +448,8 @@ QStringList* Ipkg :: getList( const QString &packageFilename, const QString &des
443{ 448{
444 QString packageFileDir = destDir+"/usr/lib/ipkg/info/"+packageFilename+".list"; 449 QString packageFileDir = destDir;
450 packageFileDir.append( "/usr/lib/ipkg/info/" );
451 packageFileDir.append( packageFilename );
452 packageFileDir.append( ".list" );
445 QFile f( packageFileDir ); 453 QFile f( packageFileDir );
446 454
447 cout << "Try to open " << packageFileDir << endl;
448 if ( !f.open(IO_ReadOnly) ) 455 if ( !f.open(IO_ReadOnly) )
@@ -450,12 +457,13 @@ QStringList* Ipkg :: getList( const QString &packageFilename, const QString &des
450 // Couldn't open from dest, try from / 457 // Couldn't open from dest, try from /
451 cout << "Could not open:" << packageFileDir << endl;
452 f.close(); 458 f.close();
453 459
454 packageFileDir = "/usr/lib/ipkg/info/"+packageFilename+".list"; 460 packageFileDir = "/usr/lib/ipkg/info/";
461 packageFileDir.append( packageFilename );
462 packageFileDir.append( ".list" );
455 f.setName( packageFileDir ); 463 f.setName( packageFileDir );
456 qDebug( "Try to open %s", packageFileDir.latin1() );
457 if ( ! f.open(IO_ReadOnly) ) 464 if ( ! f.open(IO_ReadOnly) )
458 { 465 {
459 qDebug( "Could not open: %s", packageFileDir.latin1() ); 466 QString tempstr = "Could not open :";
460 emit outputText( QString( "Could not open :" ) + packageFileDir ); 467 tempstr.append( packageFileDir );
468 emit outputText( tempstr );
461 return (QStringList*)0; 469 return (QStringList*)0;
@@ -500,3 +508,4 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const
500 508
501 QString sourceFile = baseDir + file; 509 QString sourceFile = baseDir;
510 sourceFile.append( file );
502 511
@@ -505,3 +514,3 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const
505 { 514 {
506 linkFile += file.mid( 1 ); 515 linkFile.append( file.mid( 1 ) );
507 } 516 }
@@ -509,3 +518,3 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const
509 { 518 {
510 linkFile += file; 519 linkFile.append( file );
511 } 520 }
@@ -521,3 +530,5 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const
521 { 530 {
522 emit outputText( QString( "Creating directory " ) + linkFile ); 531 QString tempstr = "Creating directory ";
532 tempstr.append( linkFile );
533 emit outputText( tempstr );
523 QDir d; 534 QDir d;
@@ -533,3 +544,5 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const
533 text = (rc == 0 ? "Linked " : "Failed to link "); 544 text = (rc == 0 ? "Linked " : "Failed to link ");
534 text += sourceFile + " to " + linkFile; 545 text.append( sourceFile );
546 text.append( " to " );
547 text.append( linkFile );
535 emit outputText( text ); 548 emit outputText( text );
@@ -548,3 +561,3 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const
548 text = (rc ? "Removed " : "Failed to remove "); 561 text = (rc ? "Removed " : "Failed to remove ");
549 text += linkFile; 562 text.append( linkFile );
550 emit outputText( text ); 563 emit outputText( text );
@@ -558,3 +571,3 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const
558 text = (rc ? "Removed " : "Failed to remove "); 571 text = (rc ? "Removed " : "Failed to remove ");
559 text += linkFile; 572 text.append( linkFile );
560 emit outputText( text ); 573 emit outputText( text );
@@ -564,3 +577,2 @@ void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const
564 } 577 }
565
566} 578}