diff --git a/mingw-w64-octopi-git/0001-Hack-isRootRunning-to-always-be-false-for-_WIN32.patch b/mingw-w64-octopi-git/0001-Hack-isRootRunning-to-always-be-false-for-_WIN32.patch deleted file mode 100644 index 7d993b3059..0000000000 --- a/mingw-w64-octopi-git/0001-Hack-isRootRunning-to-always-be-false-for-_WIN32.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 8d958a00b5ef2dc1c2f48fb795ea3484c8c040ac Mon Sep 17 00:00:00 2001 -From: Ray Donnelly -Date: Thu, 27 Feb 2014 17:00:08 +0000 -Subject: [PATCH 1/5] Hack isRootRunning() to always be false for _WIN32 - ---- - src/unixcommand.h | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/unixcommand.h b/src/unixcommand.h -index 3105307..334cef0 100644 ---- a/src/unixcommand.h -+++ b/src/unixcommand.h -@@ -110,8 +110,12 @@ public: - static bool isAppRunning(const QString &appName, bool justOneInstance = false); - - static bool isRootRunning(){ -+#if defined(_WIN32) -+ return false; -+#else - int uid = geteuid(); - return (uid == 0); //Returns TRUE if root is running Octopi -+#endif - } - - static QFile* getTemporaryFile(){ --- -2.1.0 - diff --git a/mingw-w64-octopi-git/0001-Use-Q_PID-instead-of-int-reducing-QProcess-repititio.patch b/mingw-w64-octopi-git/0001-Use-Q_PID-instead-of-int-reducing-QProcess-repititio.patch new file mode 100644 index 0000000000..1d6ff560ba --- /dev/null +++ b/mingw-w64-octopi-git/0001-Use-Q_PID-instead-of-int-reducing-QProcess-repititio.patch @@ -0,0 +1,154 @@ +From c0ad3d9e7b5fe955bfe1bfda7e6dfd1ec7c85e3d Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Sat, 27 Sep 2014 14:57:41 +0100 +Subject: [PATCH 01/10] Use Q_PID instead of int, reducing QProcess repitition + +Process ids are not ints on all systems +--- + src/utils.cpp | 70 +++++++++++++++++++++++++++++++++++------------------------ + src/utils.h | 6 ++--- + 2 files changed, 45 insertions(+), 31 deletions(-) + +diff --git a/src/utils.cpp b/src/utils.cpp +index 2161190..04ad195 100644 +--- a/src/utils.cpp ++++ b/src/utils.cpp +@@ -77,6 +77,38 @@ void utils::ProcessWrapper::onProcessStarted() + emit startedTerminal(); + } + ++QString Ps_To_Q_PIDs(QString ps_args) ++{ ++ QString out; ++ QProcess proc; ++ proc.start(ps_args); ++ proc.waitForFinished(-1); ++ out = proc.readAll(); ++ proc.close(); ++ return out; ++} ++ ++QStringList Ps_To_Q_PIDs_SL(QString ps_args) ++{ ++ QString out = Ps_To_Q_PIDs(ps_args); ++ QStringList list = out.split("\n", QString::SkipEmptyParts); ++ return list; ++} ++ ++/* ++ * Returns the _PROCESS_INFORMATION* on Windows, does nothing on ++ * others. ++ */ ++Q_PID int_to_Q_PID(int in_pid) ++{ ++ return in_pid; ++} ++ ++int Q_PID_to_int(Q_PID in_pid) ++{ ++ return in_pid; ++} ++ + /* + * We need this to search for the SH process pid (which spaws AUR tool) + */ +@@ -86,21 +118,11 @@ void utils::ProcessWrapper::onSingleShot() + QProcess pAux; + QString saux; + +- proc.start("ps -o pid -C sh"); +- proc.waitForFinished(-1); +- QString out = proc.readAll(); +- proc.close(); +- +- QStringList list = out.split("\n", QString::SkipEmptyParts); ++ QStringList list = Ps_To_Q_PIDs_SL(QLatin1String("ps -o pid -C sh")); + + if (list.count() == 1) + { +- proc.start("ps -o pid -C bash"); +- proc.waitForFinished(-1); +- out = proc.readAll(); +- proc.close(); +- +- list = out.split("\n", QString::SkipEmptyParts); ++ list = Ps_To_Q_PIDs_SL(QLatin1String("ps -o pid -C bash")); + } + + QStringList slist; +@@ -109,12 +131,10 @@ void utils::ProcessWrapper::onSingleShot() + { + int candidatePid = list.at(c).trimmed().toInt(); + +- if (candidatePid < m_pidTerminal) continue; ++ // Determine if candidatePid is a child of m_pidTerminal ++ if (candidatePid < Q_PID_to_int(m_pidTerminal)) continue; + +- QString cmd = QString("ps -O cmd --ppid %1").arg(candidatePid); +- proc.start(cmd); +- proc.waitForFinished(-1); +- QString out = proc.readAll(); ++ QString out = Ps_To_Q_PIDs(QString("ps -O cmd --ppid %1").arg(candidatePid)); + + if (UnixCommand::getLinuxDistro() == ectn_KAOS) + { +@@ -131,8 +151,8 @@ void utils::ProcessWrapper::onSingleShot() + + if (candidatePid < candidatePid2) + { +- m_pidSH = candidatePid; +- m_pidAUR = candidatePid2; ++ m_pidSH = int_to_Q_PID(candidatePid); ++ m_pidAUR = int_to_Q_PID(candidatePid2); + m_timer->start(); + + return; +@@ -155,8 +175,8 @@ void utils::ProcessWrapper::onSingleShot() + + if (candidatePid < candidatePid2) + { +- m_pidSH = candidatePid; +- m_pidAUR = candidatePid2; ++ m_pidSH = int_to_Q_PID(candidatePid); ++ m_pidAUR = int_to_Q_PID(candidatePid2); + m_timer->start(); + + return; +@@ -175,16 +195,10 @@ void utils::ProcessWrapper::onSingleShot() + void utils::ProcessWrapper::onTimer() + { + QProcess proc; +- QString cmd = QString("ps -p %1 %2").arg(m_pidSH).arg(m_pidAUR); ++ QString out = Ps_To_Q_PIDs(QString("ps -p %1 %2").arg(Q_PID_to_int(m_pidSH)).arg(Q_PID_to_int(m_pidAUR))); + + //std::cout << "PIDS: " << cmd.toLatin1().data() << "\n" << std::endl; + +- proc.start(cmd); +- proc.waitForFinished(-1); +- +- //If any of the processes have finished... +- QString out = proc.readAll(); +- + //std::cout << "Output: " << out.toLatin1().data() << "\n" << std::endl; + + if (!out.contains(".qt_temp_", Qt::CaseInsensitive)) +diff --git a/src/utils.h b/src/utils.h +index 54a8edc..a1f79a9 100644 +--- a/src/utils.h ++++ b/src/utils.h +@@ -34,9 +34,9 @@ class ProcessWrapper : public QObject + Q_OBJECT + + private: +- int m_pidTerminal; +- int m_pidSH; +- int m_pidAUR; ++ Q_PID m_pidTerminal; ++ Q_PID m_pidSH; ++ Q_PID m_pidAUR; + QProcess *m_process; + QTimer *m_timer; + QTimer *m_timerSingleShot; +-- +2.1.1 + diff --git a/mingw-w64-octopi-git/0002-Use-a-shared-QProcessEnvironment.patch b/mingw-w64-octopi-git/0002-Use-a-shared-QProcessEnvironment.patch new file mode 100644 index 0000000000..02c99bc4ca --- /dev/null +++ b/mingw-w64-octopi-git/0002-Use-a-shared-QProcessEnvironment.patch @@ -0,0 +1,281 @@ +From f55e9c79fc71f5088bcb0a4c0b376acb4d0158c7 Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Sat, 27 Sep 2014 15:23:27 +0100 +Subject: [PATCH 02/10] Use a shared QProcessEnvironment + +This reduces a lot of repetition. Environment variables +LANG, LC_MESSAGES, LC_ALL are set to "C" for all cases. +--- + octopi.pro | 2 ++ + src/unixcommand.cpp | 88 +++++++++++------------------------------------------ + src/unixcommand.h | 15 +++++++++ + 3 files changed, 35 insertions(+), 70 deletions(-) + +diff --git a/octopi.pro b/octopi.pro +index cac9348..0531b6d 100644 +--- a/octopi.pro ++++ b/octopi.pro +@@ -120,6 +120,8 @@ TRANSLATIONS += resources/translations/octopi_pt_BR.ts \ + resources/translations/octopi_ja.ts \ + resources/translations/octopi_eu.ts + ++win32: LIBS += -lwtsapi32 ++ + greaterThan(QT_MAJOR_VERSION, 4){ + TRANSLATIONS += resources/translations/octopi_ast.ts + } +diff --git a/src/unixcommand.cpp b/src/unixcommand.cpp +index a32b775..6ab57b9 100644 +--- a/src/unixcommand.cpp ++++ b/src/unixcommand.cpp +@@ -36,6 +36,7 @@ + */ + + QFile *UnixCommand::m_temporaryFile = 0; ++QProcessEnvironment *UnixCommand::m_env = 0; + + /* + * Executes given command and returns the StandardError Output. +@@ -43,12 +44,7 @@ QFile *UnixCommand::m_temporaryFile = 0; + QString UnixCommand::runCommand(const QString& commandToRun) + { + QProcess proc; +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.remove("LANG"); +- env.remove("LC_MESSAGES"); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- proc.setProcessEnvironment(env); ++ proc.setProcessEnvironment(getEnv()); + proc.start(commandToRun); + proc.waitForStarted(); + proc.waitForFinished(-1); +@@ -63,10 +59,7 @@ QString UnixCommand::runCommand(const QString& commandToRun) + */ + QString UnixCommand::runCurlCommand(const QString& commandToRun){ + QProcess proc; +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- proc.setProcessEnvironment(env); ++ proc.setProcessEnvironment(getEnv()); + proc.start(commandToRun); + proc.waitForStarted(); + proc.waitForFinished(-1); +@@ -87,10 +80,7 @@ QString UnixCommand::runCurlCommand(const QString& commandToRun){ + */ + QString UnixCommand::discoverBinaryPath(const QString& binary){ + QProcess proc; +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- proc.setProcessEnvironment(env); ++ proc.setProcessEnvironment(getEnv()); + + proc.start("/bin/sh -c \"which " + binary + "\""); + proc.waitForFinished(); +@@ -117,10 +107,7 @@ QString UnixCommand::discoverBinaryPath(const QString& binary){ + bool UnixCommand::cleanPacmanCache() + { + QProcess pacman; +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- pacman.setProcessEnvironment(env); ++ pacman.setProcessEnvironment(getEnv()); + QString commandStr = "\"yes | pacman -Scc\""; + + QString command = WMHelper::getSUCommand() + " " + commandStr; +@@ -138,11 +125,7 @@ QByteArray UnixCommand::performQuery(const QStringList args) + QByteArray result(""); + QProcess pacman; + +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- env.insert("LC_ALL", "C"); +- pacman.setProcessEnvironment(env); ++ pacman.setProcessEnvironment(getEnv()); + + pacman.start("pacman", args); + pacman.waitForFinished(); +@@ -161,11 +144,7 @@ QByteArray UnixCommand::performQuery(const QString &args) + QByteArray result(""); + QProcess pacman; + +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- env.insert("LC_ALL", "C"); +- pacman.setProcessEnvironment(env); ++ pacman.setProcessEnvironment(getEnv()); + + pacman.start("pacman " + args); + pacman.waitForFinished(); +@@ -182,10 +161,7 @@ QByteArray UnixCommand::performAURCommand(const QString &args) + QByteArray result(""); + QProcess aur; + +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- aur.setProcessEnvironment(env); ++ aur.setProcessEnvironment(getEnv()); + + aur.start(StrConstants::getForeignRepositoryToolName() + " " + args); + aur.waitForFinished(); +@@ -202,11 +178,8 @@ QByteArray UnixCommand::getAURPackageList(const QString &searchString) + { + QByteArray result(""); + QProcess aur; +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); + +- aur.setProcessEnvironment(env); ++ aur.setProcessEnvironment(getEnv()); + + if (UnixCommand::getLinuxDistro() == ectn_KAOS) + aur.start(StrConstants::getForeignRepositoryToolName() + " -s " + searchString); +@@ -341,8 +314,7 @@ bool UnixCommand::isPkgfileInstalled() + { + QProcess pkgfile; + +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- pkgfile.setProcessEnvironment(env); ++ pkgfile.setProcessEnvironment(getEnv()); + + pkgfile.start("pkgfile -V"); + pkgfile.waitForFinished(); +@@ -359,10 +331,7 @@ QByteArray UnixCommand::getPackageContentsUsingPkgfile(const QString &pkgName) + { + QByteArray result(""); + QProcess pkgfile; +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- pkgfile.setProcessEnvironment(env); ++ pkgfile.setProcessEnvironment(getEnv()); + + pkgfile.start("pkgfile -l " + pkgName); + pkgfile.waitForFinished(); +@@ -397,10 +366,7 @@ QString UnixCommand::getPackageByFilePath(const QString &filePath) + QStringList UnixCommand::getFilePathSuggestions(const QString &file) + { + QProcess slocate; +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- slocate.setProcessEnvironment(env); ++ slocate.setProcessEnvironment(getEnv()); + slocate.start("slocate -l 8 " + file); + slocate.waitForFinished(); + +@@ -467,10 +433,7 @@ QString UnixCommand::getSystemArchitecture() + { + QStringList slParam; + QProcess proc; +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- proc.setProcessEnvironment(env); ++ proc.setProcessEnvironment(getEnv()); + + slParam << "-m"; + proc.start("uname", slParam); +@@ -524,10 +487,7 @@ bool UnixCommand::hasInternetConnection() + bool UnixCommand::doInternetPingTest() + { + QProcess ping; +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- ping.setProcessEnvironment(env); ++ ping.setProcessEnvironment(getEnv()); + + if (UnixCommand::getLinuxDistro() == ectn_MOOOSLINUX) + ping.start("torsocks ping -c 1 -W 3 www.google.com"); +@@ -549,10 +509,7 @@ bool UnixCommand::isKtsussVersionOK() + { + QProcess proc; + +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- proc.setProcessEnvironment(env); ++ proc.setProcessEnvironment(getEnv()); + + QStringList slParam("-v"); + proc.start("ktsuss", slParam ); +@@ -621,10 +578,7 @@ void UnixCommand::removeTemporaryFiles() + void UnixCommand::execCommand(const QString &pCommand) + { + QProcess p; +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- p.setProcessEnvironment(env); ++ p.setProcessEnvironment(getEnv()); + + p.start(WMHelper::getSUCommand() + "\"" + pCommand + "\""); + p.waitForFinished(-1); +@@ -637,10 +591,7 @@ void UnixCommand::execCommand(const QString &pCommand) + bool UnixCommand::isTextFile(const QString& fileName) + { + QProcess *p = new QProcess(); +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- p->setProcessEnvironment(env); ++ p->setProcessEnvironment(getEnv()); + + QStringList s(fileName); + p->start( "file", s ); +@@ -760,10 +711,7 @@ UnixCommand::UnixCommand(QObject *parent): QObject() + m_process = new QProcess(parent); + m_terminal = new Terminal(parent, SettingsManager::getTerminal()); + +- QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +- env.insert("LANG", "C"); +- env.insert("LC_MESSAGES", "C"); +- m_process->setProcessEnvironment(env); ++ m_process->setProcessEnvironment(getEnv()); + + QObject::connect(m_process, SIGNAL( started() ), this, + SIGNAL( started() )); +diff --git a/src/unixcommand.h b/src/unixcommand.h +index 3105307..89b0f31 100644 +--- a/src/unixcommand.h ++++ b/src/unixcommand.h +@@ -54,6 +54,7 @@ private: + Terminal *m_terminal; + QProcess *m_process; + static QFile *m_temporaryFile; ++ static QProcessEnvironment *m_env; + + public: + UnixCommand(QObject *parent); +@@ -114,6 +115,20 @@ public: + return (uid == 0); //Returns TRUE if root is running Octopi + } + ++ static QProcessEnvironment const& getEnv(){ ++ if (!m_env) ++ { ++ m_env = new QProcessEnvironment(QProcessEnvironment::systemEnvironment()); ++ m_env->remove("LANG"); ++ m_env->remove("LC_MESSAGES"); ++ m_env->remove("LC_ALL"); ++ m_env->insert("LANG", "C"); ++ m_env->insert("LC_MESSAGES", "C"); ++ m_env->insert("LC_ALL", "C"); ++ } ++ return *m_env; ++ } ++ + static QFile* getTemporaryFile(){ + QTime time = QTime::currentTime(); + qsrand(time.minute() + time.second() + time.msec()); +-- +2.1.1 + diff --git a/mingw-w64-octopi-git/0002-Define-QT_WA-as-unicode.patch b/mingw-w64-octopi-git/0003-Define-QT_WA.patch similarity index 61% rename from mingw-w64-octopi-git/0002-Define-QT_WA-as-unicode.patch rename to mingw-w64-octopi-git/0003-Define-QT_WA.patch index 85a113a471..ec113578f9 100644 --- a/mingw-w64-octopi-git/0002-Define-QT_WA-as-unicode.patch +++ b/mingw-w64-octopi-git/0003-Define-QT_WA.patch @@ -1,27 +1,25 @@ -From a0d6e7f38f1af68cd0f3aa88edc0c98463458fbb Mon Sep 17 00:00:00 2001 +From 49f2c29096f5de952c9c159baf2d9596e2ac3c26 Mon Sep 17 00:00:00 2001 From: Ray Donnelly -Date: Thu, 27 Feb 2014 17:06:21 +0000 -Subject: [PATCH 2/5] Define QT_WA() as unicode +Date: Sat, 27 Sep 2014 15:02:24 +0100 +Subject: [PATCH 03/10] Define QT_WA --- - src/QtSolutions/qtlockedfile_win.cpp | 4 ++++ - 1 file changed, 4 insertions(+) + src/QtSolutions/qtlockedfile_win.cpp | 2 ++ + 1 file changed, 2 insertions(+) diff --git a/src/QtSolutions/qtlockedfile_win.cpp b/src/QtSolutions/qtlockedfile_win.cpp -index 4cd2003..6aa3921 100755 +index 4cd2003..c28aae8 100755 --- a/src/QtSolutions/qtlockedfile_win.cpp +++ b/src/QtSolutions/qtlockedfile_win.cpp -@@ -45,6 +45,10 @@ +@@ -45,6 +45,8 @@ // Maximum number of concurrent read locks. Must not be greater than MAXIMUM_WAIT_OBJECTS #define MAX_READERS MAXIMUM_WAIT_OBJECTS -+#if QT_VERSION >= 0x050000 +#define QT_WA(unicode, ansi) unicode -+#endif + Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate) { if (mutexname.isEmpty()) { -- -2.1.0 +2.1.1 diff --git a/mingw-w64-octopi-git/0003-Win32-Use-WTSEnumerateProcesses-instead-of-ps.patch b/mingw-w64-octopi-git/0003-Win32-Use-WTSEnumerateProcesses-instead-of-ps.patch deleted file mode 100644 index 9c66ef4422..0000000000 --- a/mingw-w64-octopi-git/0003-Win32-Use-WTSEnumerateProcesses-instead-of-ps.patch +++ /dev/null @@ -1,213 +0,0 @@ -From 187473cb1f86e76615cee40c8269051bc05f3c5b Mon Sep 17 00:00:00 2001 -From: Ray Donnelly -Date: Thu, 27 Feb 2014 17:07:39 +0000 -Subject: [PATCH 3/5] Win32: Use WTSEnumerateProcesses() instead of ps - -Use Q_PIDs instead of ints for process ids too. - -Work in progress. ---- - octopi.pro | 2 + - src/QtSolutions/qtlockedfile_win.cpp | 2 - - src/utils.cpp | 105 +++++++++++++++++++++++++++++++++-- - src/utils.h | 6 +- - 4 files changed, 104 insertions(+), 11 deletions(-) - -diff --git a/octopi.pro b/octopi.pro -index d9865f6..a87f550 100644 ---- a/octopi.pro -+++ b/octopi.pro -@@ -134,6 +134,8 @@ TRANSLATIONS += resources/translations/octopi_pt_BR.ts \ - resources/translations/octopi_ja.ts \ - resources/translations/octopi_eu.ts - -+win32: LIBS += -lwtsapi32 -+ - greaterThan(QT_MAJOR_VERSION, 4){ - TRANSLATIONS += resources/translations/octopi_ast.ts - } -diff --git a/src/QtSolutions/qtlockedfile_win.cpp b/src/QtSolutions/qtlockedfile_win.cpp -index 6aa3921..c28aae8 100755 ---- a/src/QtSolutions/qtlockedfile_win.cpp -+++ b/src/QtSolutions/qtlockedfile_win.cpp -@@ -45,9 +45,7 @@ - // Maximum number of concurrent read locks. Must not be greater than MAXIMUM_WAIT_OBJECTS - #define MAX_READERS MAXIMUM_WAIT_OBJECTS - --#if QT_VERSION >= 0x050000 - #define QT_WA(unicode, ansi) unicode --#endif - - Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate) - { -diff --git a/src/utils.cpp b/src/utils.cpp -index c1edca6..e570068 100644 ---- a/src/utils.cpp -+++ b/src/utils.cpp -@@ -35,6 +35,12 @@ - #include - #include - #include -+#include -+ -+#if defined(Q_OS_WIN) -+#include -+#include -+#endif - - /* - * The needed constructor -@@ -77,6 +83,92 @@ void utils::ProcessWrapper::onProcessStarted() - emit startedTerminal(); - } - -+QStringList Ps_To_Q_PIDs(QString ps_args) -+{ -+ QStringList list; -+#if defined(Q_OS_WIN) -+ QString ps_name; -+ QStringList in_pids; -+ if (ps_args.startsWith(QLatin1String("ps -o pid -C"))) -+ { -+ ps_name = ps_args.remove(QLatin1String("ps -o pid -C")).trimmed(); -+ } -+ else if (ps_args.startsWith(QLatin1String("ps -O cmd --ppid"))) -+ { -+ in_pids.append(ps_args.remove("ps -O cmd --ppid").trimmed()); -+ } -+ else if (ps_args.startsWith(QLatin1String("ps -p"))) -+ { -+ QString temp = ps_args.remove("ps -p").trimmed(); -+ QTextStream pid_args(&temp); -+ while (!pid_args.atEnd()) -+ { -+ QString a_pid; -+ pid_args >> a_pid; -+ in_pids.append(a_pid); -+ } -+ } -+ WTS_PROCESS_INFO* pProcessInfo = 0; -+ DWORD Count; -+ if(WTSEnumerateProcesses(WTS_CURRENT_SERVER_HANDLE, 0, 1, &pProcessInfo, &Count)) -+ { -+ for(DWORD i = 0; i < Count; i++) -+ { -+ qDebug() << pProcessInfo[i].pProcessName << "\tPID=" -+ << pProcessInfo[i].ProcessId << "\tSess=" -+ << pProcessInfo[i].SessionId; -+ QString process_name = QString::fromWCharArray(pProcessInfo[i].pProcessName); -+ if (!ps_name.isEmpty()) -+ { -+ list.append("PID"); -+ if (ps_name == process_name) -+ { -+ list.append(QString::number(pProcessInfo[i].ProcessId)); -+ return list; -+ } -+ } -+ } -+// BOOL WINAPI EnumProcesses( -+// _Out_ DWORD *pProcessIds, -+// _In_ DWORD cb, -+// _Out_ DWORD *pBytesReturned -+// ); -+ } -+#else -+ QProcess proc; -+ proc.start(ps_args); -+ proc.waitForFinished(-1); -+ QString out = proc.readAll(); -+ proc.close(); -+ QStringList list = out.split("\n", QString::SkipEmptyParts); -+#endif -+ return list; -+} -+ -+/* -+ * Returns the _PROCESS_INFORMATION* on Windows, does nothing on -+ * others. -+ */ -+Q_PID int_to_Q_PID(int in_pid) -+{ -+#if defined(Q_OS_WIN) -+ Q_UNUSED(in_pid); -+ return 0; -+#else -+ return in_pid -+#endif -+} -+ -+int Q_PID_to_int(Q_PID in_pid) -+{ -+#if defined(Q_OS_WIN) -+ Q_UNUSED(in_pid); -+ return 1; -+#else -+ return in_pid; -+#endif -+} -+ - /* - * We need this to search for the SH process pid (which spaws AUR tool) - */ -@@ -109,7 +201,8 @@ void utils::ProcessWrapper::onSingleShot() - { - int candidatePid = list.at(c).trimmed().toInt(); - -- if (candidatePid < m_pidTerminal) continue; -+ // This if appears to be being used to determine if candidatePid is a child of m_pidTerminal?! -+ if (candidatePid < Q_PID_to_int(m_pidTerminal)) continue; - - QString cmd = QString("ps -O cmd --ppid %1").arg(candidatePid); - proc.start(cmd); -@@ -131,8 +224,8 @@ void utils::ProcessWrapper::onSingleShot() - - if (candidatePid < candidatePid2) - { -- m_pidSH = candidatePid; -- m_pidAUR = candidatePid2; -+ m_pidSH = int_to_Q_PID(candidatePid); -+ m_pidAUR = int_to_Q_PID(candidatePid2); - m_timer->start(); - - return; -@@ -155,8 +248,8 @@ void utils::ProcessWrapper::onSingleShot() - - if (candidatePid < candidatePid2) - { -- m_pidSH = candidatePid; -- m_pidAUR = candidatePid2; -+ m_pidSH = int_to_Q_PID(candidatePid); -+ m_pidAUR = int_to_Q_PID(candidatePid2); - m_timer->start(); - - return; -@@ -175,7 +268,7 @@ void utils::ProcessWrapper::onSingleShot() - void utils::ProcessWrapper::onTimer() - { - QProcess proc; -- QString cmd = QString("ps -p %1 %2").arg(m_pidSH).arg(m_pidAUR); -+ QString cmd = QString("ps -p %1 %2").arg(Q_PID_to_int(m_pidSH)).arg(Q_PID_to_int(m_pidAUR)); - - //std::cout << "PIDS: " << cmd.toLatin1().data() << "\n" << std::endl; - -diff --git a/src/utils.h b/src/utils.h -index 54a8edc..a1f79a9 100644 ---- a/src/utils.h -+++ b/src/utils.h -@@ -34,9 +34,9 @@ class ProcessWrapper : public QObject - Q_OBJECT - - private: -- int m_pidTerminal; -- int m_pidSH; -- int m_pidAUR; -+ Q_PID m_pidTerminal; -+ Q_PID m_pidSH; -+ Q_PID m_pidAUR; - QProcess *m_process; - QTimer *m_timer; - QTimer *m_timerSingleShot; --- -2.1.0 - diff --git a/mingw-w64-octopi-git/0004-MSYS2-Add-ectn_MSYS2-as-a-LinuxDistro.patch b/mingw-w64-octopi-git/0004-MSYS2-Add-ectn_MSYS2-as-a-LinuxDistro.patch new file mode 100644 index 0000000000..aa23268080 --- /dev/null +++ b/mingw-w64-octopi-git/0004-MSYS2-Add-ectn_MSYS2-as-a-LinuxDistro.patch @@ -0,0 +1,48 @@ +From 77c8fd4a2f7a6f5f6bcb46193d2af395b21a1e7d Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Sat, 27 Sep 2014 15:31:32 +0100 +Subject: [PATCH 04/10] MSYS2: Add ectn_MSYS2 as a LinuxDistro + +--- + src/unixcommand.cpp | 4 ++++ + src/unixcommand.h | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/unixcommand.cpp b/src/unixcommand.cpp +index 6ab57b9..c319796 100644 +--- a/src/unixcommand.cpp ++++ b/src/unixcommand.cpp +@@ -867,6 +867,9 @@ QStringList UnixCommand::getIgnorePkg() + LinuxDistro UnixCommand::getLinuxDistro() + { + static LinuxDistro ret; ++#if defined(Q_OS_WIN) ++ ret = ectn_MSYS2; ++#else + static bool firstTime = true; + + if (firstTime) +@@ -926,6 +929,7 @@ LinuxDistro UnixCommand::getLinuxDistro() + file.close(); + } + } ++#endif + + return ret; + } +diff --git a/src/unixcommand.h b/src/unixcommand.h +index 89b0f31..9efebd2 100644 +--- a/src/unixcommand.h ++++ b/src/unixcommand.h +@@ -37,7 +37,7 @@ enum CommandExecuting { ectn_NONE, ectn_MIRROR_CHECK, ectn_SYNC_DATABASE, + ectn_RUN_IN_TERMINAL }; + + enum LinuxDistro { ectn_ANTERGOS, ectn_ARCHBANGLINUX, ectn_ARCHBSD, ectn_ARCHLINUX, ectn_CHAKRA, +- ectn_KAOS, ectn_MANJAROLINUX, ectn_MOOOSLINUX, ectn_NETRUNNER, ectn_UNKNOWN }; ++ ectn_KAOS, ectn_MANJAROLINUX, ectn_MOOOSLINUX, ectn_NETRUNNER, ectn_MSYS2, ectn_UNKNOWN }; + + //Forward class declarations. + class QString; +-- +2.1.1 + diff --git a/mingw-w64-octopi-git/0004-Win32-Add-some-path-checks-to-sh.exe-as-getSUCommand.patch b/mingw-w64-octopi-git/0004-Win32-Add-some-path-checks-to-sh.exe-as-getSUCommand.patch deleted file mode 100644 index 15f50951bf..0000000000 --- a/mingw-w64-octopi-git/0004-Win32-Add-some-path-checks-to-sh.exe-as-getSUCommand.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 658957a94f2c290bbc180f24aeafbca4ac576d1f Mon Sep 17 00:00:00 2001 -From: Ray Donnelly -Date: Thu, 27 Feb 2014 23:21:00 +0000 -Subject: [PATCH 4/5] Win32: Add some path checks to sh.exe as getSUCommand() - for _WIN32 - -Relative path, working directory and then some hardcoded paths are -checked. ---- - src/wmhelper.cpp | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - -diff --git a/src/wmhelper.cpp b/src/wmhelper.cpp -index 187087e..6ea6fa2 100644 ---- a/src/wmhelper.cpp -+++ b/src/wmhelper.cpp -@@ -292,6 +292,24 @@ QString WMHelper::getGKSUCommand(){ - QString WMHelper::getSUCommand(){ - QString result(ctn_NO_SU_COMMAND); - -+#if defined(_WIN32) -+ QString testPath = QCoreApplication::applicationDirPath() + QLatin1String("/../../bin/sh.exe"); -+ if (QFile::exists(testPath)) -+ { -+ return testPath + QLatin1String(" -c "); -+ } -+ /* For use when hacking on this, could remove finally. */ -+ testPath = QDir::currentPath() + QLatin1String("/sh.exe"); -+ if (QFile::exists(testPath)) -+ { -+ return testPath + QLatin1String(" -c "); -+ } -+ // Return a semi reasonable default. -+#if Q_OS_WIN32 -+ return QLatin1String("/msys32/usr/bin/sh.exe -c "); -+#else -+ return QLatin1String("/msys64/usr/bin/sh.exe -c "); -+#endif - if (isXFCERunning() && (UnixCommand::hasTheExecutable(ctn_GKSU_2))){ - result = getGKSUCommand(); - } --- -2.1.0 - diff --git a/mingw-w64-octopi-git/0005-MSYS2-Add-getMSYS2Root.patch b/mingw-w64-octopi-git/0005-MSYS2-Add-getMSYS2Root.patch new file mode 100644 index 0000000000..b71003fa0c --- /dev/null +++ b/mingw-w64-octopi-git/0005-MSYS2-Add-getMSYS2Root.patch @@ -0,0 +1,78 @@ +From 1945068f7841780f3d1fa7522099bb965be86bab Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Sat, 27 Sep 2014 15:38:23 +0100 +Subject: [PATCH 05/10] MSYS2: Add getMSYS2Root() + +Because MSYS2 can be installed anywhere, the real location +is determined using a relative path from octopi.exe +--- + src/unixcommand.cpp | 1 + + src/unixcommand.h | 19 +++++++++++++++++++ + 2 files changed, 20 insertions(+) + +diff --git a/src/unixcommand.cpp b/src/unixcommand.cpp +index c319796..6a908b2 100644 +--- a/src/unixcommand.cpp ++++ b/src/unixcommand.cpp +@@ -37,6 +37,7 @@ + + QFile *UnixCommand::m_temporaryFile = 0; + QProcessEnvironment *UnixCommand::m_env = 0; ++QString UnixCommand::m_msys2Root; + + /* + * Executes given command and returns the StandardError Output. +diff --git a/src/unixcommand.h b/src/unixcommand.h +index 9efebd2..612acbe 100644 +--- a/src/unixcommand.h ++++ b/src/unixcommand.h +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include + + #include "package.h" +@@ -55,6 +56,7 @@ private: + QProcess *m_process; + static QFile *m_temporaryFile; + static QProcessEnvironment *m_env; ++ static QString m_msys2Root; + + public: + UnixCommand(QObject *parent); +@@ -115,6 +117,14 @@ public: + return (uid == 0); //Returns TRUE if root is running Octopi + } + ++ static QString getMSYS2Root(){ ++ if (m_msys2Root.isEmpty()) ++ { ++ m_msys2Root = QDir::cleanPath(QCoreApplication::applicationDirPath() + QLatin1String("/../..")); ++ } ++ return m_msys2Root; ++ } ++ + static QProcessEnvironment const& getEnv(){ + if (!m_env) + { +@@ -125,6 +135,15 @@ public: + m_env->insert("LANG", "C"); + m_env->insert("LC_MESSAGES", "C"); + m_env->insert("LC_ALL", "C"); ++ if (UnixCommand::getLinuxDistro() == ectn_MSYS2) ++ { ++ getMSYS2Root(); ++ QString path = m_env->value(QLatin1String("PATH")); ++ QString msys2_usr_bin = QDir::cleanPath(m_msys2Root + "\\usr\\bin"); ++ path.prepend(msys2_usr_bin+QLatin1Char(';')); ++ _wputenv_s(L"PATH", path.toStdWString().c_str()); ++ m_env->insert("PATH", path); ++ } + } + return *m_env; + } +-- +2.1.1 + diff --git a/mingw-w64-octopi-git/0006-MSYS2-hasPacmanDatabase-getMSYS2Root-changes.patch b/mingw-w64-octopi-git/0006-MSYS2-hasPacmanDatabase-getMSYS2Root-changes.patch new file mode 100644 index 0000000000..28bc7ef5ed --- /dev/null +++ b/mingw-w64-octopi-git/0006-MSYS2-hasPacmanDatabase-getMSYS2Root-changes.patch @@ -0,0 +1,51 @@ +From 2f8a0cceff1983365b65396b52c52a24ea77f74c Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Sat, 27 Sep 2014 15:40:36 +0100 +Subject: [PATCH 06/10] MSYS2: hasPacmanDatabase() getMSYS2Root() changes + +--- + src/package.cpp | 11 ++++++++++- + src/package.h | 5 +++-- + 2 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/src/package.cpp b/src/package.cpp +index 3795e54..648edb6 100644 +--- a/src/package.cpp ++++ b/src/package.cpp +@@ -1210,7 +1210,16 @@ bool Package::hasPacmanDatabase() + + if (!done) + { +- QFile f(ctn_PACMAN_CORE_DB_FILE); ++ QString dbFile; ++ if (UnixCommand::getLinuxDistro() == ectn_MSYS2) ++ { ++ dbFile = UnixCommand::getMSYS2Root() + ctn_PACMAN_MSYS2_DB_FILE; ++ } ++ else ++ { ++ dbFile = ctn_PACMAN_CORE_DB_FILE; ++ } ++ QFile f(dbFile); + answer = f.exists(); + done = true; + } +diff --git a/src/package.h b/src/package.h +index 173f714..cb2b4f0 100644 +--- a/src/package.h ++++ b/src/package.h +@@ -40,8 +40,9 @@ const QString ctn_STRING_RELEASES = "(alfa|beta|rc|pre|patch|^[0-9]{8}$|(^[rR] + const QString ctn_DATE_RELEASE = "^[0-9]{8}$"; + const QString ctn_NO_MATCH = "not found!"; + +-const QString ctn_PACMAN_DATABASE_DIR = "/var/lib/pacman"; +-const QString ctn_PACMAN_CORE_DB_FILE = "/var/lib/pacman/sync/core.db"; ++const QString ctn_PACMAN_DATABASE_DIR = "/var/lib/pacman"; ++const QString ctn_PACMAN_CORE_DB_FILE = "/var/lib/pacman/sync/core.db"; ++const QString ctn_PACMAN_MSYS2_DB_FILE = "/var/lib/pacman/sync/msys.db"; + + enum PackageStatus { ectn_INSTALLED, ectn_NON_INSTALLED, ectn_OUTDATED, ectn_NEWER, + ectn_FOREIGN, ectn_FOREIGN_OUTDATED }; +-- +2.1.1 + diff --git a/mingw-w64-octopi-git/0007-MSYS2-openRootTerminal-getSUCommand-isRootRunning.patch b/mingw-w64-octopi-git/0007-MSYS2-openRootTerminal-getSUCommand-isRootRunning.patch new file mode 100644 index 0000000000..2ecebf92d8 --- /dev/null +++ b/mingw-w64-octopi-git/0007-MSYS2-openRootTerminal-getSUCommand-isRootRunning.patch @@ -0,0 +1,88 @@ +From e17b51b890abb845900a5fd9d68d430f587fc7f2 Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Sat, 27 Sep 2014 15:42:50 +0100 +Subject: [PATCH 07/10] MSYS2: openRootTerminal(), getSUCommand(), + isRootRunning() + +MSYS2 behaviour changes for these: +openRootTerminal runs msys2_shell.bat +getSUCommand returns "sh.exe -c " +isRootRunning returns false +--- + src/terminal.cpp | 7 ++++++- + src/unixcommand.h | 6 ++++++ + src/wmhelper.cpp | 5 ++++- + src/wmhelper.h | 2 ++ + 4 files changed, 18 insertions(+), 2 deletions(-) + +diff --git a/src/terminal.cpp b/src/terminal.cpp +index 5085007..0495acc 100644 +--- a/src/terminal.cpp ++++ b/src/terminal.cpp +@@ -198,7 +198,12 @@ void Terminal::openRootTerminal() + { + if (m_selectedTerminal == ctn_AUTOMATIC) + { +- if (UnixCommand::getLinuxDistro() == ectn_MOOOSLINUX && UnixCommand::hasTheExecutable(ctn_RXVT_TERMINAL)) ++ if (UnixCommand::getLinuxDistro() == ectn_MSYS2) ++ { ++ QString cmd = ctn_MSYS2_SH + UnixCommand::getMSYS2Root() + QLatin1String("/msys2_shell.bat"); ++ m_process->startDetached(cmd); ++ } ++ else if (UnixCommand::getLinuxDistro() == ectn_MOOOSLINUX && UnixCommand::hasTheExecutable(ctn_RXVT_TERMINAL)) + { + QString cmd = WMHelper::getSUCommand() + " \"" + ctn_RXVT_TERMINAL + + " -name Urxvt -title Urxvt \""; +diff --git a/src/unixcommand.h b/src/unixcommand.h +index 612acbe..6450fae 100644 +--- a/src/unixcommand.h ++++ b/src/unixcommand.h +@@ -112,10 +112,16 @@ public: + static bool hasTheExecutable( const QString& exeName ); + static bool isAppRunning(const QString &appName, bool justOneInstance = false); + ++#if defined(_WIN32) ++ static bool isRootRunning(){ ++ return false; ++ } ++#else + static bool isRootRunning(){ + int uid = geteuid(); + return (uid == 0); //Returns TRUE if root is running Octopi + } ++#endif + + static QString getMSYS2Root(){ + if (m_msys2Root.isEmpty()) +diff --git a/src/wmhelper.cpp b/src/wmhelper.cpp +index 187087e..4ce7e1a 100644 +--- a/src/wmhelper.cpp ++++ b/src/wmhelper.cpp +@@ -292,7 +292,10 @@ QString WMHelper::getGKSUCommand(){ + QString WMHelper::getSUCommand(){ + QString result(ctn_NO_SU_COMMAND); + +- if (isXFCERunning() && (UnixCommand::hasTheExecutable(ctn_GKSU_2))){ ++ if (UnixCommand::getLinuxDistro() == ectn_MSYS2){ ++ return QLatin1String("sh.exe -c "); ++ } ++ else if (isXFCERunning() && (UnixCommand::hasTheExecutable(ctn_GKSU_2))){ + result = getGKSUCommand(); + } + else if (isKDERunning() && UnixCommand::hasTheExecutable(ctn_KDESU)){ +diff --git a/src/wmhelper.h b/src/wmhelper.h +index e96e0b4..ae9405c 100644 +--- a/src/wmhelper.h ++++ b/src/wmhelper.h +@@ -25,6 +25,8 @@ + + const QString ctn_NO_SU_COMMAND("none"); + const QString ctn_ROOT_SH("/bin/sh -c "); ++const QString ctn_MSYS2_SH("cmd.exe /c "); ++ + const QString ctn_KDESU("kdesu"); + const QString ctn_KDE_DESKTOP("kwin"); + const QString ctn_KDE_EDITOR("kwrite"); +-- +2.1.1 + diff --git a/mingw-w64-octopi-git/0008-MSYS2-Process-id-changes-WIP.patch b/mingw-w64-octopi-git/0008-MSYS2-Process-id-changes-WIP.patch new file mode 100644 index 0000000000..e9a3a508d4 --- /dev/null +++ b/mingw-w64-octopi-git/0008-MSYS2-Process-id-changes-WIP.patch @@ -0,0 +1,144 @@ +From 39b67c44cf441cbe19ea67ada31dcdf6039da8b2 Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Sat, 27 Sep 2014 15:44:22 +0100 +Subject: [PATCH 08/10] MSYS2: Process id changes (WIP) + +--- + notifier/octopi-notifier/octopi-notifier.pro | 2 + + src/utils.cpp | 77 ++++++++++++++++++++++++++++ + 2 files changed, 79 insertions(+) + +diff --git a/notifier/octopi-notifier/octopi-notifier.pro b/notifier/octopi-notifier/octopi-notifier.pro +index fc942b1..262822a 100644 +--- a/notifier/octopi-notifier/octopi-notifier.pro ++++ b/notifier/octopi-notifier/octopi-notifier.pro +@@ -49,6 +49,8 @@ HEADERS += \ + ../../src/utils.h \ + ../../src/transactiondialog.h + ++win32: LIBS += -lwtsapi32 ++ + FORMS += ../../ui/transactiondialog.ui + + RESOURCES += \ +diff --git a/src/utils.cpp b/src/utils.cpp +index 04ad195..53e890c 100644 +--- a/src/utils.cpp ++++ b/src/utils.cpp +@@ -35,6 +35,12 @@ + #include + #include + #include ++#include ++ ++#if defined(Q_OS_WIN) ++#include ++#include ++#endif + + /* + * The needed constructor +@@ -77,8 +83,63 @@ void utils::ProcessWrapper::onProcessStarted() + emit startedTerminal(); + } + ++#if defined(Q_OS_WIN) ++QString Ps_To_Q_PIDs(QString ps_args) ++{ ++ QString ps_name; ++ QString out; ++ QStringList in_pids; ++ if (ps_args.startsWith(QLatin1String("ps -o pid -C"))) ++ { ++ ps_name = ps_args.remove(QLatin1String("ps -o pid -C")).trimmed(); ++ } ++ else if (ps_args.startsWith(QLatin1String("ps -O cmd --ppid"))) ++ { ++ in_pids.append(ps_args.remove("ps -O cmd --ppid").trimmed()); ++ } ++ else if (ps_args.startsWith(QLatin1String("ps -p"))) ++ { ++ QString temp = ps_args.remove("ps -p").trimmed(); ++ QTextStream pid_args(&temp); ++ while (!pid_args.atEnd()) ++ { ++ QString a_pid; ++ pid_args >> a_pid; ++ in_pids.append(a_pid); ++ } ++ } ++ WTS_PROCESS_INFO* pProcessInfo = 0; ++ DWORD Count; ++ if(WTSEnumerateProcesses(WTS_CURRENT_SERVER_HANDLE, 0, 1, &pProcessInfo, &Count)) ++ { ++ for(DWORD i = 0; i < Count; i++) ++ { ++ qDebug() << pProcessInfo[i].pProcessName << "\tPID=" ++ << pProcessInfo[i].ProcessId << "\tSess=" ++ << pProcessInfo[i].SessionId; ++ QString process_name = QString::fromWCharArray(pProcessInfo[i].pProcessName); ++ if (!ps_name.isEmpty()) ++ { ++ out += QLatin1String("PID\n"); ++ if (ps_name == process_name) ++ { ++ out += QString::number(pProcessInfo[i].ProcessId) + QLatin1String("\n"); ++ return out; ++ } ++ } ++ } ++// BOOL WINAPI EnumProcesses( ++// _Out_ DWORD *pProcessIds, ++// _In_ DWORD cb, ++// _Out_ DWORD *pBytesReturned ++// ); ++ } ++ return out; ++} ++#else /* !defined(Q_OS_WIN) */ + QString Ps_To_Q_PIDs(QString ps_args) + { ++ QStringList list; + QString out; + QProcess proc; + proc.start(ps_args); +@@ -87,6 +148,7 @@ QString Ps_To_Q_PIDs(QString ps_args) + proc.close(); + return out; + } ++#endif /* defined(Q_OS_WIN) */ + + QStringList Ps_To_Q_PIDs_SL(QString ps_args) + { +@@ -95,6 +157,20 @@ QStringList Ps_To_Q_PIDs_SL(QString ps_args) + return list; + } + ++#if defined(Q_OS_WIN) ++Q_PID int_to_Q_PID(int in_pid) ++{ ++ Q_UNUSED(in_pid); ++ return 0; ++} ++ ++int Q_PID_to_int(Q_PID in_pid) ++{ ++ Q_UNUSED(in_pid); ++ return 1; ++} ++ ++#else + /* + * Returns the _PROCESS_INFORMATION* on Windows, does nothing on + * others. +@@ -108,6 +184,7 @@ int Q_PID_to_int(Q_PID in_pid) + { + return in_pid; + } ++#endif + + /* + * We need this to search for the SH process pid (which spaws AUR tool) +-- +2.1.1 + diff --git a/mingw-w64-octopi-git/0005-Hack-around-crash-on-files-tab-due-to-null-pointer.patch b/mingw-w64-octopi-git/0009-MSYS2-Hack-around-crash-in-refreshTabFiles.patch similarity index 79% rename from mingw-w64-octopi-git/0005-Hack-around-crash-on-files-tab-due-to-null-pointer.patch rename to mingw-w64-octopi-git/0009-MSYS2-Hack-around-crash-in-refreshTabFiles.patch index 4a66be6971..b18f9a27b8 100644 --- a/mingw-w64-octopi-git/0005-Hack-around-crash-on-files-tab-due-to-null-pointer.patch +++ b/mingw-w64-octopi-git/0009-MSYS2-Hack-around-crash-in-refreshTabFiles.patch @@ -1,7 +1,7 @@ -From c8efce3b7bc5f35e32dbfb41265102fd80e8f2fc Mon Sep 17 00:00:00 2001 +From 0669400a5a6d03c1952058a243eda07e421d0af3 Mon Sep 17 00:00:00 2001 From: Ray Donnelly -Date: Sun, 21 Sep 2014 13:49:06 +0100 -Subject: [PATCH 5/5] Hack around crash on files tab due to null pointer +Date: Sat, 27 Sep 2014 15:44:55 +0100 +Subject: [PATCH 09/10] MSYS2: Hack around crash in refreshTabFiles --- src/mainwindow_refresh.cpp | 5 ++++- @@ -24,5 +24,5 @@ index a94bfe7..ad1b92f 100644 lastItem = item; -- -2.1.0 +2.1.1 diff --git a/mingw-w64-octopi-git/PKGBUILD b/mingw-w64-octopi-git/PKGBUILD index a816d7bf1f..16b40617f1 100644 --- a/mingw-w64-octopi-git/PKGBUILD +++ b/mingw-w64-octopi-git/PKGBUILD @@ -5,7 +5,7 @@ _realname=octopi pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-git" #_qmake=${MINGW_PREFIX}/bin/qmake _qmake=${MINGW_PREFIX}/qt5-static/bin/qmake -pkgver=r664.ab036cc +pkgver=r669.3a5a95b pkgrel=1 pkgdesc="a powerful Pacman frontend using Qt libs" arch=('any') @@ -19,17 +19,25 @@ _gitroot="git://github.com/aarnt/octopi.git" _gitname="octopi" options=('!debug' 'strip') source=("${_gitname}"::"${_gitroot}" - "0001-Hack-isRootRunning-to-always-be-false-for-_WIN32.patch" - "0002-Define-QT_WA-as-unicode.patch" - "0003-Win32-Use-WTSEnumerateProcesses-instead-of-ps.patch" - "0004-Win32-Add-some-path-checks-to-sh.exe-as-getSUCommand.patch" - "0005-Hack-around-crash-on-files-tab-due-to-null-pointer.patch") -# "old.0004-Hack-out-ProcessWrapper-onSingleShot-to-do-nothing-o.patch" + "0001-Use-Q_PID-instead-of-int-reducing-QProcess-repititio.patch" + "0002-Use-a-shared-QProcessEnvironment.patch" + "0003-Define-QT_WA.patch" + "0004-MSYS2-Add-ectn_MSYS2-as-a-LinuxDistro.patch" + "0005-MSYS2-Add-getMSYS2Root.patch" + "0006-MSYS2-hasPacmanDatabase-getMSYS2Root-changes.patch" + "0007-MSYS2-openRootTerminal-getSUCommand-isRootRunning.patch" + "0008-MSYS2-Process-id-changes-WIP.patch" + "0009-MSYS2-Hack-around-crash-in-refreshTabFiles.patch") md5sums=('SKIP' - '3bbbab131226b676e98038d5b6a4659d' - '8635ce41ec1433eba9092f4048416c7f' - 'c4ad0455ecf23a58605989d197a612ec' - '60e34b0dbff63a9d8e00edb2f7c14338') + 'fcdd32a9572ffced35f57f7f46db1820' + 'd262cdaa522b0e59691cd0a525530c8b' + '11e8baa5f61075d38917fc01f42ecb8c' + '98d19f39fee5e12a8991e22ecfc3c4b1' + 'aa445f3a99c7b18ce94c258439e517c5' + '7a1d2a340764ecec0b0cbc1fe68cf6b2' + '92ad3ec27964331c7b89283a30e65736' + '173b6b8d21151f3f31b850ef38bc6658' + '9b6e01ebbabc7158f91cdbeed7112faf') pkgver() { cd "$srcdir/$_realname" @@ -39,12 +47,16 @@ pkgver() { prepare() { cd "$srcdir/$_gitname" - git am "${srcdir}"/0001-Hack-isRootRunning-to-always-be-false-for-_WIN32.patch - git am "${srcdir}"/0002-Define-QT_WA-as-unicode.patch - git am "${srcdir}"/0003-Win32-Use-WTSEnumerateProcesses-instead-of-ps.patch - # git am "${srcdir}"/old.0004-Hack-out-ProcessWrapper-onSingleShot-to-do-nothing-o.patch - git am "${srcdir}"/0004-Win32-Add-some-path-checks-to-sh.exe-as-getSUCommand.patch - git am "${srcdir}"/0005-Hack-around-crash-on-files-tab-due-to-null-pointer.patch + git am "${srcdir}"/0001-Use-Q_PID-instead-of-int-reducing-QProcess-repititio.patch + git am "${srcdir}"/0002-Use-a-shared-QProcessEnvironment.patch + git am "${srcdir}"/0003-Define-QT_WA.patch + git am "${srcdir}"/0004-MSYS2-Add-ectn_MSYS2-as-a-LinuxDistro.patch + git am "${srcdir}"/0005-MSYS2-Add-getMSYS2Root.patch + git am "${srcdir}"/0006-MSYS2-hasPacmanDatabase-getMSYS2Root-changes.patch + git am "${srcdir}"/0007-MSYS2-openRootTerminal-getSUCommand-isRootRunning.patch + git am "${srcdir}"/0008-MSYS2-Process-id-changes-WIP.patch + git am "${srcdir}"/0009-MSYS2-Hack-around-crash-in-refreshTabFiles.patch +# git am "${srcdir}"/0010-Debugging.patch } build() {