octopi-git: More patching, nearly ready?

discoverBinaryPath and runCommandInTerminal fixed up.
Seems that the status-bar update after pacman sync is
not happening so that should be fixed before a release
This commit is contained in:
Ray Donnelly
2014-09-30 23:38:30 +01:00
parent 19e345c25c
commit a68ae12dc0
15 changed files with 181 additions and 69 deletions

View File

@@ -3,7 +3,7 @@
_realname=meld
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}3"
pkgver=3.12.0
pkgrel=1
pkgrel=2
pkgdesc="Visual diff and merge tool (mingw-w64)"
arch=('any')
url="http://meldmerge.org/"
@@ -49,4 +49,7 @@ package() {
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python2 setup.py --no-update-icon-cache --no-compile-schemas \
install --prefix=${MINGW_PREFIX} --root="${pkgdir}"
PREFIX_WIN=$(pwd -W)
sed -s "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" \
-i ${pkgdir}${MINGW_PREFIX}/bin/meld
}

View File

@@ -1,7 +1,7 @@
From 58ed95f3c11f6a6d275146d274d537c5d7f8269e Mon Sep 17 00:00:00 2001
From 0d523be2643f8e72568ab821776abfb29c5b09e5 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sat, 27 Sep 2014 14:57:41 +0100
Subject: [PATCH 01/11] Use Q_PID instead of int, reducing QProcess repitition
Subject: [PATCH 01/13] Use Q_PID instead of int, reducing QProcess repitition
Process ids are not ints on all systems
---

View File

@@ -1,7 +1,7 @@
From 453b04d9b735824e2731a565f20a275d3352ea91 Mon Sep 17 00:00:00 2001
From acebc7722066ef3885ee2b425ffe36f8116370b6 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sat, 27 Sep 2014 15:23:27 +0100
Subject: [PATCH 02/11] Use a shared QProcessEnvironment
Subject: [PATCH 02/13] Use a shared QProcessEnvironment
This reduces a lot of repetition. Environment variables
LANG, LC_MESSAGES, LC_ALL are set to "C" for all cases.

View File

