summaryrefslogtreecommitdiff
path: root/core/launcher/packageslave.cpp
Unidiff
Diffstat (limited to 'core/launcher/packageslave.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/packageslave.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/core/launcher/packageslave.cpp b/core/launcher/packageslave.cpp
index 7e61b0e..a11ac86 100644
--- a/core/launcher/packageslave.cpp
+++ b/core/launcher/packageslave.cpp
@@ -16,34 +16,34 @@
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "packageslave.h" 21#include "packageslave.h"
22#include <qtopia/qprocess.h>
23 22
23/* OPIE */
24#include <opie2/odebug.h>
25#include <qtopia/qprocess.h>
24#ifdef Q_WS_QWS 26#ifdef Q_WS_QWS
25#include <qtopia/qcopenvelope_qws.h> 27#include <qtopia/qcopenvelope_qws.h>
26#endif 28#endif
29using namespace Opie::Core;
27 30
31/* QT */
28#ifdef Q_WS_QWS 32#ifdef Q_WS_QWS
29#include <qcopchannel_qws.h> 33#include <qcopchannel_qws.h>
30#endif 34#endif
31
32#include <qtextstream.h> 35#include <qtextstream.h>
33 36
37/* STD */
34#include <stdlib.h> 38#include <stdlib.h>
35#include <sys/stat.h> // mkdir() 39#include <sys/stat.h> // mkdir()
36
37#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 40#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
38#include <unistd.h> 41#include <unistd.h>
39#include <sys/vfs.h> 42#include <sys/vfs.h>
40#include <mntent.h> 43#include <mntent.h>
41#elif defined(Q_OS_WIN32)
42#include <windows.h>
43#include <winbase.h>
44#elif defined(Q_OS_MACX) 44#elif defined(Q_OS_MACX)
45#include <unistd.h> 45#include <unistd.h>
46#endif 46#endif
47 47
48 48
49PackageHandler::PackageHandler( QObject *parent, char* name ) 49PackageHandler::PackageHandler( QObject *parent, char* name )
@@ -142,13 +142,13 @@ void PackageHandler::addPackageFiles( const QString &location,
142 //make a copy so we can remove the symlinks later 142 //make a copy so we can remove the symlinks later
143 mkdir( ("/usr/lib/ipkg/info/"+location).ascii(), 0777 ); 143 mkdir( ("/usr/lib/ipkg/info/"+location).ascii(), 0777 );
144 system(("cp " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); 144 system(("cp " + f.name() + " /usr/lib/ipkg/info/"+location).ascii());
145#else 145#else
146 QDir d; 146 QDir d;
147 //#### revise 147 //#### revise
148 qDebug("Copy file at %s: %s", __FILE__, __LINE__ ); 148 odebug << "Copy file at " << __FILE__ << ": " << __LINE__ << "" << oendl;
149 d.mkdir(("/usr/lib/ipkg/info/" + location).ascii()); 149 d.mkdir(("/usr/lib/ipkg/info/" + location).ascii());
150 system(("copy " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); 150 system(("copy " + f.name() + " /usr/lib/ipkg/info/"+location).ascii());
151#endif 151#endif
152 152
153 153
154 if ( f.open(IO_ReadOnly) ) { 154 if ( f.open(IO_ReadOnly) ) {
@@ -156,27 +156,27 @@ void PackageHandler::addPackageFiles( const QString &location,
156 156
157 QString s; 157 QString s;
158 while ( !ts.eof() ) { // until end of file... 158 while ( !ts.eof() ) { // until end of file...
159 s = ts.readLine(); // line of text excluding '\n' 159 s = ts.readLine(); // line of text excluding '\n'
160 // for s, do link/mkdir. 160 // for s, do link/mkdir.
161 if ( s.right(1) == "/" ) { 161 if ( s.right(1) == "/" ) {
162 qDebug("do mkdir for %s", s.ascii()); 162 odebug << "do mkdir for " << s.ascii() << "" << oendl;
163#ifndef Q_OS_WIN32 163#ifndef Q_OS_WIN32
164 mkdir( s.ascii(), 0777 ); 164 mkdir( s.ascii(), 0777 );
165 //possible optimization: symlink directories 165 //possible optimization: symlink directories
166 //that don't exist already. -- Risky. 166 //that don't exist already. -- Risky.
167#else 167#else
168 d.mkdir( s.ascii()); 168 d.mkdir( s.ascii());
169#endif 169#endif
170 170
171 } else { 171 } else {
172#ifndef Q_OS_WIN32 172#ifndef Q_OS_WIN32
173 qDebug("do symlink for %s", s.ascii()); 173 odebug << "do symlink for " << s.ascii() << "" << oendl;
174 symlink( (location + s).ascii(), s.ascii() ); 174 symlink( (location + s).ascii(), s.ascii() );
175#else 175#else
176 qDebug("Copy file instead of a symlink for WIN32"); 176 odebug << "Copy file instead of a symlink for WIN32" << oendl;
177 if (!CopyFile((TCHAR*)qt_winTchar((location + s), TRUE), (TCHAR*)qt_winTchar(s, TRUE), FALSE)) 177 if (!CopyFile((TCHAR*)qt_winTchar((location + s), TRUE), (TCHAR*)qt_winTchar(s, TRUE), FALSE))
178 qWarning("Unable to create symlinkfor %s", 178 qWarning("Unable to create symlinkfor %s",
179 (location + s).ascii()); 179 (location + s).ascii());
180#endif 180#endif
181 } 181 }
182 } 182 }
@@ -212,20 +212,20 @@ void PackageHandler::cleanupPackageFiles( const QString &listfile )
212 s = ts.readLine(); // line of text excluding '\n' 212 s = ts.readLine(); // line of text excluding '\n'
213 // for s, do link/mkdir. 213 // for s, do link/mkdir.
214 if ( s.right(1) == "/" ) { 214 if ( s.right(1) == "/" ) {
215 //should rmdir if empty, after all files have been removed 215 //should rmdir if empty, after all files have been removed
216 } else { 216 } else {
217#ifndef Q_OS_WIN32 217#ifndef Q_OS_WIN32
218 qDebug("remove symlink for %s", s.ascii()); 218 odebug << "remove symlink for " << s.ascii() << "" << oendl;
219 //check if it is a symlink first (don't remove /etc/passwd...) 219 //check if it is a symlink first (don't remove /etc/passwd...)
220 char buf[10]; //we don't care about the contents 220 char buf[10]; //we don't care about the contents
221 if ( ::readlink( s.ascii(),buf, 10 >= 0 ) ) 221 if ( ::readlink( s.ascii(),buf, 10 >= 0 ) )
222 ::unlink( s.ascii() ); 222 ::unlink( s.ascii() );
223 #else 223 #else
224 // ### revise 224 // ### revise
225 qWarning("Unable to remove symlink %s:%s", __FILE__, __LINE__); 225 owarn << "Unable to remove symlink " << __FILE__ << ":" << __LINE__ << "" << oendl;
226#endif 226#endif
227 } 227 }
228 } 228 }
229 f.close(); 229 f.close();
230 230
231 //remove the list file 231 //remove the list file
@@ -263,13 +263,13 @@ void PackageHandler::prepareInstall( const QString& size, const QString& path )
263 263
264 // Shamelessly stolen from the sysinfo application (Werner) 264 // Shamelessly stolen from the sysinfo application (Werner)
265#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 265#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
266 struct statfs fs; 266 struct statfs fs;
267 if ( statfs( path.latin1(), &fs ) == 0 ) 267 if ( statfs( path.latin1(), &fs ) == 0 )
268 if ( s > fs.f_bsize * fs.f_bavail ) { 268 if ( s > fs.f_bsize * fs.f_bavail ) {
269 //qDebug("############### Not enough space left ###############"); 269 //odebug << "############### Not enough space left ###############" << oendl;
270 mNoSpaceLeft = TRUE; 270 mNoSpaceLeft = TRUE;
271 } 271 }
272#endif 272#endif
273} 273}
274 274
275void PackageHandler::iProcessExited() 275void PackageHandler::iProcessExited()