-rw-r--r-- | noncore/settings/packagemanager/.cvsignore | 2 | ||||
-rw-r--r-- | noncore/settings/packagemanager/ChangeLog | 7 | ||||
-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 76 | ||||
-rw-r--r-- | noncore/settings/packagemanager/installdlg.h | 4 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 6 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkg.cpp | 188 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkg.h | 17 | ||||
-rw-r--r-- | noncore/settings/packagemanager/opackagemanager.cpp | 11 | ||||
-rw-r--r-- | noncore/settings/packagemanager/opackagemanager.h | 4 | ||||
-rw-r--r-- | noncore/settings/packagemanager/opie-packagemanager.control | 2 | ||||
-rw-r--r-- | noncore/settings/packagemanager/packagemanager.pro | 9 |
11 files changed, 135 insertions, 191 deletions
diff --git a/noncore/settings/packagemanager/.cvsignore b/noncore/settings/packagemanager/.cvsignore index 4183697..9f2b524 100644 --- a/noncore/settings/packagemanager/.cvsignore +++ b/noncore/settings/packagemanager/.cvsignore | |||
@@ -1,3 +1,5 @@ | |||
1 | Makefile* | 1 | Makefile* |
2 | moc* | 2 | moc* |
3 | .moc* | 3 | .moc* |
4 | .obj | ||
5 | .moc | ||
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog index a01c8b3..1ba12af 100644 --- a/noncore/settings/packagemanager/ChangeLog +++ b/noncore/settings/packagemanager/ChangeLog | |||
@@ -1,4 +1,9 @@ | |||
1 | 2004-01-nn Dan Williams <drw@handhelds.org> | 1 | 2004-01-20 Dan Williams <drw@handhelds.org> |
2 | |||
3 | * Released version 0.2.0 | ||
4 | * Converted to use libipkg in place of spawning ipkg process | ||
5 | |||
6 | 2004-01-13 Dan Williams <drw@handhelds.org> | ||
2 | 7 | ||
3 | * Released version 0.1.0 | 8 | * Released version 0.1.0 |
4 | * Initial check-in of new package management client to eventually replace AQPkg | 9 | * Initial check-in of new package management client to eventually replace AQPkg |
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 980d5eb..6a9ccbd 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp | |||
@@ -206,8 +206,7 @@ void InstallDlg::slotBtnStart() | |||
206 | QString btnText = m_btnStart->text(); | 206 | QString btnText = m_btnStart->text(); |
207 | if ( btnText == tr( "Abort" ) ) | 207 | if ( btnText == tr( "Abort" ) ) |
208 | { | 208 | { |
209 | // Stop execution of current command and prevent any others from executing | 209 | // Prevent unexecuted commands from executing |
210 | m_packman->abortCommand(); | ||
211 | m_currCommand = 999; | 210 | m_currCommand = 999; |
212 | 211 | ||
213 | // Allow user to close dialog | 212 | // Allow user to close dialog |
@@ -222,17 +221,37 @@ void InstallDlg::slotBtnStart() | |||
222 | return; | 221 | return; |
223 | } | 222 | } |
224 | 223 | ||
225 | // Start was clicked, execute first command | 224 | // Start was clicked, start executing |
226 | m_btnOptions->setEnabled( false ); | 225 | m_btnOptions->setEnabled( false ); |
227 | m_btnStart->setText( tr( "Abort" ) ); | 226 | if ( m_numCommands > 1 ) |
228 | m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); | 227 | { |
228 | m_btnStart->setText( tr( "Abort" ) ); | ||
229 | m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); | ||
230 | } | ||
231 | else | ||
232 | { | ||
233 | m_btnStart->setEnabled( false ); | ||
234 | } | ||
229 | 235 | ||
230 | QString dest; | 236 | QString dest; |
231 | if ( m_destination ) | 237 | if ( m_destination ) |
232 | dest = m_destination->currentText(); | 238 | dest = m_destination->currentText(); |
233 | m_packman->executeCommand( m_command[ 0 ], m_packages[ 0 ], dest, this, | 239 | |
234 | SLOT(slotOutput(OProcess*,char*,int)), SLOT(slotErrors(OProcess*,char*,int)), | 240 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) |
235 | SLOT(slotFinished(OProcess*)), true ); | 241 | { |
242 | // Execute next command | ||
243 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, | ||
244 | this, SLOT(slotOutput(char*)), true ); | ||
245 | } | ||
246 | |||
247 | // All commands executed, allow user to close dialog | ||
248 | m_btnStart->setEnabled( true ); | ||
249 | m_btnStart->setText( tr( "Close" ) ); | ||
250 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); | ||
251 | |||
252 | m_btnOptions->setEnabled( true ); | ||
253 | m_btnOptions->setText( tr( "Save output" ) ); | ||
254 | m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); | ||
236 | } | 255 | } |
237 | 256 | ||
238 | void InstallDlg::slotBtnOptions() | 257 | void InstallDlg::slotBtnOptions() |
@@ -267,43 +286,14 @@ void InstallDlg::slotBtnOptions() | |||
267 | } | 286 | } |
268 | } | 287 | } |
269 | 288 | ||
270 | void InstallDlg::slotOutput( OProcess */*process*/, char *buffer, int buffLen ) | 289 | void InstallDlg::slotOutput( char *msg ) |
271 | { | 290 | { |
272 | QString lineStr = buffer; | 291 | // Allow processing of other events |
273 | if ( lineStr[buffLen-1] == '\n' ) | 292 | qApp->processEvents(); |
274 | lineStr.truncate( buffLen - 1 ); | ||
275 | m_output->append( lineStr ); | ||
276 | m_output->setCursorPosition( m_output->numLines(), 0 ); | ||
277 | } | ||
278 | 293 | ||
279 | void InstallDlg::slotErrors( OProcess */*process*/, char *buffer, int buffLen ) | 294 | QString lineStr = msg; |
280 | { | 295 | if ( lineStr[lineStr.length()-1] == '\n' ) |
281 | QString lineStr = buffer; | 296 | lineStr.truncate( lineStr.length() - 1 ); |
282 | if ( lineStr[buffLen-1] == '\n' ) | ||
283 | lineStr.truncate( buffLen - 1 ); | ||
284 | m_output->append( lineStr ); | 297 | m_output->append( lineStr ); |
285 | m_output->setCursorPosition( m_output->numLines(), 0 ); | 298 | m_output->setCursorPosition( m_output->numLines(), 0 ); |
286 | } | 299 | } |
287 | |||
288 | void InstallDlg::slotFinished( OProcess */*process*/ ) | ||
289 | { | ||
290 | ++m_currCommand; | ||
291 | if ( m_currCommand < m_numCommands ) | ||
292 | { | ||
293 | // More commands left, execute next one | ||
294 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], m_destination->currentText(), | ||
295 | this, SLOT(slotOutput(OProcess*,char*,int)), | ||
296 | SLOT(slotErrors(OProcess*,char*,int)), | ||
297 | SLOT(slotFinished(OProcess*)), true ); | ||
298 | } | ||
299 | else | ||
300 | { | ||
301 | // All commands executed, allow user to close dialog | ||
302 | m_btnStart->setText( tr( "Close" ) ); | ||
303 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); | ||
304 | |||
305 | m_btnOptions->setEnabled( true ); | ||
306 | m_btnOptions->setText( tr( "Save output" ) ); | ||
307 | m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); | ||
308 | } | ||
309 | } | ||
diff --git a/noncore/settings/packagemanager/installdlg.h b/noncore/settings/packagemanager/installdlg.h index 8075f1d..7efe721 100644 --- a/noncore/settings/packagemanager/installdlg.h +++ b/noncore/settings/packagemanager/installdlg.h | |||
@@ -78,9 +78,7 @@ private slots: | |||
78 | void slotBtnOptions(); | 78 | void slotBtnOptions(); |
79 | 79 | ||
80 | // Execution slots | 80 | // Execution slots |
81 | void slotOutput( OProcess *process, char *buffer, int buffLen ); | 81 | void slotOutput( char *msg ); |
82 | void slotErrors( OProcess *process, char *buffer, int buffLen ); | ||
83 | void slotFinished( OProcess *process ); | ||
84 | 82 | ||
85 | signals: | 83 | signals: |
86 | void closeInstallDlg(); | 84 | void closeInstallDlg(); |
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 311b5fc..4611404 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp | |||
@@ -162,8 +162,7 @@ void MainWindow::initUI() | |||
162 | actionUpgrade->addTo( popup ); | 162 | actionUpgrade->addTo( popup ); |
163 | actionUpgrade->addTo( &m_toolBar ); | 163 | actionUpgrade->addTo( &m_toolBar ); |
164 | 164 | ||
165 | // Ipkg implementation does not seem to work currently? (not working in aqpkg either) | 165 | /* |
166 | /* | ||
167 | QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); | 166 | QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); |
168 | QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); | 167 | QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); |
169 | QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); | 168 | QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
@@ -171,7 +170,7 @@ void MainWindow::initUI() | |||
171 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); | 170 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); |
172 | actionDownload->addTo( popup ); | 171 | actionDownload->addTo( popup ); |
173 | actionDownload->addTo( &m_toolBar ); | 172 | actionDownload->addTo( &m_toolBar ); |
174 | */ | 173 | */ |
175 | 174 | ||
176 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); | 175 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); |
177 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); | 176 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); |
@@ -371,7 +370,6 @@ void MainWindow::slotUpgrade() | |||
371 | m_widgetStack.raiseWidget( dlg ); | 370 | m_widgetStack.raiseWidget( dlg ); |
372 | } | 371 | } |
373 | 372 | ||
374 | // Ipkg implementation does not seem to work currently? (not working in aqpkg either) | ||
375 | /* | 373 | /* |
376 | void MainWindow::slotDownload() | 374 | void MainWindow::slotDownload() |
377 | { | 375 | { |
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp index 13f3d7d..eeb0131 100644 --- a/noncore/settings/packagemanager/oipkg.cpp +++ b/noncore/settings/packagemanager/oipkg.cpp | |||
@@ -31,29 +31,48 @@ | |||
31 | 31 | ||
32 | #include "oipkg.h" | 32 | #include "oipkg.h" |
33 | 33 | ||
34 | #include <stdio.h> | 34 | #include <stdlib.h> |
35 | #include <string.h> | ||
35 | 36 | ||
36 | #include <qdir.h> | 37 | #include <qdir.h> |
37 | #include <qfile.h> | 38 | #include <qfile.h> |
39 | #include <qmessagebox.h> | ||
38 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
39 | 41 | ||
40 | #include <opie/oprocess.h> | ||
41 | |||
42 | const QString IPKG_EXEC = "ipkg"; // Fully-qualified name of Ipkg executable | ||
43 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file | 42 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file |
44 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files | 43 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files |
45 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists | 44 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists |
46 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location | 45 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location |
47 | 46 | ||
47 | OIpkg *oipkg; | ||
48 | |||
49 | int fIpkgMessage( ipkg_conf_t */*conf*/, message_level_t /*level*/, char *msg ) | ||
50 | { | ||
51 | oipkg->ipkgOutput( msg ); | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | char* fIpkgResponse( char */*question*/ ) | ||
56 | { | ||
57 | return 0x0; | ||
58 | } | ||
59 | |||
48 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) | 60 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) |
49 | : QObject( parent, name ) | 61 | : QObject( parent, name ) |
50 | , m_config( config ) | 62 | , m_config( config ) |
51 | , m_ipkgExec( IPKG_EXEC ) // TODO - find executable? | ||
52 | , m_confInfo( NULL ) | 63 | , m_confInfo( NULL ) |
53 | , m_ipkgExecOptions( 0 ) | 64 | , m_ipkgExecOptions( 0 ) |
54 | , m_ipkgExecVerbosity( 1 ) | 65 | , m_ipkgExecVerbosity( 1 ) |
55 | , m_ipkgProcess( NULL ) | ||
56 | { | 66 | { |
67 | oipkg = this; | ||
68 | |||
69 | // Initialize libipkg | ||
70 | if ( ipkg_init( &fIpkgMessage, &fIpkgResponse, &m_ipkgArgs ) ) | ||
71 | QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error initialing libipkg" ) ); | ||
72 | |||
73 | // Default ipkg run-time arguments | ||
74 | m_ipkgArgs.noaction = false; | ||
75 | m_ipkgArgs.force_defaults = true; | ||
57 | } | 76 | } |
58 | 77 | ||
59 | OIpkg::~OIpkg() | 78 | OIpkg::~OIpkg() |
@@ -62,9 +81,9 @@ OIpkg::~OIpkg() | |||
62 | if ( m_confInfo ) | 81 | if ( m_confInfo ) |
63 | m_confInfo->setAutoDelete( true ); | 82 | m_confInfo->setAutoDelete( true ); |
64 | 83 | ||
65 | // Terminate any running ipkg processes | 84 | // Free up libipkg resources |
66 | if ( m_ipkgProcess ) | 85 | if ( ipkg_deinit( &m_ipkgArgs ) ) |
67 | delete m_ipkgProcess; | 86 | QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error freeing libipkg" ) ); |
68 | } | 87 | } |
69 | 88 | ||
70 | OConfItemList *OIpkg::configItems() | 89 | OConfItemList *OIpkg::configItems() |
@@ -254,136 +273,71 @@ OPackageList *OIpkg::installedPackages( const QString &destName, const QString & | |||
254 | } | 273 | } |
255 | 274 | ||
256 | bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, const QString &destination, | 275 | bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, const QString &destination, |
257 | const QObject *receiver, const char *slotOutput, const char *slotErrors, | 276 | const QObject *receiver, const char *slotOutput, bool rawOutput ) |
258 | const char *slotFinished, bool rawOutput ) | ||
259 | { | 277 | { |
260 | if ( command == OPackage::NotDefined ) | 278 | if ( command == OPackage::NotDefined ) |
261 | return false; | 279 | return false; |
262 | 280 | ||
263 | // Set up command line for execution | 281 | // Set ipkg run-time options/arguments |
264 | QStringList cmdLine; | 282 | m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); |
265 | cmdLine.append( IPKG_EXEC ); | 283 | m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL ); |
266 | 284 | // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); | |
267 | QString verbosity( "-V" ); | 285 | m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); |
268 | verbosity.append( QString::number( m_ipkgExecVerbosity ) ); | 286 | m_ipkgArgs.verbosity = m_ipkgExecVerbosity; |
269 | cmdLine.append( verbosity ); | 287 | if ( m_ipkgArgs.dest ) |
270 | 288 | free( m_ipkgArgs.dest ); | |
271 | // Determine Ipkg execution options | 289 | if ( !destination.isNull() ) |
272 | if ( command == OPackage::Install && destination != QString::null ) | ||
273 | { | 290 | { |
274 | // TODO - Set destination for installs | 291 | int len = destination.length() + 1; |
275 | cmdLine.append( "-dest" ); | 292 | m_ipkgArgs.dest = (char *)malloc( len ); |
276 | cmdLine.append( destination ); | 293 | strncpy( m_ipkgArgs.dest, destination, destination.length() ); |
294 | m_ipkgArgs.dest[ len - 1 ] = '\0'; | ||
277 | } | 295 | } |
296 | else | ||
297 | m_ipkgArgs.dest = 0x0; | ||
278 | 298 | ||
279 | if ( command != OPackage::Update && command != OPackage::Download ) | 299 | // Connect output signal to widget |
300 | if ( rawOutput ) | ||
280 | { | 301 | { |
281 | if ( m_ipkgExecOptions & FORCE_DEPENDS ) | 302 | if ( slotOutput ) |
282 | cmdLine.append( "-force-depends" ); | 303 | connect( this, SIGNAL(execOutput(char *)), receiver, slotOutput ); |
283 | if ( m_ipkgExecOptions & FORCE_REINSTALL ) | 304 | } |
284 | cmdLine.append( "-force-reinstall" ); | 305 | else |
285 | if ( m_ipkgExecOptions & FORCE_REMOVE ) | 306 | { |
286 | cmdLine.append( "-force-removal-of-essential-packages" ); | 307 | // TODO - connect to local slot and parse output before emitting execOutput |
287 | if ( m_ipkgExecOptions & FORCE_OVERWRITE ) | ||
288 | cmdLine.append( "-force-overwrite" ); | ||
289 | if ( m_ipkgExecVerbosity == 3 ) | ||
290 | cmdLine.append( "-verbose_wget" ); | ||
291 | |||
292 | // TODO | ||
293 | // Handle make links | ||
294 | // Rules - If make links is switched on, create links to root | ||
295 | // if destDir is NOT / | ||
296 | /* | ||
297 | if ( m_ipkgExecOptions & MAKE_LINKS ) | ||
298 | { | ||
299 | // If destDir == / turn off make links as package is being insalled | ||
300 | // to root already. | ||
301 | if ( destDir == "/" ) | ||
302 | m_ipkgExecOptions ^= MAKE_LINKS; | ||
303 | } | ||
304 | */ | ||
305 | } | 308 | } |
306 | 309 | ||
307 | QString cmd; | ||
308 | switch( command ) | 310 | switch( command ) |
309 | { | 311 | { |
310 | case OPackage::Install: cmd = "install"; | 312 | case OPackage::Update : ipkg_lists_update( &m_ipkgArgs ); |
311 | break; | ||
312 | case OPackage::Remove: cmd = "remove"; | ||
313 | break; | 313 | break; |
314 | case OPackage::Update: cmd = "update"; | 314 | case OPackage::Upgrade : ipkg_packages_upgrade( &m_ipkgArgs ); |
315 | break; | 315 | break; |
316 | case OPackage::Upgrade: cmd = "upgrade"; | 316 | case OPackage::Install : { |
317 | break; | 317 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) |
318 | case OPackage::Download: cmd = "download"; | 318 | { |
319 | break; | 319 | ipkg_packages_install( &m_ipkgArgs, (*it) ); |
320 | case OPackage::Info: cmd = "info"; | 320 | } |
321 | }; | ||
321 | break; | 322 | break; |
322 | case OPackage::Files: cmd = "files"; | 323 | case OPackage::Remove : { |
324 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) | ||
325 | { | ||
326 | ipkg_packages_remove( &m_ipkgArgs, (*it), true ); | ||
327 | } | ||
328 | }; | ||
323 | break; | 329 | break; |
324 | //case OPackage::Version: cmd = "" ); | 330 | //case OPackage::Download : ; |
325 | // break; | 331 | // break; |
326 | default: | 332 | default : break; |
327 | break; | ||
328 | }; | 333 | }; |
329 | cmdLine.append( cmd ); | ||
330 | |||
331 | // TODO | ||
332 | // If we are removing, reinstalling or upgrading packages and make links option is selected | ||
333 | // create the links | ||
334 | /* | ||
335 | if ( command == Remove || command == Upgrade ) | ||
336 | { | ||
337 | createLinks = false; | ||
338 | if ( flags & MAKE_LINKS ) | ||
339 | { | ||
340 | emit outputText( tr( "Removing symbolic links...\n" ) ); | ||
341 | linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir ); | ||
342 | emit outputText( QString( " " ) ); | ||
343 | } | ||
344 | } | ||
345 | */ | ||
346 | // Append package list (if any) to end of command line | ||
347 | if ( parameters && !parameters->isEmpty() ) | ||
348 | { | ||
349 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) | ||
350 | { | ||
351 | cmdLine.append( *it ); | ||
352 | } | ||
353 | } | ||
354 | |||
355 | // Create OProcess | ||
356 | if ( m_ipkgProcess ) | ||
357 | delete m_ipkgProcess; | ||
358 | m_ipkgProcess = new OProcess( cmdLine, this ); | ||
359 | |||
360 | // Connect signals (if any) | ||
361 | if ( receiver ) | ||
362 | { | ||
363 | if ( rawOutput ) | ||
364 | { | ||
365 | if ( slotOutput ) | ||
366 | connect( m_ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), receiver, slotOutput ); | ||
367 | if ( slotErrors ) | ||
368 | connect( m_ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)), receiver, slotErrors ); | ||
369 | if ( slotFinished ) | ||
370 | connect( m_ipkgProcess, SIGNAL(processExited(OProcess*)), receiver, slotFinished ); | ||
371 | } | ||
372 | else // !rawOutput | ||
373 | { | ||
374 | // TODO - how should it handle partial lines? (i.e. "Installing opi", "e-aqpkg...") | ||
375 | } | ||
376 | } | ||
377 | 334 | ||
378 | // Run process | 335 | return true; |
379 | printf( "Running: \'%s\'\n", cmdLine.join( " " ).latin1() ); | ||
380 | return m_ipkgProcess->start( OProcess::NotifyOnExit, OProcess::All ); | ||
381 | } | 336 | } |
382 | 337 | ||
383 | void OIpkg::abortCommand() | 338 | void OIpkg::ipkgOutput( char *msg ) |
384 | { | 339 | { |
385 | if ( m_ipkgProcess ) | 340 | emit execOutput( msg ); |
386 | delete m_ipkgProcess; | ||
387 | } | 341 | } |
388 | 342 | ||
389 | void OIpkg::loadConfiguration() | 343 | void OIpkg::loadConfiguration() |
diff --git a/noncore/settings/packagemanager/oipkg.h b/noncore/settings/packagemanager/oipkg.h index 4065f48..824fa17 100644 --- a/noncore/settings/packagemanager/oipkg.h +++ b/noncore/settings/packagemanager/oipkg.h | |||
@@ -32,6 +32,10 @@ | |||
32 | #ifndef OIPKG_H | 32 | #ifndef OIPKG_H |
33 | #define OIPKG_H | 33 | #define OIPKG_H |
34 | 34 | ||
35 | extern "C" { | ||
36 | #include <libipkg.h> | ||
37 | }; | ||
38 | |||
35 | #include <qobject.h> | 39 | #include <qobject.h> |
36 | 40 | ||
37 | #include <qpe/config.h> | 41 | #include <qpe/config.h> |
@@ -46,7 +50,6 @@ | |||
46 | #define FORCE_OVERWRITE 0x0008 | 50 | #define FORCE_OVERWRITE 0x0008 |
47 | 51 | ||
48 | class OConfItemList; | 52 | class OConfItemList; |
49 | class OProcess; | ||
50 | 53 | ||
51 | class OIpkg : public QObject | 54 | class OIpkg : public QObject |
52 | { | 55 | { |
@@ -76,25 +79,23 @@ public: | |||
76 | 79 | ||
77 | bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, | 80 | bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, |
78 | const QString &destination = QString::null, const QObject *receiver = 0x0, | 81 | const QString &destination = QString::null, const QObject *receiver = 0x0, |
79 | const char *slotOutput = 0x0, const char *slotErrors = 0x0, | 82 | const char *slotOutput = 0x0, bool rawOutput = true ); |
80 | const char *slotFinished = 0x0, bool rawOutput = true ); | ||
81 | void abortCommand(); | 83 | void abortCommand(); |
82 | 84 | ||
85 | void ipkgOutput( char *msg ); | ||
86 | |||
83 | private: | 87 | private: |
84 | Config *m_config; // Pointer to application configuration file | 88 | Config *m_config; // Pointer to application configuration file |
85 | QString m_ipkgExec; // Fully qualified path/filename of ipkg binary | 89 | args_t m_ipkgArgs; // libipkg configuration arguments |
86 | OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files | 90 | OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files |
87 | int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options | 91 | int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options |
88 | int m_ipkgExecVerbosity; // Ipkg execution verbosity level | 92 | int m_ipkgExecVerbosity; // Ipkg execution verbosity level |
89 | OProcess *m_ipkgProcess; // Pointer to process which Ipkg will run in | ||
90 | 93 | ||
91 | void loadConfiguration(); | 94 | void loadConfiguration(); |
92 | OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined ); | 95 | OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined ); |
93 | 96 | ||
94 | signals: | 97 | signals: |
95 | void execOutput( OProcess *process, char *buffer, int length ); | 98 | void execOutput( char *msg ); |
96 | void execErrors( OProcess *process, char *buffer, int length ); | ||
97 | void execFinished( OProcess *process, char *buffer, int length ); | ||
98 | }; | 99 | }; |
99 | 100 | ||
100 | #endif | 101 | #endif |
diff --git a/noncore/settings/packagemanager/opackagemanager.cpp b/noncore/settings/packagemanager/opackagemanager.cpp index 6bef918..e1c8a21 100644 --- a/noncore/settings/packagemanager/opackagemanager.cpp +++ b/noncore/settings/packagemanager/opackagemanager.cpp | |||
@@ -317,14 +317,7 @@ void OPackageManager::saveSettings() | |||
317 | 317 | ||
318 | bool OPackageManager::executeCommand( OPackage::Command command, QStringList *packages, | 318 | bool OPackageManager::executeCommand( OPackage::Command command, QStringList *packages, |
319 | const QString &destination, const QObject *receiver, | 319 | const QString &destination, const QObject *receiver, |
320 | const char *slotOutput, const char *slotErrors, | 320 | const char *slotOutput, bool rawOutput ) |
321 | const char *slotFinished, bool rawOutput ) | ||
322 | { | 321 | { |
323 | return m_ipkg.executeCommand( command, packages, destination, receiver, slotOutput, slotErrors, | 322 | return m_ipkg.executeCommand( command, packages, destination, receiver, slotOutput, rawOutput ); |
324 | slotFinished, rawOutput ); | ||
325 | } | ||
326 | |||
327 | void OPackageManager::abortCommand() | ||
328 | { | ||
329 | m_ipkg.abortCommand(); | ||
330 | } | 323 | } |
diff --git a/noncore/settings/packagemanager/opackagemanager.h b/noncore/settings/packagemanager/opackagemanager.h index 5e1a30a..871af0c 100644 --- a/noncore/settings/packagemanager/opackagemanager.h +++ b/noncore/settings/packagemanager/opackagemanager.h | |||
@@ -72,9 +72,7 @@ public: | |||
72 | 72 | ||
73 | bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, | 73 | bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, |
74 | const QString &destination = QString::null, const QObject *receiver = 0x0, | 74 | const QString &destination = QString::null, const QObject *receiver = 0x0, |
75 | const char *slotOutput = 0x0, const char *slotErrors = 0x0, | 75 | const char *slotOutput = 0x0, bool rawOutput = true ); |
76 | const char *slotFinished = 0x0, bool rawOutput = true ); | ||
77 | void abortCommand(); | ||
78 | 76 | ||
79 | private: | 77 | private: |
80 | Config *m_config; // Pointer to application configuration file | 78 | Config *m_config; // Pointer to application configuration file |
diff --git a/noncore/settings/packagemanager/opie-packagemanager.control b/noncore/settings/packagemanager/opie-packagemanager.control index db06761..095e3be 100644 --- a/noncore/settings/packagemanager/opie-packagemanager.control +++ b/noncore/settings/packagemanager/opie-packagemanager.control | |||
@@ -7,4 +7,4 @@ Replaces: packagemanager | |||
7 | Architecture: arm | 7 | Architecture: arm |
8 | Maintainer: Dan Williams (drw@handhelds.org) | 8 | Maintainer: Dan Williams (drw@handhelds.org) |
9 | Description: Opie package management client | 9 | Description: Opie package management client |
10 | Version: 0.1.0 | 10 | Version: 0.2.0 |
diff --git a/noncore/settings/packagemanager/packagemanager.pro b/noncore/settings/packagemanager/packagemanager.pro index 9aa3dc6..55af13e 100644 --- a/noncore/settings/packagemanager/packagemanager.pro +++ b/noncore/settings/packagemanager/packagemanager.pro | |||
@@ -1,4 +1,7 @@ | |||
1 | CONFIG = qt warn_on release quick-app | 1 | CONFIG = qt warn_on release quick-app |
2 | //TEMPLATE = app | ||
3 | //CONFIG += qte warn_on debug | ||
4 | //DESTDIR = $(OPIEDIR)/bin | ||
2 | 5 | ||
3 | SOURCES = opackage.cpp \ | 6 | SOURCES = opackage.cpp \ |
4 | oconfitem.cpp \ | 7 | oconfitem.cpp \ |
@@ -22,10 +25,12 @@ HEADERS = opackage.h \ | |||
22 | filterdlg.h \ | 25 | filterdlg.h \ |
23 | promptdlg.h | 26 | promptdlg.h |
24 | 27 | ||
28 | DEFINES += IPKG_LIB | ||
29 | DEFINES += HAVE_MKDTEMP | ||
25 | TARGET = packagemanager | 30 | TARGET = packagemanager |
26 | INCLUDEPATH += $(OPIEDIR)/include | 31 | INCLUDEPATH += $(OPIEDIR)/include $(IPKGDIR) |
27 | DEPENDPATH += $(OPIEDIR)/include | 32 | DEPENDPATH += $(OPIEDIR)/include |
28 | LIBS += -lqpe -lopie | 33 | LIBS += -lqpe -lopie -lipkg |
29 | 34 | ||
30 | include ( $(OPIEDIR)/include.pro ) | 35 | include ( $(OPIEDIR)/include.pro ) |
31 | 36 | ||