@@ -0,0 +1,59 @@
From b56f1e751c60bc9b386942cb0491df394406491e Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Tue, 30 Sep 2014 14:43:39 +0100
Subject: [PATCH 03/13] Remove redundancy in UnixCommand's exe checking
functions
Check the result of UnixCommand::discoverBinaryPath() not
being empty in UnixCommand::hasTheExecutable() instead of
repeating much the same code.
---
src/unixcommand.cpp | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/unixcommand.cpp b/src/unixcommand.cpp
index 6ab57b9..dff3ffb 100644
--- a/src/unixcommand.cpp
+++ b/src/unixcommand.cpp
@@ -81,6 +81,7 @@ QString UnixCommand::runCurlCommand(const QString& commandToRun){
QString UnixCommand::discoverBinaryPath(const QString& binary){
QProcess proc;
proc.setProcessEnvironment(getEnv());
+ proc.setProcessChannelMode(QProcess::MergedChannels);
proc.start("/bin/sh -c \"which " + binary + "\"");
proc.waitForFinished();
@@ -89,6 +90,11 @@ QString UnixCommand::discoverBinaryPath(const QString& binary){
proc.close();
res = res.remove('\n');
+ if (res.count("which"))
+ res.clear();
+
+ if (!res.isEmpty()) return res;
+
//If it still didn't find it, try "/sbin" dir...
if (res.isEmpty()){
QFile fbin("/sbin/" + binary);
@@ -529,17 +535,7 @@ bool UnixCommand::isKtsussVersionOK()
*/
bool UnixCommand::hasTheExecutable( const QString& exeName )
{
- QProcess proc;
- proc.setProcessChannelMode(QProcess::MergedChannels);
- QString sParam = "\"which " + exeName + "\"";
- proc.start("/bin/sh -c " + sParam);
- proc.waitForFinished();
-
- QString out = proc.readAllStandardOutput();
- proc.close();
-
- if (out.isEmpty() || out.count("which") > 0) return false;
- else return true;
+ return (!discoverBinaryPath(exeName).isEmpty());
}
/*
--
2.1.1

View File

@@ -1,7 +1,7 @@
From 27be39bb5762af5d9d3dcb18e534785af6fa27fa Mon Sep 17 00:00:00 2001
From 2ec0488322caf88eab092956ef1769d67469a5f7 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sun, 28 Sep 2014 23:12:28 +0100
Subject: [PATCH 03/11] Use '/' instead of QDir::separator()
Subject: [PATCH 04/13] Use '/' instead of QDir::separator()
---
src/utils.cpp | 6 +++---

View File

@@ -1,17 +1,17 @@
From 8f8296a0c0bb91774f8e4c48b2c7487aa1704a05 Mon Sep 17 00:00:00 2001
From 43e2e0cb559605e3fab7c708b54e360b688dd752 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sun, 28 Sep 2014 23:15:23 +0100
Subject: [PATCH 04/11] Append to instead of overwrite m_readAllStandardOutput
Subject: [PATCH 05/13] Append to instead of overwrite m_readAllStandardOutput
---
src/unixcommand.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/unixcommand.cpp b/src/unixcommand.cpp
index 6ab57b9..927df2b 100644
index dff3ffb..7badd37 100644
--- a/src/unixcommand.cpp
+++ b/src/unixcommand.cpp
@@ -664,7 +664,7 @@ void UnixCommand::executeCommandAsNormalUser(const QString &pCommand)
@@ -660,7 +660,7 @@ void UnixCommand::executeCommandAsNormalUser(const QString &pCommand)
void UnixCommand::processReadyReadStandardOutput()
{
if (m_process->isOpen())

View File

@@ -1,7 +1,7 @@
From af5ceee9b029082b90d78f75bd1124770f0eb97f Mon Sep 17 00:00:00 2001
From cecc10020b4189b1a94144104c83149c15472b4e Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sat, 27 Sep 2014 15:02:24 +0100
Subject: [PATCH 05/11] Define QT_WA
Subject: [PATCH 06/13] Define QT_WA
---
src/QtSolutions/qtlockedfile_win.cpp | 2 ++

View File

@@ -1,7 +1,7 @@
From 7d65db354eb2977049d489006dd14a7a87a8f598 Mon Sep 17 00:00:00 2001
From 17856a5266bb270f255ca29bd64ababadf919fc7 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sat, 27 Sep 2014 15:31:32 +0100
Subject: [PATCH 06/11] MSYS2: Add ectn_MSYS2 as a LinuxDistro
Subject: [PATCH 07/13] MSYS2: Add ectn_MSYS2 as a LinuxDistro
---
src/unixcommand.cpp | 4 ++++
@@ -9,10 +9,10 @@ Subject: [PATCH 06/11] MSYS2: Add ectn_MSYS2 as a LinuxDistro
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/unixcommand.cpp b/src/unixcommand.cpp
index 927df2b..d80b425 100644
index 7badd37..e315306 100644
--- a/src/unixcommand.cpp
+++ b/src/unixcommand.cpp
@@ -867,6 +867,9 @@ QStringList UnixCommand::getIgnorePkg()
@@ -863,6 +863,9 @@ QStringList UnixCommand::getIgnorePkg()
LinuxDistro UnixCommand::getLinuxDistro()
{
static LinuxDistro ret;
@@ -22,7 +22,7 @@ index 927df2b..d80b425 100644
static bool firstTime = true;
if (firstTime)
@@ -926,6 +929,7 @@ LinuxDistro UnixCommand::getLinuxDistro()
@@ -922,6 +925,7 @@ LinuxDistro UnixCommand::getLinuxDistro()
file.close();
}
}

View File

@@ -1,7 +1,7 @@
From 4caf5a09888b17ced71159d0ef53143d3cc820be Mon Sep 17 00:00:00 2001
From 2d12eebb560c360c7fe166c20dea349e3407f14e Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sat, 27 Sep 2014 15:38:23 +0100
Subject: [PATCH 07/11] MSYS2: Add getMSYS2Root()
Subject: [PATCH 08/13] MSYS2: Add getMSYS2Root()
Because MSYS2 can be installed anywhere, the real location
is determined using a relative path from octopi.exe
@@ -11,7 +11,7 @@ is determined using a relative path from octopi.exe
2 files changed, 20 insertions(+)
diff --git a/src/unixcommand.cpp b/src/unixcommand.cpp
index d80b425..6f92b02 100644
index e315306..c7ee8ee 100644
--- a/src/unixcommand.cpp
+++ b/src/unixcommand.cpp
@@ -37,6 +37,7 @@

View File

@@ -1,7 +1,7 @@
From 7f5c9257ee790caeb203fc369a3484b9e59324dc Mon Sep 17 00:00:00 2001
From 053addd81cc0ee73faf3fc308294069acb982d10 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sat, 27 Sep 2014 15:40:36 +0100
Subject: [PATCH 08/11] MSYS2: hasPacmanDatabase() getMSYS2Root() changes
Subject: [PATCH 09/13] MSYS2: hasPacmanDatabase() getMSYS2Root() changes
---
src/package.cpp | 11 ++++++++++-

View File

@@ -1,22 +1,24 @@
From 78a13f3fa9a138954a443a393fd5a717def9975a Mon Sep 17 00:00:00 2001
From fd2fc2c3355b5ed7a362133d6f1197e1a98a4cb3 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sat, 27 Sep 2014 15:42:50 +0100
Subject: [PATCH 09/11] MSYS2: openRootTerminal(), getSUCommand(),
isRootRunning()
Subject: [PATCH 10/13] MSYS2: Changes to various system calls
openRootTerminal(), runCommandInTerminal()
getSUCommand(), isRootRunning()
MSYS2 behaviour changes for these:
openRootTerminal runs msys2_shell.bat
getSUCommand returns "sh.exe -c "
isRootRunning returns false
*Terminal() 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(-)
src/terminal.cpp | 12 +++++++++++-
src/unixcommand.h | 6 ++++++
src/wmhelper.cpp | 5 ++++-
src/wmhelper.h | 2 ++
4 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/terminal.cpp b/src/terminal.cpp
index 5085007..0495acc 100644
index 5085007..a026994 100644
--- a/src/terminal.cpp
+++ b/src/terminal.cpp
@@ -198,7 +198,12 @@ void Terminal::openRootTerminal()
@@ -33,6 +35,18 @@ index 5085007..0495acc 100644
{
QString cmd = WMHelper::getSUCommand() + " \"" + ctn_RXVT_TERMINAL +
" -name Urxvt -title Urxvt \"";
@@ -344,6 +349,11 @@ void Terminal::runCommandInTerminal(const QStringList &commandList)
if (m_selectedTerminal == ctn_AUTOMATIC)
{
+ if (UnixCommand::getLinuxDistro() == ectn_MSYS2)
+ {
+ QString cmd = ctn_MSYS2_SH + UnixCommand::getMSYS2Root() + QLatin1String("/msys2_shell.bat -c ") + ftemp->fileName();
+ m_process->start(cmd);
+ }
if (UnixCommand::getLinuxDistro() == ectn_MOOOSLINUX && UnixCommand::hasTheExecutable(ctn_RXVT_TERMINAL))
{
QString cmd =
diff --git a/src/unixcommand.h b/src/unixcommand.h
index 833716b..81eed8c 100644
--- a/src/unixcommand.h

View File

@@ -1,7 +1,7 @@
From 08c6aeeb27d51ff659026498275a0348d274aaa7 Mon Sep 17 00:00:00 2001
From 04b82c70625fefea765893c9ca2512de00edc10c Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sat, 27 Sep 2014 15:44:22 +0100
Subject: [PATCH 10/11] MSYS2: Process id changes (WIP)
Subject: [PATCH 11/13] MSYS2: Process id changes (WIP)
---
notifier/octopi-notifier/octopi-notifier.pro | 2 +

View File

@@ -1,7 +1,7 @@
From 75b5892914636eb37bec1c90750ec6c896edd6ac Mon Sep 17 00:00:00 2001
From 7fda7d9ca5ffd6cd5c27fb338f740e2753438234 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sun, 28 Sep 2014 23:14:17 +0100
Subject: [PATCH 11/11] MSYS2: Prepend getMSYS2Root() to file checks
Subject: [PATCH 12/13] MSYS2: Prepend getMSYS2Root() to file checks
---
src/mainwindow_refresh.cpp | 2 +-

View File

@@ -0,0 +1,30 @@
From eca5466d4591b75e7f095a99759b9f3fcdff1ee6 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Tue, 30 Sep 2014 19:12:30 +0100
Subject: [PATCH 13/13] MSYS2: Support discoverBinaryPath()
---
src/unixcommand.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/unixcommand.cpp b/src/unixcommand.cpp
index c7ee8ee..afeb60b 100644
--- a/src/unixcommand.cpp
+++ b/src/unixcommand.cpp
@@ -84,7 +84,12 @@ QString UnixCommand::discoverBinaryPath(const QString& binary){
proc.setProcessEnvironment(getEnv());
proc.setProcessChannelMode(QProcess::MergedChannels);
- proc.start("/bin/sh -c \"which " + binary + "\"");
+ QString cmd;
+ if (UnixCommand::getLinuxDistro() == ectn_MSYS2)
+ cmd = ctn_MSYS2_SH + UnixCommand::getMSYS2Root() + "/usr/bin/sh -c \"which " + binary + "\"";
+ else
+ cmd = "/bin/sh -c \"which " + binary + "\"";
+ proc.start(cmd);
proc.waitForFinished();
QString res = proc.readAllStandardOutput();
--
2.1.1

View File

@@ -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=r670.a897f15
pkgver=r671.97ec878
pkgrel=1
pkgdesc="a powerful Pacman frontend using Qt libs"
arch=('any')
@@ -21,27 +21,31 @@ _gitname="octopi"
source=("${_gitname}"::"${_gitroot}"
"0001-Use-Q_PID-instead-of-int-reducing-QProcess-repititio.patch"
"0002-Use-a-shared-QProcessEnvironment.patch"
"0003-Use-instead-of-QDir-separator.patch"
"0004-Append-to-instead-of-overwrite-m_readAllStandardOutp.patch"
"0005-Define-QT_WA.patch"
"0006-MSYS2-Add-ectn_MSYS2-as-a-LinuxDistro.patch"
"0007-MSYS2-Add-getMSYS2Root.patch"
"0008-MSYS2-hasPacmanDatabase-getMSYS2Root-changes.patch"
"0009-MSYS2-openRootTerminal-getSUCommand-isRootRunning.patch"
"0010-MSYS2-Process-id-changes-WIP.patch"
"0011-MSYS2-Prepend-getMSYS2Root-to-file-checks.patch")
"0003-Remove-redundancy-in-UnixCommand-s-exe-checking-func.patch"
"0004-Use-instead-of-QDir-separator.patch"
"0005-Append-to-instead-of-overwrite-m_readAllStandardOutp.patch"
"0006-Define-QT_WA.patch"
"0007-MSYS2-Add-ectn_MSYS2-as-a-LinuxDistro.patch"
"0008-MSYS2-Add-getMSYS2Root.patch"
"0009-MSYS2-hasPacmanDatabase-getMSYS2Root-changes.patch"
"0010-MSYS2-Changes-to-various-system-calls.patch"
"0011-MSYS2-Process-id-changes-WIP.patch"
"0012-MSYS2-Prepend-getMSYS2Root-to-file-checks.patch"
"0013-MSYS2-Support-discoverBinaryPath.patch")
md5sums=('SKIP'
'47a1e70b80cd2b87840b4cafc5bfb4d3'
'09aed9b3ce3c3806241937f92a5734db'
'fb205748f4d70359650de16370edf7e3'
'434c963796603b6d26d9f18454356dfb'
'fc9c20f9658bbbda2a546a96d418dacf'
'a56acf001acf84ec4b1f5d965cc24fbd'
'58d788294c1a3d97d31338243b93822d'
'a5a4725fa4ca818b5f6f669c3b3608cf'
'c9b2ebb32eaf92719e67988f56b813e3'
'3e5846ca295710a8c2835dcdb521916a'
'60194fd23c428f677ffeb4c80801b435')
'f5baf34e5834b95f04a1bbd6885dc8ab'
'b80912396c5be0e2ef450f3a75945027'
'194ae04782fa018f2ceb64ddc0c1b087'
'24423cf4a7c532035e4f6fa6bd86bc9f'
'84eb736c06916a2d05c5fab44f5feab5'
'9a261ef5f6b084fb9319664a74bfe7c0'
'ecdc6eff22e0f05ac90f5bec6dc33634'
'c46a14fe574e2644dec65e86df8d2668'
'0fb8880f45775600bbfc82975c539470'
'5a75614737395d6b298f0a6b81592526'
'5376cfe7257c9f955da81bbfa32d27f8'
'3d153445783441dfa6e0e5aa3002c61d'
'927a964d6b3d4ee3ac1f56a43b008839')
pkgver() {
cd "$srcdir/$_realname"
@@ -53,15 +57,17 @@ prepare() {
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-Use-instead-of-QDir-separator.patch
git am "${srcdir}"/0004-Append-to-instead-of-overwrite-m_readAllStandardOutp.patch
git am "${srcdir}"/0005-Define-QT_WA.patch
git am "${srcdir}"/0006-MSYS2-Add-ectn_MSYS2-as-a-LinuxDistro.patch
git am "${srcdir}"/0007-MSYS2-Add-getMSYS2Root.patch
git am "${srcdir}"/0008-MSYS2-hasPacmanDatabase-getMSYS2Root-changes.patch
git am "${srcdir}"/0009-MSYS2-openRootTerminal-getSUCommand-isRootRunning.patch
git am "${srcdir}"/0010-MSYS2-Process-id-changes-WIP.patch
git am "${srcdir}"/0011-MSYS2-Prepend-getMSYS2Root-to-file-checks.patch
git am "${srcdir}"/0003-Remove-redundancy-in-UnixCommand-s-exe-checking-func.patch
git am "${srcdir}"/0004-Use-instead-of-QDir-separator.patch
git am "${srcdir}"/0005-Append-to-instead-of-overwrite-m_readAllStandardOutp.patch
git am "${srcdir}"/0006-Define-QT_WA.patch
git am "${srcdir}"/0007-MSYS2-Add-ectn_MSYS2-as-a-LinuxDistro.patch
git am "${srcdir}"/0008-MSYS2-Add-getMSYS2Root.patch
git am "${srcdir}"/0009-MSYS2-hasPacmanDatabase-getMSYS2Root-changes.patch
git am "${srcdir}"/0010-MSYS2-Changes-to-various-system-calls.patch
git am "${srcdir}"/0011-MSYS2-Process-id-changes-WIP.patch
git am "${srcdir}"/0012-MSYS2-Prepend-getMSYS2Root-to-file-checks.patch
git am "${srcdir}"/0013-MSYS2-Support-discoverBinaryPath.patch
}
build() {