forked from qt-creator/qt-creator
GenericDirectUploadService: Don't use SshRemoteProcess
Use QtcProcess with a path on device instead. Change-Id: I61c6b2cf042a223a037109b56418dbf76dbad161 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -26,12 +26,12 @@
|
||||
#include "genericdirectuploadservice.h"
|
||||
|
||||
#include <projectexplorer/deployablefile.h>
|
||||
#include <projectexplorer/devicesupport/idevice.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <ssh/sftptransfer.h>
|
||||
#include <ssh/sshconnection.h>
|
||||
#include <ssh/sshremoteprocess.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
@@ -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<SshRemoteProcess *, DeployableFile> remoteProcs;
|
||||
QHash<QtcProcess *, DeployableFile> remoteProcs;
|
||||
QQueue<DeployableFile> filesToStat;
|
||||
State state = Inactive;
|
||||
QList<DeployableFile> 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);
|
||||
|
@@ -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<ProjectExplorer::DeployableFile> collectFilesToUpload(
|
||||
|
Reference in New Issue
Block a user