From d272cc7a8c35a7d270be0e2f7751921902d3dc43 Mon Sep 17 00:00:00 2001 From: Duncaen Date: Thu, 31 Dec 2020 15:20:06 +0100 Subject: [PATCH] MEGAcmd: update to 1.4.0. --- srcpkgs/MEGAcmd/patches/megacmd-sdk36.diff | 381 --------------------- srcpkgs/MEGAcmd/template | 15 +- 2 files changed, 10 insertions(+), 386 deletions(-) delete mode 100644 srcpkgs/MEGAcmd/patches/megacmd-sdk36.diff diff --git a/srcpkgs/MEGAcmd/patches/megacmd-sdk36.diff b/srcpkgs/MEGAcmd/patches/megacmd-sdk36.diff deleted file mode 100644 index a30a142156e..00000000000 --- a/srcpkgs/MEGAcmd/patches/megacmd-sdk36.diff +++ /dev/null @@ -1,381 +0,0 @@ ---- src/comunicationsmanagerfilesockets.cpp -+++ src/comunicationsmanagerfilesockets.cpp -@@ -134,14 +134,13 @@ int ComunicationsManagerFileSockets::create_new_socket(int *sockId) - ComunicationsManagerFileSockets::ComunicationsManagerFileSockets() - { - count = 0; -- mtx = new MegaMutex(); -- informerMutex = new MegaMutex(false); -+ mtx = new std::recursive_mutex(); -+ informerMutex = new std::recursive_mutex(); - initialize(); - } - - int ComunicationsManagerFileSockets::initialize() - { -- mtx->init(false); - - MegaFileSystemAccess *fsAccess = new MegaFileSystemAccess(); - char csocketsFolder[34]; // enough to hold all numbers up to 64-bits -@@ -394,7 +393,7 @@ void ComunicationsManagerFileSockets::sendPartialOutput(CmdPetition *inf, OUTSTR - - int ComunicationsManagerFileSockets::informStateListener(CmdPetition *inf, string &s) - { -- MutexGuard g(*informerMutex); -+ std::lock_guard g(*informerMutex); - LOG_verbose << "Inform State Listener: Output to write in socket " << ((CmdPetitionPosixSockets *)inf)->outSocket << ": <<" << s << ">>"; - - sockaddr_in cliAddr; ---- src/comunicationsmanagerfilesockets.h -+++ src/comunicationsmanagerfilesockets.h -@@ -58,8 +58,8 @@ private: - - // to get next socket id - int count; -- mega::MegaMutex *mtx; -- mega::MegaMutex *informerMutex; -+ std::recursive_mutex *mtx; -+ std::recursive_mutex *informerMutex; - - /** - * @brief create_new_socket ---- src/comunicationsmanagerportsockets.cpp -+++ src/comunicationsmanagerportsockets.cpp -@@ -161,13 +161,12 @@ SOCKET ComunicationsManagerPortSockets::create_new_socket(int *sockId) - ComunicationsManagerPortSockets::ComunicationsManagerPortSockets() - { - count = 0; -- mtx = new MegaMutex(); -+ mtx = new std::recursive_mutex(); - initialize(); - } - - int ComunicationsManagerPortSockets::initialize() - { -- mtx->init(false); - #if _WIN32 - WORD wVersionRequested; - WSADATA wsaData; ---- src/comunicationsmanagerportsockets.h -+++ src/comunicationsmanagerportsockets.h -@@ -69,7 +69,7 @@ private: - - // to get next socket id - int count; -- mega::MegaMutex *mtx; -+ std::recursive_mutex *mtx; - - /** - * @brief create_new_socket ---- src/listeners.cpp -+++ src/listeners.cpp -@@ -902,7 +902,6 @@ MegaCmdGlobalTransferListener::MegaCmdGlobalTransferListener(MegaApi *megaApi, M - this->megaApi = megaApi; - this->sandboxCMD = sandboxCMD; - this->listener = parent; -- completedTransfersMutex.init(false); - }; - - void MegaCmdGlobalTransferListener::onTransferFinish(MegaApi* api, MegaTransfer *transfer, MegaError* error) ---- src/listeners.h -+++ src/listeners.h -@@ -178,7 +178,7 @@ private: - static const int MAXCOMPLETEDTRANSFERSBUFFER; - - public: -- mega::MegaMutex completedTransfersMutex; -+ std::recursive_mutex completedTransfersMutex; - std::deque completedTransfers; - std::map completedPathsByHandle; - public: ---- src/megacmd.cpp -+++ src/megacmd.cpp -@@ -103,11 +103,11 @@ MegaApi *api; - std::queue apiFolders; - std::vector occupiedapiFolders; - MegaSemaphore semaphoreapiFolders; --MegaMutex mutexapiFolders; -+std::recursive_mutex mutexapiFolders; - - MegaCMDLogger *loggerCMD; - --MegaMutex mutexEndedPetitionThreads; -+std::recursive_mutex mutexEndedPetitionThreads; - std::vector petitionThreads; - std::vector endedPetitionThreads; - MegaThread *threadRetryConnections; -@@ -194,7 +194,7 @@ static prompttype prompt = COMMAND; - // local console - Console* console; - --MegaMutex mutexHistory; -+std::recursive_mutex mutexHistory; - - map threadline; - -@@ -4411,9 +4411,7 @@ int main(int argc, char* argv[]) - loggerCMD->setCmdLoggerLevel(MegaApi::LOG_LEVEL_MAX); - } - -- mutexHistory.init(false); - -- mutexEndedPetitionThreads.init(false); - - ConfigurationManager::loadConfiguration(( argc > 1 ) && debug); - if (!ConfigurationManager::lockExecution() && !skiplockcheck) -@@ -4476,7 +4474,6 @@ int main(int argc, char* argv[]) - semaphoreClients.release(); - } - -- mutexapiFolders.init(false); - - LOG_debug << "Language set to: " << localecode; - ---- src/megacmdexecuter.cpp -+++ src/megacmdexecuter.cpp -@@ -124,12 +124,6 @@ MegaCmdExecuter::MegaCmdExecuter(MegaApi *api, MegaCMDLogger *loggerCMD, MegaCmd - api->addTransferListener(globalTransferListener); - cwd = UNDEF; - fsAccessCMD = new MegaFileSystemAccess(); -- mtxSyncMap.init(false); -- mtxWebDavLocations.init(false); -- mtxFtpLocations.init(false); --#ifdef ENABLE_BACKUPS -- mtxBackupsMap.init(true); --#endif - session = NULL; - } - ---- src/megacmdexecuter.h -+++ src/megacmdexecuter.h -@@ -33,12 +33,12 @@ private: - MegaCMDLogger *loggerCMD; - MegaCmdSandbox *sandboxCMD; - MegaCmdGlobalTransferListener *globalTransferListener; -- mega::MegaMutex mtxSyncMap; -- mega::MegaMutex mtxWebDavLocations; //TODO: destroy these two -- mega::MegaMutex mtxFtpLocations; -+ std::recursive_mutex mtxSyncMap; -+ std::recursive_mutex mtxWebDavLocations; //TODO: destroy these two -+ std::recursive_mutex mtxFtpLocations; - - #ifdef ENABLE_BACKUPS -- mega::MegaMutex mtxBackupsMap; -+ std::recursive_mutex mtxBackupsMap; - #endif - - // login/signup e-mail address ---- src/megacmdlogger.cpp -+++ src/megacmdlogger.cpp -@@ -38,7 +38,7 @@ using namespace std; - using namespace mega; - - // different outstreams for every thread. to gather all the output data --MUTEX_CLASS threadLookups(false); -+std::mutex threadLookups; - map outstreams; - map threadLogLevel; - map threadoutCode; -@@ -50,7 +50,7 @@ LoggedStream LCOUT(&COUT); - - LoggedStream &getCurrentOut() - { -- MutexGuard g(threadLookups); -+ std::lock_guard g(threadLookups); - uint64_t currentThread = MegaThread::currentThreadId(); - if (outstreams.find(currentThread) == outstreams.end()) - { -@@ -71,7 +71,7 @@ bool interactiveThread() - - unsigned long long currentThread = MegaThread::currentThreadId(); - -- MutexGuard g(threadLookups); -+ std::lock_guard g(threadLookups); - if (outstreams.find(currentThread) == outstreams.end()) - { - return true; -@@ -86,7 +86,7 @@ int getCurrentOutCode() - { - unsigned long long currentThread = MegaThread::currentThreadId(); - -- MutexGuard g(threadLookups); -+ std::lock_guard g(threadLookups); - if (threadoutCode.find(currentThread) == threadoutCode.end()) - { - return 0; //default OK -@@ -102,7 +102,7 @@ CmdPetition * getCurrentPetition() - { - unsigned long long currentThread = MegaThread::currentThreadId(); - -- MutexGuard g(threadLookups); -+ std::lock_guard g(threadLookups); - if (threadpetition.find(currentThread) == threadpetition.end()) - { - return NULL; -@@ -117,7 +117,7 @@ int getCurrentThreadLogLevel() - { - unsigned long long currentThread = MegaThread::currentThreadId(); - -- MutexGuard g(threadLookups); -+ std::lock_guard g(threadLookups); - if (threadLogLevel.find(currentThread) == threadLogLevel.end()) - { - return -1; -@@ -132,7 +132,7 @@ bool getCurrentThreadIsCmdShell() - { - unsigned long long currentThread = MegaThread::currentThreadId(); - -- MutexGuard g(threadLookups); -+ std::lock_guard g(threadLookups); - if (threadIsCmdShell.find(currentThread) == threadIsCmdShell.end()) - { - return false; //default not -@@ -146,31 +146,31 @@ bool getCurrentThreadIsCmdShell() - - void setCurrentThreadLogLevel(int level) - { -- MutexGuard g(threadLookups); -+ std::lock_guard g(threadLookups); - threadLogLevel[MegaThread::currentThreadId()] = level; - } - - void setCurrentThreadOutStream(LoggedStream *s) - { -- MutexGuard g(threadLookups); -+ std::lock_guard g(threadLookups); - outstreams[MegaThread::currentThreadId()] = s; - } - - void setCurrentThreadIsCmdShell(bool isit) - { -- MutexGuard g(threadLookups); -+ std::lock_guard g(threadLookups); - threadIsCmdShell[MegaThread::currentThreadId()] = isit; - } - - void setCurrentOutCode(int outCode) - { -- MutexGuard g(threadLookups); -+ std::lock_guard g(threadLookups); - threadoutCode[MegaThread::currentThreadId()] = outCode; - } - - void setCurrentPetition(CmdPetition *petition) - { -- MutexGuard g(threadLookups); -+ std::lock_guard g(threadLookups); - threadpetition[MegaThread::currentThreadId()] = petition; - } - -@@ -179,7 +179,7 @@ MegaCMDLogger::MegaCMDLogger() - { - this->output = &LCOUT; - this->apiLoggerLevel = MegaApi::LOG_LEVEL_ERROR; -- this->outputmutex = new MegaMutex(false); -+ this->outputmutex = new std::recursive_mutex; - } - - MegaCMDLogger::~MegaCMDLogger() -@@ -199,7 +199,7 @@ void MegaCMDLogger::log(const char *time, int loglevel, const char *source, cons - if (loglevel <= cmdLoggerLevel) - { - #ifdef _WIN32 -- MutexGuard g(*outputmutex); -+ std::lock_guard g(*outputmutex); - int oldmode; - oldmode = _setmode(_fileno(stdout), _O_U8TEXT); - *output << "[" << SimpleLogger::toStr(LogLevel(loglevel)) << ": " << time << "] " << message << endl; -@@ -233,7 +233,7 @@ void MegaCMDLogger::log(const char *time, int loglevel, const char *source, cons - return; - } - #ifdef _WIN32 -- MutexGuard g(*outputmutex); -+ std::lock_guard g(*outputmutex); - int oldmode; - oldmode = _setmode(_fileno(stdout), _O_U8TEXT); - *output << "[API:" << SimpleLogger::toStr(LogLevel(loglevel)) << ": " << time << "] " << message << endl; ---- src/megacmdlogger.h -+++ src/megacmdlogger.h -@@ -112,7 +112,7 @@ private: - int apiLoggerLevel; - int cmdLoggerLevel; - LoggedStream * output; -- mega::MegaMutex *outputmutex; -+ std::recursive_mutex *outputmutex; - - public: - MegaCMDLogger(); ---- src/megacmdshell/megacmdshell.cpp -+++ src/megacmdshell/megacmdshell.cpp -@@ -199,7 +199,7 @@ bool confirmingcancellink = false; - // communications with megacmdserver: - MegaCmdShellCommunications *comms; - --MUTEX_CLASS mutexPrompt(false); -+std::mutex mutexPrompt; - - void printWelcomeMsg(unsigned int width = 0); - -@@ -627,7 +627,7 @@ void install_rl_handler(const char *theprompt) - - void changeprompt(const char *newprompt, bool redisplay) - { -- MutexGuard g(mutexPrompt); -+ std::lock_guard g(mutexPrompt); - - if (*dynamicprompt) - { ---- src/megacmdshell/megacmdshellcommunications.cpp -+++ src/megacmdshell/megacmdshellcommunications.cpp -@@ -80,7 +80,7 @@ bool MegaCmdShellCommunications::stopListener; - bool MegaCmdShellCommunications::updating; - ::mega::Thread *MegaCmdShellCommunications::listenerThread; - SOCKET MegaCmdShellCommunications::newsockfd = INVALID_SOCKET; --MegaMutex MegaCmdShellCommunications::megaCmdStdoutputing; -+std::recursive_mutex MegaCmdShellCommunications::megaCmdStdoutputing; - - bool MegaCmdShellCommunications::socketValid(SOCKET socket) - { -@@ -483,7 +483,6 @@ MegaCmdShellCommunications::MegaCmdShellCommunications() - stopListener = false; - updating = false; - listenerThread = NULL; -- MegaCmdShellCommunications::megaCmdStdoutputing.init(false); - } - - ---- src/megacmdshell/megacmdshellcommunications.h -+++ src/megacmdshell/megacmdshellcommunications.h -@@ -26,6 +26,7 @@ - - #include - #include -+#include - - #ifdef _WIN32 - #include -@@ -40,15 +41,12 @@ - - #if defined(_WIN32) && !defined(WINDOWS_PHONE) && !defined(USE_CPPTHREAD) - #include "mega/thread/win32thread.h" --class MegaMutex : public ::mega::Win32Mutex {}; - class MegaThread : public ::mega::Win32Thread {}; - #elif defined(USE_CPPTHREAD) - #include "mega/thread/cppthread.h" --class MegaMutex : public ::mega::CppMutex {}; - class MegaThread : public ::mega::CppThread {}; - #else - #include "mega/thread/posixthread.h" --class MegaMutex : public ::mega::PosixMutex {}; - class MegaThread : public ::mega::PosixThread {}; - #endif - -@@ -118,7 +116,7 @@ public: - MegaCmdShellCommunications(); - virtual ~MegaCmdShellCommunications(); - -- static MegaMutex megaCmdStdoutputing; -+ static std::recursive_mutex megaCmdStdoutputing; - virtual int executeCommand(std::string command, std::string (*readresponse)(const char *) = NULL, OUTSTREAMTYPE &output = COUT, bool interactiveshell = true, std::wstring = L""); - virtual int executeCommandW(std::wstring command, std::string (*readresponse)(const char *) = NULL, OUTSTREAMTYPE &output = COUT, bool interactiveshell = true); - diff --git a/srcpkgs/MEGAcmd/template b/srcpkgs/MEGAcmd/template index ea6d3772fca..eb94684afcf 100644 --- a/srcpkgs/MEGAcmd/template +++ b/srcpkgs/MEGAcmd/template @@ -1,6 +1,6 @@ # Template file for 'MEGAcmd' pkgname=MEGAcmd -version=1.1.0 +version=1.4.0 revision=1 wrksrc="${pkgname}-${version}_Linux" build_style=gnu-configure @@ -8,24 +8,29 @@ make_build_args='LIBTOOLFLAGS="--tag=CXX"' hostmakedepends="autoconf-archive autogen gettext automake libtool pkg-config" makedepends="MEGAsdk-devel readline-devel pcre-devel" short_desc="Command Line Interactive and Scriptable Application to access MEGA" -maintainer="John " +maintainer="Orphaned " license="BSD-2-Clause, GPL-3.0-or-later" homepage="https://github.com/meganz/MEGAcmd" distfiles="https://github.com/meganz/MEGAcmd/archive/${version}_Linux.tar.gz" -checksum=8064a21b1d1436537ab9ccc98f1f411f9496aace000584bea87d95f8e7b3a550 +checksum=2a3626a9f1d22303fe2123f984a8ecf3779d6d59ac6c67c1bf43c2423dcb832d replaces="megacmd>=0" if [ "$CROSS_BUILD" ]; then configure_args="--with-libtool-sysroot=${XBPS_CROSS_BASE}" fi +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" + LDFLAGS+=" -latomic" +fi + post_extract() { - sed \ + vsed \ -e '/SUBDIRS.*sdk/d' \ -e '/sdk\/m4/d' \ -e 's:LMEGAINC=.*:PKG_CHECK_MODULES([MEGA],[libmega])\nLMEGAINC=${MEGA_CFLAGS}:' \ -i Makefile.am configure.ac - sed \ + vsed \ -e 's:\$(top_builddir)/sdk/src/libmega\.la:$(MEGA_LIBS):' \ -e 's:mega_cmd_LDADD = .*:&$(MEGA_LIBS):' \ -e 's:^mega_exec_CXXFLAGS.*:&\nmega_exec_LDADD=$(MEGA_LIBS):' \