summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/pmipkg.cpp
authortille <tille>2002-04-24 09:33:16 (UTC)
committer tille <tille>2002-04-24 09:33:16 (UTC)
commit8f67324fd1a60c165ae7043b9457f911b9690e43 (patch) (unidiff)
tree89956792ee33b839a463082e8a43bd1d919afaf9 /noncore/unsupported/oipkg/pmipkg.cpp
parentd3fe6dead3c84f1cd94b913c3c6c8657485d70a1 (diff)
downloadopie-8f67324fd1a60c165ae7043b9457f911b9690e43.zip
opie-8f67324fd1a60c165ae7043b9457f911b9690e43.tar.gz
opie-8f67324fd1a60c165ae7043b9457f911b9690e43.tar.bz2
fixed: ipkg c version issues
Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 681f2d4..94ca824 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -4,12 +4,13 @@
4#include "pksettings.h" 4#include "pksettings.h"
5#include "package.h" 5#include "package.h"
6#include "packagelistitem.h" 6#include "packagelistitem.h"
7 7
8#include <qpe/process.h> 8#include <qpe/process.h>
9#include <qpe/resource.h> 9#include <qpe/resource.h>
10#include <qpe/config.h>
10#include <qpe/stringutil.h> 11#include <qpe/stringutil.h>
11#include <qpe/qcopenvelope_qws.h> 12#include <qpe/qcopenvelope_qws.h>
12#include <qdir.h> 13#include <qdir.h>
13#include <qfile.h> 14#include <qfile.h>
14#include <qmultilineedit.h> 15#include <qmultilineedit.h>
15#include <qstring.h> 16#include <qstring.h>
@@ -20,12 +21,15 @@
20#include <unistd.h> 21#include <unistd.h>
21 22
22#include "mainwindow.h" 23#include "mainwindow.h"
23#include "runwindow.h" 24#include "runwindow.h"
24 25
25 26
27#define PARSE_FILELIST
28// #define IPKG_FILELIST
29
26PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) 30PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
27// : RunWindow ( p, name, f ) 31// : RunWindow ( p, name, f )
28 : QObject ( p ) 32 : QObject ( p )
29{ 33{
30 settings = s; 34 settings = s;
31 runwindow = new RunWindow ( p, name, f ); 35 runwindow = new RunWindow ( p, name, f );
@@ -49,13 +53,13 @@ int PmIpkg::runIpkg(const QString& args)
49#ifdef SYSTEM 53#ifdef SYSTEM
50 QString cmd = "/usr/bin/ipkg "; 54 QString cmd = "/usr/bin/ipkg ";
51#endif 55#endif
52 cmd += " -dest "+settings->getDestinationName(); 56 cmd += " -dest "+settings->getDestinationName();
53 cmd += " -force-defaults "; 57 cmd += " -force-defaults ";
54 58
55 out( "Starting to "+ args+"<br>\n"); 59 out( "<hr><br>Starting to "+ args+"<br>\n");
56 cmd += args; 60 cmd += args;
57 out( "running:<br>\n"+cmd+"<br>\n" ); 61 out( "running:<br>\n"+cmd+"<br>\n" );
58 int r = 0; 62 int r = 0;
59#ifdef PROC 63#ifdef PROC
60 QString o = "start"; 64 QString o = "start";
61 Process ipkg( cmd ); 65 Process ipkg( cmd );
@@ -63,12 +67,13 @@ int PmIpkg::runIpkg(const QString& args)
63 ipkg.exec("",o); 67 ipkg.exec("",o);
64 out( o ); 68 out( o );
65#endif 69#endif
66#ifdef SYSTEM 70#ifdef SYSTEM
67 QString redirect = "/tmp/oipkg.pipe"; 71 QString redirect = "/tmp/oipkg.pipe";
68 cmd += " | tee "+redirect+" 2>&1"; 72 cmd += " | tee "+redirect+" 2>&1";
73 pvDebug(2, "running >"+cmd+"<");
69 r = system(cmd.latin1()); 74 r = system(cmd.latin1());
70 QFile f( redirect ); 75 QFile f( redirect );
71 while ( ! f.open(IO_ReadOnly) ) {}; 76 while ( ! f.open(IO_ReadOnly) ) {};
72 // if ( f.open(IO_ReadOnly) ) {}; 77 // if ( f.open(IO_ReadOnly) ) {};
73 { 78 {
74 QTextStream t( &f ); 79 QTextStream t( &f );
@@ -82,33 +87,56 @@ int PmIpkg::runIpkg(const QString& args)
82 out( "Finished!<br>"); 87 out( "Finished!<br>");
83#endif 88#endif
84 89
85 return r; 90 return r;
86} 91}
87 92
88void PmIpkg::makeLinks(QString file) 93void PmIpkg::makeLinks(QString pack)
89{ 94{
95 pvDebug( 2, "PmIpkg::makeLinks "+ pack);
90 out( "<br>creating links<br>" ); 96 out( "<br>creating links<br>" );
91 QString dest = settings->getDestinationUrl(); 97 QString dest = settings->getDestinationUrl();
92 out("for package "+file+" in "+dest+"<br>"); 98 out("for package "+pack+" in "+dest+"<br>");
93 system(("ipkg -d "+dest+" files "+file+"> /tmp/oipkg.pipe 2>&1").latin1()); 99#ifdef IPKG_FILELIST
100 system(("ipkg -d "+dest+" files "+pack+"> /tmp/oipkg.pipe 2>&1").latin1());
94 QFile f( "/tmp/oipkg.pipe" ); 101 QFile f( "/tmp/oipkg.pipe" );
95 while ( ! f.open(IO_ReadOnly) ) {}; 102 while ( ! f.open(IO_ReadOnly) ) {};
103#endif
104#ifdef PARSE_FILELIST
105 {
106 Config cfg( "oipkg", Config::User );
107 cfg.setGroup( "Common" );
108 QString statusDir = cfg.readEntry( "statusDir", "" );
109 }
110 QString fn = dest+"/"+statusDir+"/info/"+pack+".list";
111 QFile f( fn );
112 if ( ! f.open(IO_ReadOnly) )
113 {
114 out( "<b>Panik!</b> Could not open:<br>"+fn );
115 };
116#endif
96 QTextStream t( &f ); 117 QTextStream t( &f );
97 QString fp; 118 QString fp;
98 while ( !t.eof() ) 119 while ( !t.eof() )
99 { 120 {
100 fp = t.readLine(); 121 fp = t.readLine();
101 processLinkDir( fp, dest ); 122 processLinkDir( fp, dest );
102 } 123 }
103 f.close(); 124 f.close();
104} 125}
105 126
106void PmIpkg::processLinkDir( QString file, QString dest ) 127void PmIpkg::processLinkDir( QString file, QString dest )
107{ 128{
129
130#ifdef PARSE_FILELIST
131 QString destFile = file;
132 file = dest+"/"+file;
133#endif
134#ifdef IPKG_FILELIST
108 QString destFile = file.right( file.length() - dest.length() ); 135 QString destFile = file.right( file.length() - dest.length() );
136#endif
109 QFileInfo fileInfo( file ); 137 QFileInfo fileInfo( file );
110 if ( fileInfo.isDir() ) 138 if ( fileInfo.isDir() )
111 { 139 {
112 QDir destDir( destFile ); 140 QDir destDir( destFile );
113 destDir.mkdir( destFile, true ); 141 destDir.mkdir( destFile, true );
114 QDir d( file ); 142 QDir d( file );