From 23cc03b470e74499461176af10cb741c2854c4d8 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 2 May 2022 21:53:02 +0200 Subject: [PATCH] GenericDirectUploadService: Don't use SshRemoteProcess Use QtcProcess with a path on device instead. Change-Id: I61c6b2cf042a223a037109b56418dbf76dbad161 Reviewed-by: Christian Kandeler Reviewed-by: --- .../genericdirectuploadservice.cpp | 24 +++++++++---------- .../remotelinux/genericdirectuploadservice.h | 5 ++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/plugins/remotelinux/genericdirectuploadservice.cpp b/src/plugins/remotelinux/genericdirectuploadservice.cpp index a146c8748f0..dff6185f983 100644 --- a/src/plugins/remotelinux/genericdirectuploadservice.cpp +++ b/src/plugins/remotelinux/genericdirectuploadservice.cpp @@ -26,12 +26,12 @@ #include "genericdirectuploadservice.h" #include +#include #include #include #include #include #include -#include #include #include @@ -55,7 +55,7 @@ const int MaxConcurrentStatCalls = 10; class GenericDirectUploadServicePrivate { public: - DeployableFile getFileForProcess(SshRemoteProcess *proc) + DeployableFile getFileForProcess(QtcProcess *proc) { const auto it = remoteProcs.find(proc); QTC_ASSERT(it != remoteProcs.end(), return DeployableFile()); @@ -66,7 +66,7 @@ public: IncrementalDeployment incremental = IncrementalDeployment::NotSupported; bool ignoreMissingFiles = false; - QHash remoteProcs; + QHash remoteProcs; QQueue filesToStat; State state = Inactive; QList filesToUpload; @@ -135,7 +135,7 @@ void GenericDirectUploadService::doDeploy() } QDateTime GenericDirectUploadService::timestampFromStat(const DeployableFile &file, - SshRemoteProcess *statProc, + QtcProcess *statProc, const QString &errorMsg) { QString errorDetails; @@ -197,9 +197,10 @@ void GenericDirectUploadService::stopDeployment() void GenericDirectUploadService::runStat(const DeployableFile &file) { // We'd like to use --format=%Y, but it's not supported by busybox. - const QString statCmd = "stat -t " + Utils::ProcessArgs::quoteArgUnix(file.remoteFilePath()); - SshRemoteProcess * const statProc = connection()->createRemoteProcess(statCmd).release(); - statProc->setParent(this); + QtcProcess * const statProc = new QtcProcess(this); + const CommandLine statCmd {deviceConfiguration()->mapToGlobalPath("stat"), + {"-t", Utils::ProcessArgs::quoteArgUnix(file.remoteFilePath())}}; + statProc->setCommand(statCmd); connect(statProc, &QtcProcess::done, this, [this, statProc, state = d->state] { QTC_ASSERT(d->state == state, return); const DeployableFile file = d->getFileForProcess(statProc); @@ -336,11 +337,10 @@ void GenericDirectUploadService::chmod() for (const DeployableFile &f : qAsConst(d->filesToUpload)) { if (!f.isExecutable()) continue; - const QString command = QLatin1String("chmod a+x ") - + Utils::ProcessArgs::quoteArgUnix(f.remoteFilePath()); - SshRemoteProcess * const chmodProc - = connection()->createRemoteProcess(command).release(); - chmodProc->setParent(this); + QtcProcess * const chmodProc = new QtcProcess(this); + const CommandLine chmodCmd {deviceConfiguration()->mapToGlobalPath("chmod"), + {"a+x", Utils::ProcessArgs::quoteArgUnix(f.remoteFilePath())}}; + chmodProc->setCommand(chmodCmd); connect(chmodProc, &QtcProcess::done, this, [this, chmodProc, state = d->state] { QTC_ASSERT(state == d->state, return); const DeployableFile file = d->getFileForProcess(chmodProc); diff --git a/src/plugins/remotelinux/genericdirectuploadservice.h b/src/plugins/remotelinux/genericdirectuploadservice.h index 998a8275527..2dae2516d96 100644 --- a/src/plugins/remotelinux/genericdirectuploadservice.h +++ b/src/plugins/remotelinux/genericdirectuploadservice.h @@ -36,7 +36,8 @@ QT_FORWARD_DECLARE_CLASS(QDateTime) QT_FORWARD_DECLARE_CLASS(QString) namespace ProjectExplorer { class DeployableFile; } -namespace QSsh { class SshRemoteProcess; } +namespace Utils { class QtcProcess; } + namespace RemoteLinux { namespace Internal { class GenericDirectUploadServicePrivate; } @@ -65,7 +66,7 @@ protected: private: void runStat(const ProjectExplorer::DeployableFile &file); QDateTime timestampFromStat(const ProjectExplorer::DeployableFile &file, - QSsh::SshRemoteProcess *statProc, const QString &errorMsg); + Utils::QtcProcess *statProc, const QString &errorMsg); void checkForStateChangeOnRemoteProcFinished(); QList collectFilesToUpload(