From 15f147680dabe51c66cde7dfe3f9e1872fbb37ae Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 18 May 2009 22:44:15 +0100 Subject: opie-packagemanager: support opkg and split feed files in 1.2.4 version --- recipes/opie-packagemanager/files/opkg.patch | 562 +++++++++++++++++++++ .../opie-packagemanager/files/split-config.patch | 332 ++++++++++++ .../opie-packagemanager_1.2.4.bb | 9 +- 3 files changed, 902 insertions(+), 1 deletion(-) create mode 100644 recipes/opie-packagemanager/files/opkg.patch create mode 100644 recipes/opie-packagemanager/files/split-config.patch (limited to 'recipes') diff --git a/recipes/opie-packagemanager/files/opkg.patch b/recipes/opie-packagemanager/files/opkg.patch new file mode 100644 index 0000000000..bf6b18ab69 --- /dev/null +++ b/recipes/opie-packagemanager/files/opkg.patch @@ -0,0 +1,562 @@ +Index: packagemanager/installdlg.cpp +=================================================================== +RCS file: /cvs/opie/noncore/settings/packagemanager/installdlg.cpp,v +retrieving revision 1.16 +diff -u -d -r1.16 installdlg.cpp +--- packagemanager/installdlg.cpp 5 Jun 2005 22:41:15 -0000 1.16 ++++ packagemanager/installdlg.cpp 18 May 2009 21:03:02 -0000 +@@ -45,6 +45,7 @@ + #include + #include + #include ++#include + + #include + +@@ -130,16 +131,21 @@ + groupBoxLayout->addWidget( m_output ); + layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); + ++ m_progressBar = new QProgressBar( this ); ++ m_progressBar->setTotalSteps( 100 ); ++ m_progressBar->hide(); ++ layout->addMultiCellWidget( m_progressBar, 3, 3, 0, 1 ); ++ + m_btnStart = new QPushButton( Opie::Core::OResource::loadPixmap( "packagemanager/apply", + Opie::Core::OResource::SmallIcon ), tr( "Start" ), this ); + m_btnStart->setMinimumHeight( AppLnk::smallIconSize() ); +- layout->addWidget( m_btnStart, 3, 0 ); ++ layout->addWidget( m_btnStart, 4, 0 ); + connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); + + m_btnOptions = new QPushButton( Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), + tr( "Options" ), this ); + m_btnOptions->setMinimumHeight( AppLnk::smallIconSize() ); +- layout->addWidget( m_btnOptions, 3, 1 ); ++ layout->addWidget( m_btnOptions, 4, 1 ); + connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); + + // Display packages being acted upon in output widget +@@ -251,13 +257,23 @@ + m_btnStart->setEnabled( false ); + } + ++ connect( m_packman, SIGNAL(signalProgress(const QString &, int)), this, SLOT(slotProgress(const QString &, int)) ); ++ ++ m_progressBar->show(); ++ + for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) + { ++ m_progressBar->reset(); + // Execute next command + m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, + this, SLOT(slotOutput(const QString &)), true ); + } + ++ slotOutput( tr("Completed") ); ++ m_progressBar->hide(); ++ ++ disconnect( m_packman, SIGNAL(signalProgress(const QString &, int)), this, SLOT(slotProgress(const QString &, int)) ); ++ + // All commands executed, allow user to close dialog + m_btnStart->setEnabled( true ); + m_btnStart->setText( tr( "Close" ) ); +@@ -314,3 +330,15 @@ + // Update available space + slotDisplayAvailSpace( QString::null ); + } ++ ++void InstallDlg::slotProgress( const QString &msg, int percentage ) ++{ ++ static QString lastmsg = ""; ++ if( lastmsg != msg ) { ++ slotOutput( msg ); ++ lastmsg = msg; ++ } ++ ++ m_progressBar->setProgress( percentage ); ++} ++ +Index: packagemanager/installdlg.h +=================================================================== +RCS file: /cvs/opie/noncore/settings/packagemanager/installdlg.h,v +retrieving revision 1.9 +diff -u -d -r1.9 installdlg.h +--- packagemanager/installdlg.h 5 Jun 2005 22:18:10 -0000 1.9 ++++ packagemanager/installdlg.h 18 May 2009 21:03:02 -0000 +@@ -39,6 +39,7 @@ + class QLabel; + class QMultiLineEdit; + class QPushButton; ++class QProgressBar; + + class OConfItem; + class OPackageManager; +@@ -69,6 +70,7 @@ + QMultiLineEdit *m_output; // Multi-line edit to display status + QPushButton *m_btnStart; // Start/abort/close button + QPushButton *m_btnOptions; // Installation options button ++ QProgressBar *m_progressBar; + + // Commands and packages to execute + int m_numCommands; // Number of commands to be executed +@@ -85,6 +87,7 @@ + + // Execution slots + void slotOutput( const QString &msg ); ++ void slotProgress( const QString &msg, int percentage ); + + signals: + void closeInstallDlg(); +Index: packagemanager/mainwindow.cpp +=================================================================== +RCS file: /cvs/opie/noncore/settings/packagemanager/mainwindow.cpp,v +retrieving revision 1.18 +diff -u -d -r1.18 mainwindow.cpp +--- packagemanager/mainwindow.cpp 5 Jun 2005 22:41:15 -0000 1.18 ++++ packagemanager/mainwindow.cpp 18 May 2009 21:03:02 -0000 +@@ -178,8 +178,8 @@ + QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); + actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) ); + connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); +- actionDownload->addTo( popup ); +- actionDownload->addTo( &m_toolBar ); ++//X actionDownload->addTo( popup ); ++//X actionDownload->addTo( &m_toolBar ); + + a = new QAction( tr( "Apply changes" ), Opie::Core::OResource::loadPixmap( "packagemanager/apply", + Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); +Index: packagemanager/oipkg.cpp +=================================================================== +RCS file: /cvs/opie/noncore/settings/packagemanager/oipkg.cpp,v +retrieving revision 1.25 +diff -u -d -r1.25 oipkg.cpp +--- packagemanager/oipkg.cpp 11 May 2009 21:55:52 -0000 1.25 ++++ packagemanager/oipkg.cpp 18 May 2009 21:03:03 -0000 +@@ -39,21 +39,60 @@ + #include + #include + +-extern "C" { +-#include +-}; +-args_t m_ipkgArgs; // libipkg configuration arguments +- +-const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file +-const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files +-const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists +-const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location +-const QString IPKG_INFO_PATH = "usr/lib/ipkg/info"; // Package file lists location ++const QString IPKG_CONF = "/etc/opkg.conf"; // Fully-qualified name of Ipkg primary configuration file ++const QString IPKG_CONF_DIR = "/etc/opkg"; // Directory of secondary Ipkg configuration files ++const QString IPKG_PKG_PATH = "/usr/lib/opkg/lists"; // Directory containing server package lists ++const QString IPKG_STATUS_PATH = "usr/lib/opkg/status"; // Destination status file location ++const QString IPKG_INFO_PATH = "usr/lib/opkg/info"; // Package file lists location + + OIpkg *oipkg; + + // Ipkg callback functions + ++ ++void fsignalOpkgProgress (opkg_t *opkg, const opkg_progress_data_t *progress, void *user_data) ++{ ++ QString msg; ++ ++ QString pkginfo; ++ if( progress->package ) { ++ pkginfo = progress->package->name; ++ pkginfo += " "; ++ pkginfo += progress->package->version; ++ } ++ switch( progress->action ) { ++ case OPKG_INSTALL: ++ if( pkginfo != "" ) ++ msg = QObject::tr("Installing %1").arg( pkginfo ); ++ else ++ msg = QObject::tr("Installing"); ++ break; ++ case OPKG_REMOVE: ++ if( pkginfo != "" ) ++ msg = QObject::tr("Removing %1").arg( pkginfo ); ++ else ++ msg = QObject::tr("Removing"); ++ break; ++ case OPKG_DOWNLOAD: ++ if( pkginfo != "" ) ++ msg = QObject::tr("Downloading %1").arg( pkginfo ); ++ else ++ msg = QObject::tr("Downloading"); ++ break; ++ default: ++ msg = QObject::tr("Processing"); ++ } ++ msg += "..."; ++ oipkg->progress( (const char *)msg, progress->percentage ); ++} ++ ++void fsignalOpkgPackage (opkg_t *opkg, opkg_package_t *package, void *user_data) ++{ ++ ++} ++ ++ ++/*X + int fsignalIpkgMessage( ipkg_conf_t *conf, message_level_t level, char *msg ) + { + // Display message only if it is below the message level threshold +@@ -64,6 +103,7 @@ + + return 0; + } ++*/ + + char *fIpkgResponse( char */*question*/ ) + { +@@ -76,13 +116,41 @@ + return 0; + } + +-int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/, +- void */*userdata*/ ) ++QString opkg_error_message( int err ) + { +- oipkg->ipkgList( desc ); +- return 0; ++ switch(err) { ++ case OPKG_NO_ERROR: ++ return "Success"; ++ case OPKG_UNKNOWN_ERROR: ++ return "Unknown error"; ++ case OPKG_DOWNLOAD_FAILED: ++ return "Download failed"; ++ case OPKG_DEPENDENCIES_FAILED: ++ return "Unable to complete operation due to dependencies"; ++ case OPKG_PACKAGE_ALREADY_INSTALLED: ++ return "Specified package is already installed"; ++ case OPKG_PACKAGE_NOT_AVAILABLE: ++ return "Specified package is not available"; ++ case OPKG_PACKAGE_NOT_FOUND: ++ return "Specified package could not be found"; ++ case OPKG_PACKAGE_NOT_INSTALLED: ++ return "Specified package is not installed"; ++ case OPKG_GPG_ERROR: ++ return "GPG verification failed"; ++ case OPKG_MD5_ERROR: ++ return "MD5 verification failed"; ++ default: ++ return "Unrecognised error code"; ++ } + } + ++//Xint fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/, ++//X void */*userdata*/ ) ++//X{ ++//X oipkg->ipkgList( desc ); ++//X return 0; ++//X} ++ + OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) + : QObject( parent, name ) + , m_config( config ) +@@ -94,11 +162,7 @@ + oipkg = this; + + // Initialize libipkg +- ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); +- +- // Default ipkg run-time arguments +- m_ipkgArgs.noaction = false; +- m_ipkgArgs.force_defaults = true; ++ m_opkg = opkg_new(); + } + + OIpkg::~OIpkg() +@@ -108,7 +172,7 @@ + m_confInfo->setAutoDelete( true ); + + // Free up libipkg resources +- ipkg_deinit( &m_ipkgArgs ); ++ opkg_free( m_opkg ); + } + + OConfItemList *OIpkg::configItems() +@@ -237,10 +301,7 @@ + } + + // Reinitialize libipkg to pick up new configuration +- ipkg_deinit( &m_ipkgArgs ); +- ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); +- m_ipkgArgs.noaction = false; +- m_ipkgArgs.force_defaults = true; ++ opkg_re_read_config_files( m_opkg ); + } + + void OIpkg::saveSettings() +@@ -430,17 +491,29 @@ + bool OIpkg::executeCommand( OPackage::Command command, const QStringList ¶meters, const QString &destination, + const QObject *receiver, const char *slotOutput, bool rawOutput ) + { ++ int optvalue; ++ + if ( command == OPackage::NotDefined ) + return false; + + // Set ipkg run-time options/arguments +- m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); +- m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL ); +- // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); +- m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); +- m_ipkgArgs.force_removal_of_dependent_packages = ( m_ipkgExecOptions & FORCE_RECURSIVE ); ++ optvalue = ( m_ipkgExecOptions & FORCE_DEPENDS ) ? 1 : 0; ++ opkg_set_option( m_opkg, "force_depends", &optvalue ); ++ ++ optvalue = ( m_ipkgExecOptions & FORCE_REINSTALL ) ? 1 : 0; ++ opkg_set_option( m_opkg, "force_reinstall", &optvalue ); ++ ++ optvalue = ( m_ipkgExecOptions & FORCE_OVERWRITE ) ? 1 : 0; ++ opkg_set_option( m_opkg, "force_overwrite", &optvalue ); ++ ++ optvalue = ( m_ipkgExecOptions & FORCE_RECURSIVE ) ? 1 : 0; ++ opkg_set_option( m_opkg, "force_removal_of_dependent_packages", &optvalue ); ++ ++ optvalue = m_ipkgExecVerbosity; ++ opkg_set_option( m_opkg, "verbosity", &optvalue ); ++ ++/*X // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); + m_ipkgArgs.verbose_wget = ( m_ipkgExecOptions & FORCE_VERBOSE_WGET ); +- m_ipkgArgs.verbosity = m_ipkgExecVerbosity; + if ( m_ipkgArgs.dest ) + free( m_ipkgArgs.dest ); + if ( !destination.isNull() ) +@@ -452,7 +525,7 @@ + } + else + m_ipkgArgs.dest = 0l; +- ++*/ + // Connect output signal to widget + + if ( !rawOutput ) +@@ -460,17 +533,29 @@ + // TODO - connect to local slot and parse output before emitting signalIpkgMessage + } + ++ int ret = 0; ++ + switch( command ) + { + case OPackage::Update : { + connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); +- ipkg_lists_update( &m_ipkgArgs ); ++ ret = opkg_update_package_lists( m_opkg, &fsignalOpkgProgress, NULL ); + disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 ); ++ ++ if( ret != OPKG_NO_ERROR ) { ++ emit signalIpkgMessage( tr("Update failed: ") + opkg_error_message( ret ) ); ++ return false; ++ } + }; + break; + case OPackage::Upgrade : { + connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); +- ipkg_packages_upgrade( &m_ipkgArgs ); ++ ret = opkg_upgrade_all( m_opkg, &fsignalOpkgProgress, NULL ); ++ if( ret != OPKG_NO_ERROR ) { ++ emit signalIpkgMessage( tr("Upgrade failed: ") + opkg_error_message( ret ) ); ++ disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 ); ++ return false; ++ } + + // Re-link non-root destinations to make sure everything is in sync + OConfItemList *destList = destinations(); +@@ -489,7 +574,12 @@ + connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); + for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) + { +- ipkg_packages_install( &m_ipkgArgs, (*it) ); ++ ret = opkg_install_package( m_opkg, (*it), &fsignalOpkgProgress, NULL ); ++ if( ret != OPKG_NO_ERROR ) { ++ emit signalIpkgMessage( tr("Install failed: ") + opkg_error_message( ret ) ); ++ disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 ); ++ return false; ++ } + } + if ( destination != "root" ) + linkPackageDir( destination ); +@@ -505,7 +595,18 @@ + for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) + { + unlinkPackage( (*it), destList ); +- ipkg_packages_remove( &m_ipkgArgs, (*it), true ); ++ ret = opkg_remove_package( m_opkg, (*it), &fsignalOpkgProgress, NULL ); ++ if( ret != OPKG_NO_ERROR ) { ++ if ( ret == OPKG_DEPENDENCIES_FAILED || ret == OPKG_UNKNOWN_ERROR ) { ++ emit signalIpkgMessage( tr("Remove failed: other package(s) depend on the specified package") ); ++ } ++ else { ++ emit signalIpkgMessage( tr("Remove failed: ") + opkg_error_message( ret ) ); ++ } ++ delete destList; ++ disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 ); ++ return false; ++ } + } + + delete destList; +@@ -516,20 +617,38 @@ + connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); + for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) + { +- ipkg_packages_download( &m_ipkgArgs, (*it) ); ++//X ipkg_packages_download( &m_ipkgArgs, (*it) ); + } + disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 ); + }; + break; + case OPackage::Info : { + connect( this, SIGNAL(signalIpkgStatus(const QString &)), receiver, slotOutput ); +- ipkg_packages_info( &m_ipkgArgs, (*parameters.begin()), &fIpkgStatus, 0l ); ++//X ipkg_packages_info( &m_ipkgArgs, (*parameters.begin()), &fIpkgStatus, 0l ); ++ opkg_package_t *pkginfo = opkg_find_package( m_opkg, (*parameters.begin()), NULL, NULL, NULL ); ++ if(pkginfo) { ++ QString msg = tr("Package: %1\n").arg( pkginfo->name ); ++ msg += tr("Version: %1\n").arg( pkginfo->version ); ++ msg += tr("Architecture: %1\n").arg( pkginfo->architecture ); ++ if( pkginfo->repository ) ++ msg += tr("Repository: %1\n").arg( pkginfo->repository ); ++ if( pkginfo->description ) ++ msg += tr("Description: %1\n\n").arg( pkginfo->description ); ++ if( pkginfo->tags ) ++ msg += tr("Tags: %1\n").arg( pkginfo->tags ); ++ if( pkginfo->url ) ++ msg += tr("URL: %1\n").arg( pkginfo->url ); ++ if( pkginfo->size > 0 ) ++ msg += tr("Size: %1\n").arg( pkginfo->size ); ++ msg += tr("Status: %1").arg( pkginfo->installed ? tr("installed") : "" ); ++ emit signalIpkgStatus( msg ); ++ } + disconnect( this, SIGNAL(signalIpkgStatus(const QString &)), 0, 0 ); + }; + break; + case OPackage::Files : { + connect( this, SIGNAL(signalIpkgList(const QString &)), receiver, slotOutput ); +- ipkg_package_files( &m_ipkgArgs, (*parameters.begin()), &fIpkgFiles, 0l ); ++//X ipkg_package_files( &m_ipkgArgs, (*parameters.begin()), &fIpkgFiles, 0l ); + disconnect( this, SIGNAL(signalIpkgList(const QString &)), 0, 0 ); + }; + break; +@@ -539,7 +658,7 @@ + return true; + } + +-void OIpkg::ipkgMessage( char *msg ) ++void OIpkg::ipkgMessage( const char *msg ) + { + emit signalIpkgMessage( msg ); + } +@@ -554,6 +673,11 @@ + emit signalIpkgList( filelist ); + } + ++void OIpkg::progress( const QString &msg, int percentage ) ++{ ++ emit signalProgress( msg, percentage ); ++} ++ + void OIpkg::loadConfiguration() + { + if ( m_confInfo ) +Index: packagemanager/oipkg.h +=================================================================== +RCS file: /cvs/opie/noncore/settings/packagemanager/oipkg.h,v +retrieving revision 1.10 +diff -u -d -r1.10 oipkg.h +--- packagemanager/oipkg.h 17 May 2009 21:33:07 -0000 1.10 ++++ packagemanager/oipkg.h 18 May 2009 21:03:03 -0000 +@@ -38,6 +38,10 @@ + + #include + ++extern "C" { ++#include ++}; ++ + // Ipkg execution options (m_ipkgExecOptions) + #define FORCE_DEPENDS 0x0001 + #define FORCE_REMOVE 0x0002 +@@ -86,9 +90,11 @@ + bool rawOutput = true ); + void abortCommand(); + +- void ipkgMessage( char *msg ); ++ void ipkgMessage( const char *msg ); + void ipkgStatus( char *status ); + void ipkgList( char *filelist ); ++ void progressInit(); ++ void progress( const QString &msg, int percentage ); + + private: + Config *m_config; // Pointer to application configuration file +@@ -96,6 +102,7 @@ + int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options + int m_ipkgExecVerbosity; // Ipkg execution verbosity level + QString m_rootPath; // Directory path where the 'root' destination is located ++ opkg_t *m_opkg; + + void loadConfiguration(); + OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined ); +@@ -108,6 +115,8 @@ + void signalIpkgMessage( const QString &msg ); + void signalIpkgStatus( const QString &status ); + void signalIpkgList( const QString &filelist ); ++ void signalProgressInit(); ++ void signalProgress( const QString &msg, int percentage ); + }; + + #endif +Index: packagemanager/opackagemanager.cpp +=================================================================== +RCS file: /cvs/opie/noncore/settings/packagemanager/opackagemanager.cpp,v +retrieving revision 1.10 +diff -u -d -r1.10 opackagemanager.cpp +--- packagemanager/opackagemanager.cpp 5 Jun 2005 22:18:10 -0000 1.10 ++++ packagemanager/opackagemanager.cpp 18 May 2009 21:03:03 -0000 +@@ -43,6 +43,7 @@ + , m_categories() + { + m_packages.setAutoDelete( true ); ++ connect( &m_ipkg, SIGNAL(signalProgress(const QString &, int)), this, SIGNAL(signalProgress(const QString &, int)) ); + } + + void OPackageManager::loadAvailablePackages() +Index: packagemanager/opackagemanager.h +=================================================================== +RCS file: /cvs/opie/noncore/settings/packagemanager/opackagemanager.h,v +retrieving revision 1.6 +diff -u -d -r1.6 opackagemanager.h +--- packagemanager/opackagemanager.h 5 Jun 2005 22:18:10 -0000 1.6 ++++ packagemanager/opackagemanager.h 18 May 2009 21:03:03 -0000 +@@ -89,6 +89,7 @@ + void initStatus( int numSteps ); + void statusText( const QString &status ); + void statusBar( int currStep ); ++ void signalProgress( const QString &msg, int percentage ); + }; + + #endif +Index: packagemanager/packagemanager.pro +=================================================================== +RCS file: /cvs/opie/noncore/settings/packagemanager/packagemanager.pro,v +retrieving revision 1.9 +diff -u -d -r1.9 packagemanager.pro +--- packagemanager/packagemanager.pro 24 Dec 2004 20:13:38 -0000 1.9 ++++ packagemanager/packagemanager.pro 18 May 2009 21:03:03 -0000 +@@ -29,7 +29,7 @@ + TARGET = packagemanager + INCLUDEPATH += $(OPIEDIR)/include + DEPENDPATH += $(OPIEDIR)/include +-LIBS += -lqpe -lopiecore2 -lopieui2 -lipkg ++LIBS += -lqpe -lopiecore2 -lopieui2 -lopkg + + include( $(OPIEDIR)/include.pro ) + diff --git a/recipes/opie-packagemanager/files/split-config.patch b/recipes/opie-packagemanager/files/split-config.patch new file mode 100644 index 0000000000..1feb6aea68 --- /dev/null +++ b/recipes/opie-packagemanager/files/split-config.patch @@ -0,0 +1,332 @@ +--- packagemanager/oipkg.cpp 2009-05-11 23:06:48.000000000 +0100 ++++ packagemanager/oipkg.cpp 2009-05-11 23:06:50.000000000 +0100 +@@ -30,6 +30,8 @@ + + #include "oipkg.h" + ++#include ++ + #include + #include + #include +@@ -133,6 +135,26 @@ + return filterConfItems( OConfItem::Option ); + } + ++void OIpkg::defaultConfItemFile( OConfItem *item ) ++{ ++ if( item->file().isNull() ) ++ { ++ switch ( item->type() ) ++ { ++ case OConfItem::Source : ++ case OConfItem::Destination : ++ item->setFile( IPKG_CONF_DIR + "/" + item->name() + ".conf" ); ++ break; ++ case OConfItem::Arch : ++ item->setFile( IPKG_CONF_DIR + "/arch.conf" ); ++ break; ++ default : ++ item->setFile( IPKG_CONF ); ++ break; ++ }; ++ } ++} ++ + void OIpkg::setConfigItems( OConfItemList *configList ) + { + if ( m_confInfo ) +@@ -140,84 +162,78 @@ + + m_confInfo = configList; + +- // Write out new /etc/ipkg.conf +- QFile confFile( IPKG_CONF ); +- if ( confFile.open( IO_WriteOnly ) ) ++ // Write out new config files ++ QString lastFile = ""; ++ QFile *confFile = NULL; ++ QTextStream *confStream = NULL; ++ OConfItemListIterator it( *m_confInfo ); ++ for ( ; it.current(); ++it ) + { +- QTextStream confStream( &confFile ); +- confStream << "# Generated by Opie Package Manager\n\n"; ++ OConfItem *item = it.current(); + +- OConfItemListIterator it( *m_confInfo ); +- for ( ; it.current(); ++it ) ++ // Only write out valid conf items ++ if ( item->type() != OConfItem::NotDefined ) + { +- OConfItem *item = it.current(); ++ if ( lastFile != item->file() ) { ++ if ( confFile ) { ++ confFile->close(); ++ delete confStream; ++ delete confFile; ++ } ++ odebug << "Opening " << item->file() << oendl; ++ confFile = new QFile( item->file() ); ++ if ( ! confFile->open( IO_WriteOnly ) ) { ++ owarn << "Failed to open " << item->file() << oendl; ++ delete confFile; ++ confFile = NULL; ++ break; ++ } ++ lastFile = item->file(); ++ ++ confStream = new QTextStream( confFile ); ++// (*confStream) << "# Generated by Opie Package Manager\n\n"; ++ } + +- // Only write out valid conf items +- if ( item->type() != OConfItem::NotDefined ) +- { +- QString confLine; +- QString name = item->name(); +- if ( !item->active() ) +- confLine = "#"; ++ QString confLine; ++ QString name = item->name(); ++ if ( !item->active() ) ++ confLine = "#"; + +- switch ( item->type() ) ++ switch ( item->type() ) ++ { ++ case OConfItem::Source : + { +- case OConfItem::Source : +- { +- if ( item->features().contains( "Compressed" ) ) +- confLine.append( "src/gz" ); +- else +- confLine.append( "src" ); +- } +- break; +- case OConfItem::Destination : confLine.append( "dest" ); break; +- case OConfItem::Option : confLine.append( "option" ); break; +- case OConfItem::Arch : confLine.append( "arch" ); break; +- case OConfItem::Other : +- { +- // For options w/type = Other, the mapping is as follows: +- // name = typeStr (e.g. "lists_dir") +- // value = value +- // features = name (from configuration file) +- confLine.append( item->name() ); +- name = item->features(); +- } +- break; +- default : break; +- }; ++ if ( item->features().contains( "Compressed" ) ) ++ confLine.append( "src/gz" ); ++ else ++ confLine.append( "src" ); ++ } ++ break; ++ case OConfItem::Destination : confLine.append( "dest" ); break; ++ case OConfItem::Option : confLine.append( "option" ); break; ++ case OConfItem::Arch : confLine.append( "arch" ); break; ++ case OConfItem::Other : ++ { ++ // For options w/type = Other, the mapping is as follows: ++ // name = typeStr (e.g. "lists_dir") ++ // value = value ++ // features = name (from configuration file) ++ confLine.append( item->name() ); ++ name = item->features(); ++ } ++ break; ++ default : break; ++ }; + +- confStream << confLine << " " << name << " " << item->value() << "\n"; +- } ++ (*confStream) << confLine << " " << name << " " << item->value() << "\n"; + } + +- confFile.close(); + } +- else +- { +- // Problem writing to /etc/ipkg.conf, exit before removing other conf files +- return; +- } +- +- // Delete /etc/ipkg/*.conf files (/etc/ipkg.conf should now have all settings +- QStringList confFiles; +- QDir confDir( IPKG_CONF_DIR ); +- if ( confDir.exists() ) +- { +- confDir.setNameFilter( "*.conf" ); +- confDir.setFilter( QDir::Files ); +- confFiles = confDir.entryList( "*.conf", QDir::Files ); +- +- QStringList::Iterator lastFile = confFiles.end(); +- for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it ) +- { +- // Create absolute file path if necessary +- QString absFile = (*it); +- if ( !absFile.startsWith( "/" ) ) +- absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); + +- // Delete file +- QFile::remove( absFile ); +- } ++ if ( confFile ) { ++ confFile->close(); ++ delete confStream; ++ delete confFile; + } + + // Reinitialize libipkg to pick up new configuration +@@ -638,7 +654,7 @@ + + // Add to list + if ( recognizedOption ) +- m_confInfo->append( new OConfItem( type, name, value, features, active ) ); ++ m_confInfo->append( new OConfItem( type, name, value, features, absFile, active ) ); + } + } + +--- packagemanager/oconfitem.cpp 2009-05-11 23:09:00.000000000 +0100 ++++ packagemanager/oconfitem.cpp 2009-05-11 23:09:02.000000000 +0100 +@@ -31,11 +31,12 @@ + #include "oconfitem.h" + + OConfItem::OConfItem( Type type, const QString &name, const QString &value, +- const QString &features, bool active ) ++ const QString &features, const QString &file, bool active ) + : m_type( type ) + , m_name( name ) + , m_value( value ) + , m_features( features ) ++ , m_file( file ) + , m_active( active ) + { + } +--- packagemanager/oconfitem.h 2009-05-11 23:08:43.000000000 +0100 ++++ packagemanager/oconfitem.h 2009-05-11 23:08:45.000000000 +0100 +@@ -41,18 +41,20 @@ + + OConfItem( Type type = NotDefined, const QString &name = QString::null, + const QString &value = QString::null, const QString &features = QString::null, +- bool active = true ); ++ const QString &file = QString::null, bool active = true ); + + Type type() { return m_type; } + const QString &name() { return m_name; } + const QString &value() { return m_value; } + const QString &features() { return m_features; } ++ const QString &file() { return m_file; } + bool active() { return m_active; } + + void setType( Type type ) { m_type = type; } + void setName( const QString &name ) { m_name = name; } + void setValue( const QString &value ) { m_value = value; } + void setFeatures( const QString &features ) { m_features = features; } ++ void setFile( const QString &file ) { m_file = file; } + void setActive( bool active ) { m_active = active; } + + private: +@@ -60,6 +62,7 @@ + QString m_name; // Name of item + QString m_value; // Value of item + QString m_features; // Comma-deliminated list of features this item supports ++ QString m_file; // File this item came from + bool m_active; // Indicates whether item is currently active + }; + +@@ -69,23 +72,32 @@ + + int compareItems( QCollection::Item item1, QCollection::Item item2 ) + { +- // Sort by OConfItem location then by type +- OConfItem::Type type1 = reinterpret_cast(item1)->type(); +- OConfItem::Type type2 = reinterpret_cast(item2)->type(); +- if ( type1 < type2 ) ++ // Sort by OConfItem file, name, then by type ++ QString file1 = reinterpret_cast(item1)->file(); ++ QString file2 = reinterpret_cast(item2)->file(); ++ if ( file1 < file2 ) + return -1; +- else if ( type1 == type2 ) ++ else if ( file1 == file2 ) + { +- QString name1 = reinterpret_cast(item1)->name(); +- QString name2 = reinterpret_cast(item2)->name(); +- if ( name1 < name2 ) ++ OConfItem::Type type1 = reinterpret_cast(item1)->type(); ++ OConfItem::Type type2 = reinterpret_cast(item2)->type(); ++ if ( type1 < type2 ) + return -1; +- else if ( name1 == name2 ) +- return 0; +- else /*if ( name1 > name2 )*/ ++ else if ( type1 == type2 ) ++ { ++ QString name1 = reinterpret_cast(item1)->name(); ++ QString name2 = reinterpret_cast(item2)->name(); ++ if ( name1 < name2 ) ++ return -1; ++ else if ( name1 == name2 ) ++ return 0; ++ else /*if ( name1 > name2 )*/ ++ return 1; ++ } ++ else /*if ( type1 > type2 )*/ + return 1; + } +- else /*if ( type1 > type2 )*/ ++ else /*if ( file1 > file2 )*/ + return 1; + } + }; +--- packagemanager/oipkgconfigdlg.cpp 2009-05-11 23:08:21.000000000 +0100 ++++ packagemanager/oipkgconfigdlg.cpp 2009-05-11 23:08:23.000000000 +0100 +@@ -99,7 +99,7 @@ + } + else + m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", +- m_proxyHttpServer->text(), QString::null, ++ m_proxyHttpServer->text(), QString::null, QString::null, + m_proxyHttpActive->isChecked() ) ); + + confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" ); +@@ -110,7 +110,7 @@ + } + else + m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", +- m_proxyFtpServer->text(), QString::null, ++ m_proxyFtpServer->text(), QString::null, QString::null, + m_proxyFtpActive->isChecked() ) ); + + confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" ); +@@ -472,6 +472,7 @@ + if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) + { + // Add to configuration option list ++ m_ipkg->defaultConfItemFile( server ); + m_configs->append( server ); + m_configs->sort(); + +@@ -532,6 +533,7 @@ + if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) + { + // Add to configuration option list ++ m_ipkg->defaultConfItemFile( dest ); + m_configs->append( dest ); + m_configs->sort(); + +--- packagemanager/oipkg.h 16 Jan 2006 15:07:35 -0000 1.9 ++++ packagemanager/oipkg.h 17 May 2009 21:26:55 -0000 +@@ -76,6 +76,7 @@ + + OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, + const QString &name = QString::null ); ++ void defaultConfItemFile( OConfItem *item ); + + bool executeCommand( OPackage::Command command = OPackage::NotDefined, + const QStringList ¶meters = QStringList(), diff --git a/recipes/opie-packagemanager/opie-packagemanager_1.2.4.bb b/recipes/opie-packagemanager/opie-packagemanager_1.2.4.bb index 0b8f44981d..57c6ab5cfa 100644 --- a/recipes/opie-packagemanager/opie-packagemanager_1.2.4.bb +++ b/recipes/opie-packagemanager/opie-packagemanager_1.2.4.bb @@ -1,6 +1,13 @@ require ${PN}.inc +PR = "r1" + +DEPENDS = "opkg" + +EXTRA_QMAKEVARS_PRE += "LIBIPK_INC_DIR=${STAGING_INCDIR}/libopkg" SRC_URI = "${HANDHELDS_CVS};tag=${TAG};module=opie/noncore/settings/${APPNAME};cvsdate=${SRCDATE} \ ${HANDHELDS_CVS};tag=${TAG};module=opie/pics;cvsdate=${SRCDATE} \ - ${HANDHELDS_CVS};tag=${TAG};module=opie/apps" + ${HANDHELDS_CVS};tag=${TAG};module=opie/apps \ + file://split-config.patch;patch=1 \ + file://opkg.patch;patch=1" -- cgit 1.2.3-korg