forked from qt-creator/qt-creator
RemoteLinux: Drop some in-class signalling
Not needed since the deploy step and service hierarchy merge. Change-Id: I644bdeca31caa2182b9d618e5f1ec6865c95f4c8 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -58,17 +58,17 @@ private:
|
|||||||
process.setCommand(cmd);
|
process.setCommand(cmd);
|
||||||
QtcProcess *proc = &process;
|
QtcProcess *proc = &process;
|
||||||
connect(proc, &QtcProcess::readyReadStandardError, this, [this, proc] {
|
connect(proc, &QtcProcess::readyReadStandardError, this, [this, proc] {
|
||||||
emit stdErrData(proc->readAllStandardError());
|
handleStdErrData(proc->readAllStandardError());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const auto doneHandler = [this](const QtcProcess &) {
|
const auto doneHandler = [this](const QtcProcess &) {
|
||||||
if (m_makeDefault)
|
if (m_makeDefault)
|
||||||
emit progressMessage(Tr::tr("Application set as the default one."));
|
addProgressMessage(Tr::tr("Application set as the default one."));
|
||||||
else
|
else
|
||||||
emit progressMessage(Tr::tr("Reset the default application."));
|
addProgressMessage(Tr::tr("Reset the default application."));
|
||||||
};
|
};
|
||||||
const auto errorHandler = [this](const QtcProcess &process) {
|
const auto errorHandler = [this](const QtcProcess &process) {
|
||||||
emit errorMessage(Tr::tr("Remote process failed: %1").arg(process.errorString()));
|
addErrorMessage(Tr::tr("Remote process failed: %1").arg(process.errorString()));
|
||||||
};
|
};
|
||||||
return Group { Process(setupHandler, doneHandler, errorHandler) };
|
return Group { Process(setupHandler, doneHandler, errorHandler) };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ Group QdbStopApplicationStep::deployRecipe()
|
|||||||
const auto setupHandler = [this](QtcProcess &process) {
|
const auto setupHandler = [this](QtcProcess &process) {
|
||||||
const auto device = DeviceKitAspect::device(target()->kit());
|
const auto device = DeviceKitAspect::device(target()->kit());
|
||||||
if (!device) {
|
if (!device) {
|
||||||
emit errorMessage(Tr::tr("No device to stop the application on."));
|
addErrorMessage(Tr::tr("No device to stop the application on."));
|
||||||
return TaskAction::StopWithError;
|
return TaskAction::StopWithError;
|
||||||
}
|
}
|
||||||
QTC_CHECK(device);
|
QTC_CHECK(device);
|
||||||
@@ -51,25 +51,25 @@ Group QdbStopApplicationStep::deployRecipe()
|
|||||||
process.setWorkingDirectory("/usr/bin");
|
process.setWorkingDirectory("/usr/bin");
|
||||||
QtcProcess *proc = &process;
|
QtcProcess *proc = &process;
|
||||||
connect(proc, &QtcProcess::readyReadStandardOutput, this, [this, proc] {
|
connect(proc, &QtcProcess::readyReadStandardOutput, this, [this, proc] {
|
||||||
emit stdOutData(proc->readAllStandardOutput());
|
handleStdOutData(proc->readAllStandardOutput());
|
||||||
});
|
});
|
||||||
return TaskAction::Continue;
|
return TaskAction::Continue;
|
||||||
};
|
};
|
||||||
const auto doneHandler = [this](const QtcProcess &) {
|
const auto doneHandler = [this](const QtcProcess &) {
|
||||||
emit progressMessage(Tr::tr("Stopped the running application."));
|
addProgressMessage(Tr::tr("Stopped the running application."));
|
||||||
};
|
};
|
||||||
const auto errorHandler = [this](const QtcProcess &process) {
|
const auto errorHandler = [this](const QtcProcess &process) {
|
||||||
const QString errorOutput = process.cleanedStdErr();
|
const QString errorOutput = process.cleanedStdErr();
|
||||||
const QString failureMessage = Tr::tr("Could not check and possibly stop running application.");
|
const QString failureMessage = Tr::tr("Could not check and possibly stop running application.");
|
||||||
if (process.exitStatus() == QProcess::CrashExit) {
|
if (process.exitStatus() == QProcess::CrashExit) {
|
||||||
emit errorMessage(failureMessage);
|
addErrorMessage(failureMessage);
|
||||||
} else if (process.result() != ProcessResult::FinishedWithSuccess) {
|
} else if (process.result() != ProcessResult::FinishedWithSuccess) {
|
||||||
emit stdErrData(process.errorString());
|
handleStdErrData(process.errorString());
|
||||||
} else if (errorOutput.contains("Could not connect: Connection refused")) {
|
} else if (errorOutput.contains("Could not connect: Connection refused")) {
|
||||||
emit progressMessage(Tr::tr("Checked that there is no running application."));
|
addProgressMessage(Tr::tr("Checked that there is no running application."));
|
||||||
} else if (!errorOutput.isEmpty()) {
|
} else if (!errorOutput.isEmpty()) {
|
||||||
emit stdErrData(errorOutput);
|
handleStdErrData(errorOutput);
|
||||||
emit errorMessage(failureMessage);
|
addErrorMessage(failureMessage);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return Group { Process(setupHandler, doneHandler, errorHandler) };
|
return Group { Process(setupHandler, doneHandler, errorHandler) };
|
||||||
|
|||||||
@@ -40,19 +40,8 @@ public:
|
|||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
AbstractRemoteLinuxDeployStep::AbstractRemoteLinuxDeployStep(BuildStepList *bsl, Id id)
|
AbstractRemoteLinuxDeployStep::AbstractRemoteLinuxDeployStep(BuildStepList *bsl, Id id)
|
||||||
: BuildStep(bsl, id), d(new Internal::AbstractRemoteLinuxDeployStepPrivate)
|
: BuildStep(bsl, id), d(new AbstractRemoteLinuxDeployStepPrivate)
|
||||||
{
|
{}
|
||||||
connect(this, &AbstractRemoteLinuxDeployStep::errorMessage,
|
|
||||||
this, &AbstractRemoteLinuxDeployStep::handleErrorMessage);
|
|
||||||
connect(this, &AbstractRemoteLinuxDeployStep::progressMessage,
|
|
||||||
this, &AbstractRemoteLinuxDeployStep::handleProgressMessage);
|
|
||||||
connect(this, &AbstractRemoteLinuxDeployStep::warningMessage,
|
|
||||||
this, &AbstractRemoteLinuxDeployStep::handleWarningMessage);
|
|
||||||
connect(this, &AbstractRemoteLinuxDeployStep::stdOutData,
|
|
||||||
this, &AbstractRemoteLinuxDeployStep::handleStdOutData);
|
|
||||||
connect(this, &AbstractRemoteLinuxDeployStep::stdErrData,
|
|
||||||
this, &AbstractRemoteLinuxDeployStep::handleStdErrData);
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractRemoteLinuxDeployStep::~AbstractRemoteLinuxDeployStep()
|
AbstractRemoteLinuxDeployStep::~AbstractRemoteLinuxDeployStep()
|
||||||
{
|
{
|
||||||
@@ -88,13 +77,13 @@ void AbstractRemoteLinuxDeployStep::start()
|
|||||||
|
|
||||||
const CheckResult check = isDeploymentPossible();
|
const CheckResult check = isDeploymentPossible();
|
||||||
if (!check) {
|
if (!check) {
|
||||||
emit errorMessage(check.errorMessage());
|
addErrorMessage(check.errorMessage());
|
||||||
handleFinished();
|
handleFinished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isDeploymentNecessary()) {
|
if (!isDeploymentNecessary()) {
|
||||||
emit progressMessage(Tr::tr("No deployment action necessary. Skipping."));
|
addProgressMessage(Tr::tr("No deployment action necessary. Skipping."));
|
||||||
handleFinished();
|
handleFinished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -190,19 +179,19 @@ void AbstractRemoteLinuxDeployStep::doCancel()
|
|||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRemoteLinuxDeployStep::handleProgressMessage(const QString &message)
|
void AbstractRemoteLinuxDeployStep::addProgressMessage(const QString &message)
|
||||||
{
|
{
|
||||||
emit addOutput(message, OutputFormat::NormalMessage);
|
emit addOutput(message, OutputFormat::NormalMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRemoteLinuxDeployStep::handleErrorMessage(const QString &message)
|
void AbstractRemoteLinuxDeployStep::addErrorMessage(const QString &message)
|
||||||
{
|
{
|
||||||
emit addOutput(message, OutputFormat::ErrorMessage);
|
emit addOutput(message, OutputFormat::ErrorMessage);
|
||||||
emit addTask(DeploymentTask(Task::Error, message), 1); // TODO correct?
|
emit addTask(DeploymentTask(Task::Error, message), 1); // TODO correct?
|
||||||
d->hasError = true;
|
d->hasError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractRemoteLinuxDeployStep::handleWarningMessage(const QString &message)
|
void AbstractRemoteLinuxDeployStep::addWarningMessage(const QString &message)
|
||||||
{
|
{
|
||||||
emit addOutput(message, OutputFormat::ErrorMessage);
|
emit addOutput(message, OutputFormat::ErrorMessage);
|
||||||
emit addTask(DeploymentTask(Task::Warning, message), 1); // TODO correct?
|
emit addTask(DeploymentTask(Task::Warning, message), 1); // TODO correct?
|
||||||
@@ -214,6 +203,7 @@ void AbstractRemoteLinuxDeployStep::handleFinished()
|
|||||||
emit addOutput(Tr::tr("Deploy step failed."), OutputFormat::ErrorMessage);
|
emit addOutput(Tr::tr("Deploy step failed."), OutputFormat::ErrorMessage);
|
||||||
else
|
else
|
||||||
emit addOutput(Tr::tr("Deploy step finished."), OutputFormat::NormalMessage);
|
emit addOutput(Tr::tr("Deploy step finished."), OutputFormat::NormalMessage);
|
||||||
|
|
||||||
emit finished(!d->hasError);
|
emit finished(!d->hasError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,12 +58,8 @@ public:
|
|||||||
|
|
||||||
virtual CheckResult isDeploymentPossible() const;
|
virtual CheckResult isDeploymentPossible() const;
|
||||||
|
|
||||||
signals:
|
void handleStdOutData(const QString &data);
|
||||||
void errorMessage(const QString &message);
|
void handleStdErrData(const QString &data);
|
||||||
void progressMessage(const QString &message);
|
|
||||||
void warningMessage(const QString &message);
|
|
||||||
void stdOutData(const QString &data);
|
|
||||||
void stdErrData(const QString &data);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
@@ -81,14 +77,13 @@ protected:
|
|||||||
bool hasRemoteFileChanged(const ProjectExplorer::DeployableFile &deployableFile,
|
bool hasRemoteFileChanged(const ProjectExplorer::DeployableFile &deployableFile,
|
||||||
const QDateTime &remoteTimestamp) const;
|
const QDateTime &remoteTimestamp) const;
|
||||||
|
|
||||||
private:
|
void addProgressMessage(const QString &message);
|
||||||
void handleProgressMessage(const QString &message);
|
void addErrorMessage(const QString &message);
|
||||||
void handleErrorMessage(const QString &message);
|
void addWarningMessage(const QString &message);
|
||||||
void handleWarningMessage(const QString &message);
|
|
||||||
void handleFinished();
|
|
||||||
void handleStdOutData(const QString &data);
|
|
||||||
void handleStdErrData(const QString &data);
|
|
||||||
|
|
||||||
|
void handleFinished();
|
||||||
|
|
||||||
|
private:
|
||||||
virtual bool isDeploymentNecessary() const;
|
virtual bool isDeploymentNecessary() const;
|
||||||
virtual Utils::Tasking::Group deployRecipe();
|
virtual Utils::Tasking::Group deployRecipe();
|
||||||
|
|
||||||
|
|||||||
@@ -67,26 +67,26 @@ CheckResult CustomCommandDeployStep::isDeploymentPossible() const
|
|||||||
Group CustomCommandDeployStep::deployRecipe()
|
Group CustomCommandDeployStep::deployRecipe()
|
||||||
{
|
{
|
||||||
const auto setupHandler = [this](QtcProcess &process) {
|
const auto setupHandler = [this](QtcProcess &process) {
|
||||||
emit progressMessage(Tr::tr("Starting remote command \"%1\"...").arg(m_commandLine));
|
addProgressMessage(Tr::tr("Starting remote command \"%1\"...").arg(m_commandLine));
|
||||||
process.setCommand({deviceConfiguration()->filePath("/bin/sh"),
|
process.setCommand({deviceConfiguration()->filePath("/bin/sh"),
|
||||||
{"-c", m_commandLine}});
|
{"-c", m_commandLine}});
|
||||||
QtcProcess *proc = &process;
|
QtcProcess *proc = &process;
|
||||||
connect(proc, &QtcProcess::readyReadStandardOutput, this, [this, proc] {
|
connect(proc, &QtcProcess::readyReadStandardOutput, this, [this, proc] {
|
||||||
emit stdOutData(proc->readAllStandardOutput());
|
handleStdOutData(proc->readAllStandardOutput());
|
||||||
});
|
});
|
||||||
connect(proc, &QtcProcess::readyReadStandardError, this, [this, proc] {
|
connect(proc, &QtcProcess::readyReadStandardError, this, [this, proc] {
|
||||||
emit stdErrData(proc->readAllStandardError());
|
handleStdErrData(proc->readAllStandardError());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const auto doneHandler = [this](const QtcProcess &) {
|
const auto doneHandler = [this](const QtcProcess &) {
|
||||||
emit progressMessage(Tr::tr("Remote command finished successfully."));
|
addProgressMessage(Tr::tr("Remote command finished successfully."));
|
||||||
};
|
};
|
||||||
const auto errorHandler = [this](const QtcProcess &process) {
|
const auto errorHandler = [this](const QtcProcess &process) {
|
||||||
if (process.error() != QProcess::UnknownError
|
if (process.error() != QProcess::UnknownError
|
||||||
|| process.exitStatus() != QProcess::NormalExit) {
|
|| process.exitStatus() != QProcess::NormalExit) {
|
||||||
emit errorMessage(Tr::tr("Remote process failed: %1").arg(process.errorString()));
|
addErrorMessage(Tr::tr("Remote process failed: %1").arg(process.errorString()));
|
||||||
} else if (process.exitCode() != 0) {
|
} else if (process.exitCode() != 0) {
|
||||||
emit errorMessage(Tr::tr("Remote process finished with exit code %1.")
|
addErrorMessage(Tr::tr("Remote process finished with exit code %1.")
|
||||||
.arg(process.exitCode()));
|
.arg(process.exitCode()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ QDateTime GenericDirectUploadStepPrivate::timestampFromStat(const DeployableFile
|
|||||||
succeeded = true;
|
succeeded = true;
|
||||||
}
|
}
|
||||||
if (!succeeded) {
|
if (!succeeded) {
|
||||||
emit q->warningMessage(Tr::tr("Failed to retrieve remote timestamp for file \"%1\". "
|
q->addWarningMessage(Tr::tr("Failed to retrieve remote timestamp for file \"%1\". "
|
||||||
"Incremental deployment will not work. Error message was: %2")
|
"Incremental deployment will not work. Error message was: %2")
|
||||||
.arg(file.remoteFilePath(), error));
|
.arg(file.remoteFilePath(), error));
|
||||||
return {};
|
return {};
|
||||||
@@ -112,18 +112,18 @@ QDateTime GenericDirectUploadStepPrivate::timestampFromStat(const DeployableFile
|
|||||||
const QString warningString(Tr::tr("Unexpected stat output for remote file \"%1\": %2")
|
const QString warningString(Tr::tr("Unexpected stat output for remote file \"%1\": %2")
|
||||||
.arg(file.remoteFilePath()).arg(QString::fromUtf8(output)));
|
.arg(file.remoteFilePath()).arg(QString::fromUtf8(output)));
|
||||||
if (!output.startsWith(file.remoteFilePath().toUtf8())) {
|
if (!output.startsWith(file.remoteFilePath().toUtf8())) {
|
||||||
emit q->warningMessage(warningString);
|
q->addWarningMessage(warningString);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const QByteArrayList columns = output.mid(file.remoteFilePath().toUtf8().size() + 1).split(' ');
|
const QByteArrayList columns = output.mid(file.remoteFilePath().toUtf8().size() + 1).split(' ');
|
||||||
if (columns.size() < 14) { // Normal Linux stat: 16 columns in total, busybox stat: 15 columns
|
if (columns.size() < 14) { // Normal Linux stat: 16 columns in total, busybox stat: 15 columns
|
||||||
emit q->warningMessage(warningString);
|
q->addWarningMessage(warningString);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
bool isNumber;
|
bool isNumber;
|
||||||
const qint64 secsSinceEpoch = columns.at(11).toLongLong(&isNumber);
|
const qint64 secsSinceEpoch = columns.at(11).toLongLong(&isNumber);
|
||||||
if (!isNumber) {
|
if (!isNumber) {
|
||||||
emit q->warningMessage(warningString);
|
q->addWarningMessage(warningString);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return QDateTime::fromSecsSinceEpoch(secsSinceEpoch);
|
return QDateTime::fromSecsSinceEpoch(secsSinceEpoch);
|
||||||
@@ -166,10 +166,10 @@ TaskItem GenericDirectUploadStepPrivate::uploadTask(const TreeStorage<UploadStor
|
|||||||
{
|
{
|
||||||
const auto setupHandler = [this, storage](FileTransfer &transfer) {
|
const auto setupHandler = [this, storage](FileTransfer &transfer) {
|
||||||
if (storage->filesToUpload.isEmpty()) {
|
if (storage->filesToUpload.isEmpty()) {
|
||||||
emit q->progressMessage(Tr::tr("No files need to be uploaded."));
|
q->addProgressMessage(Tr::tr("No files need to be uploaded."));
|
||||||
return TaskAction::StopWithDone;
|
return TaskAction::StopWithDone;
|
||||||
}
|
}
|
||||||
emit q->progressMessage(Tr::tr("%n file(s) need to be uploaded.", "",
|
q->addProgressMessage(Tr::tr("%n file(s) need to be uploaded.", "",
|
||||||
storage->filesToUpload.size()));
|
storage->filesToUpload.size()));
|
||||||
FilesToTransfer files;
|
FilesToTransfer files;
|
||||||
for (const DeployableFile &file : std::as_const(storage->filesToUpload)) {
|
for (const DeployableFile &file : std::as_const(storage->filesToUpload)) {
|
||||||
@@ -177,26 +177,26 @@ TaskItem GenericDirectUploadStepPrivate::uploadTask(const TreeStorage<UploadStor
|
|||||||
const QString message = Tr::tr("Local file \"%1\" does not exist.")
|
const QString message = Tr::tr("Local file \"%1\" does not exist.")
|
||||||
.arg(file.localFilePath().toUserOutput());
|
.arg(file.localFilePath().toUserOutput());
|
||||||
if (m_ignoreMissingFiles) {
|
if (m_ignoreMissingFiles) {
|
||||||
emit q->warningMessage(message);
|
q->addWarningMessage(message);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
emit q->errorMessage(message);
|
q->addErrorMessage(message);
|
||||||
return TaskAction::StopWithError;
|
return TaskAction::StopWithError;
|
||||||
}
|
}
|
||||||
files.append({file.localFilePath(),
|
files.append({file.localFilePath(),
|
||||||
q->deviceConfiguration()->filePath(file.remoteFilePath())});
|
q->deviceConfiguration()->filePath(file.remoteFilePath())});
|
||||||
}
|
}
|
||||||
if (files.isEmpty()) {
|
if (files.isEmpty()) {
|
||||||
emit q->progressMessage(Tr::tr("No files need to be uploaded."));
|
q->addProgressMessage(Tr::tr("No files need to be uploaded."));
|
||||||
return TaskAction::StopWithDone;
|
return TaskAction::StopWithDone;
|
||||||
}
|
}
|
||||||
transfer.setFilesToTransfer(files);
|
transfer.setFilesToTransfer(files);
|
||||||
QObject::connect(&transfer, &FileTransfer::progress,
|
QObject::connect(&transfer, &FileTransfer::progress,
|
||||||
q, &GenericDirectUploadStep::progressMessage);
|
q, &GenericDirectUploadStep::addProgressMessage);
|
||||||
return TaskAction::Continue;
|
return TaskAction::Continue;
|
||||||
};
|
};
|
||||||
const auto errorHandler = [this](const FileTransfer &transfer) {
|
const auto errorHandler = [this](const FileTransfer &transfer) {
|
||||||
emit q->errorMessage(transfer.resultData().m_errorString);
|
q->addErrorMessage(transfer.resultData().m_errorString);
|
||||||
};
|
};
|
||||||
|
|
||||||
return Transfer(setupHandler, {}, errorHandler);
|
return Transfer(setupHandler, {}, errorHandler);
|
||||||
@@ -211,10 +211,10 @@ TaskItem GenericDirectUploadStepPrivate::chmodTask(const DeployableFile &file)
|
|||||||
const auto errorHandler = [=](const QtcProcess &process) {
|
const auto errorHandler = [=](const QtcProcess &process) {
|
||||||
const QString error = process.errorString();
|
const QString error = process.errorString();
|
||||||
if (!error.isEmpty()) {
|
if (!error.isEmpty()) {
|
||||||
emit q->warningMessage(Tr::tr("Remote chmod failed for file \"%1\": %2")
|
q->addWarningMessage(Tr::tr("Remote chmod failed for file \"%1\": %2")
|
||||||
.arg(file.remoteFilePath(), error));
|
.arg(file.remoteFilePath(), error));
|
||||||
} else if (process.exitCode() != 0) {
|
} else if (process.exitCode() != 0) {
|
||||||
emit q->warningMessage(Tr::tr("Remote chmod failed for file \"%1\": %2")
|
q->addWarningMessage(Tr::tr("Remote chmod failed for file \"%1\": %2")
|
||||||
.arg(file.remoteFilePath(), process.cleanedStdErr()));
|
.arg(file.remoteFilePath(), process.cleanedStdErr()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -271,7 +271,7 @@ Group GenericDirectUploadStep::deployRecipe()
|
|||||||
saveDeploymentTimeStamp(file, timestamp);
|
saveDeploymentTimeStamp(file, timestamp);
|
||||||
};
|
};
|
||||||
const auto doneHandler = [this] {
|
const auto doneHandler = [this] {
|
||||||
emit progressMessage(Tr::tr("All files successfully deployed."));
|
addProgressMessage(Tr::tr("All files successfully deployed."));
|
||||||
};
|
};
|
||||||
|
|
||||||
const TreeStorage<UploadStorage> storage;
|
const TreeStorage<UploadStorage> storage;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public:
|
|||||||
static QString displayName();
|
static QString displayName();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend class GenericDirectUploadStepPrivate;
|
||||||
class GenericDirectUploadStepPrivate *d;
|
class GenericDirectUploadStepPrivate *d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -47,14 +47,14 @@ Group KillAppStep::deployRecipe()
|
|||||||
{
|
{
|
||||||
const auto setupHandler = [this](DeviceProcessKiller &killer) {
|
const auto setupHandler = [this](DeviceProcessKiller &killer) {
|
||||||
killer.setProcessPath(m_remoteExecutable);
|
killer.setProcessPath(m_remoteExecutable);
|
||||||
emit progressMessage(Tr::tr("Trying to kill \"%1\" on remote device...")
|
addProgressMessage(Tr::tr("Trying to kill \"%1\" on remote device...")
|
||||||
.arg(m_remoteExecutable.path()));
|
.arg(m_remoteExecutable.path()));
|
||||||
};
|
};
|
||||||
const auto doneHandler = [this](const DeviceProcessKiller &) {
|
const auto doneHandler = [this](const DeviceProcessKiller &) {
|
||||||
emit progressMessage(Tr::tr("Remote application killed."));
|
addProgressMessage(Tr::tr("Remote application killed."));
|
||||||
};
|
};
|
||||||
const auto errorHandler = [this](const DeviceProcessKiller &) {
|
const auto errorHandler = [this](const DeviceProcessKiller &) {
|
||||||
emit progressMessage(Tr::tr("Failed to kill remote application. "
|
addProgressMessage(Tr::tr("Failed to kill remote application. "
|
||||||
"Assuming it was not running."));
|
"Assuming it was not running."));
|
||||||
};
|
};
|
||||||
return Group { Killer(setupHandler, doneHandler, errorHandler) };
|
return Group { Killer(setupHandler, doneHandler, errorHandler) };
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ TaskItem RsyncDeployStep::mkdirTask()
|
|||||||
process.setCommand({deviceConfiguration()->filePath("mkdir"),
|
process.setCommand({deviceConfiguration()->filePath("mkdir"),
|
||||||
QStringList("-p") + remoteDirs});
|
QStringList("-p") + remoteDirs});
|
||||||
connect(&process, &QtcProcess::readyReadStandardError, this, [this, proc = &process] {
|
connect(&process, &QtcProcess::readyReadStandardError, this, [this, proc = &process] {
|
||||||
emit stdErrData(QString::fromLocal8Bit(proc->readAllRawStandardError()));
|
handleStdErrData(QString::fromLocal8Bit(proc->readAllRawStandardError()));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const auto errorHandler = [this](const QtcProcess &process) {
|
const auto errorHandler = [this](const QtcProcess &process) {
|
||||||
@@ -97,7 +97,7 @@ TaskItem RsyncDeployStep::mkdirTask()
|
|||||||
finalMessage += '\n';
|
finalMessage += '\n';
|
||||||
finalMessage += stdErr;
|
finalMessage += stdErr;
|
||||||
}
|
}
|
||||||
emit errorMessage(Tr::tr("Deploy via rsync: failed to create remote directories:")
|
addErrorMessage(Tr::tr("Deploy via rsync: failed to create remote directories:")
|
||||||
+ '\n' + finalMessage);
|
+ '\n' + finalMessage);
|
||||||
};
|
};
|
||||||
return Process(setupHandler, {}, errorHandler);
|
return Process(setupHandler, {}, errorHandler);
|
||||||
@@ -110,16 +110,16 @@ TaskItem RsyncDeployStep::transferTask()
|
|||||||
transfer.setRsyncFlags(m_flags);
|
transfer.setRsyncFlags(m_flags);
|
||||||
transfer.setFilesToTransfer(m_files);
|
transfer.setFilesToTransfer(m_files);
|
||||||
connect(&transfer, &FileTransfer::progress,
|
connect(&transfer, &FileTransfer::progress,
|
||||||
this, &AbstractRemoteLinuxDeployStep::stdOutData);
|
this, &AbstractRemoteLinuxDeployStep::handleStdOutData);
|
||||||
};
|
};
|
||||||
const auto errorHandler = [this](const FileTransfer &transfer) {
|
const auto errorHandler = [this](const FileTransfer &transfer) {
|
||||||
const ProcessResultData result = transfer.resultData();
|
const ProcessResultData result = transfer.resultData();
|
||||||
if (result.m_error == QProcess::FailedToStart) {
|
if (result.m_error == QProcess::FailedToStart) {
|
||||||
emit errorMessage(Tr::tr("rsync failed to start: %1").arg(result.m_errorString));
|
addErrorMessage(Tr::tr("rsync failed to start: %1").arg(result.m_errorString));
|
||||||
} else if (result.m_exitStatus == QProcess::CrashExit) {
|
} else if (result.m_exitStatus == QProcess::CrashExit) {
|
||||||
emit errorMessage(Tr::tr("rsync crashed."));
|
addErrorMessage(Tr::tr("rsync crashed."));
|
||||||
} else if (result.m_exitCode != 0) {
|
} else if (result.m_exitCode != 0) {
|
||||||
emit errorMessage(Tr::tr("rsync failed with exit code %1.").arg(result.m_exitCode)
|
addErrorMessage(Tr::tr("rsync failed with exit code %1.").arg(result.m_exitCode)
|
||||||
+ "\n" + result.m_errorString);
|
+ "\n" + result.m_errorString);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -84,15 +84,15 @@ TaskItem TarPackageDeployStep::uploadTask()
|
|||||||
const FilesToTransfer files {{m_packageFilePath,
|
const FilesToTransfer files {{m_packageFilePath,
|
||||||
deviceConfiguration()->filePath(remoteFilePath())}};
|
deviceConfiguration()->filePath(remoteFilePath())}};
|
||||||
transfer.setFilesToTransfer(files);
|
transfer.setFilesToTransfer(files);
|
||||||
connect(&transfer, &FileTransfer::progress, this, &TarPackageDeployStep::progressMessage);
|
connect(&transfer, &FileTransfer::progress, this, &TarPackageDeployStep::addProgressMessage);
|
||||||
emit progressMessage(Tr::tr("Uploading package to device..."));
|
addProgressMessage(Tr::tr("Uploading package to device..."));
|
||||||
};
|
};
|
||||||
const auto doneHandler = [this](const FileTransfer &) {
|
const auto doneHandler = [this](const FileTransfer &) {
|
||||||
emit progressMessage(Tr::tr("Successfully uploaded package file."));
|
addProgressMessage(Tr::tr("Successfully uploaded package file."));
|
||||||
};
|
};
|
||||||
const auto errorHandler = [this](const FileTransfer &transfer) {
|
const auto errorHandler = [this](const FileTransfer &transfer) {
|
||||||
const ProcessResultData result = transfer.resultData();
|
const ProcessResultData result = transfer.resultData();
|
||||||
emit errorMessage(result.m_errorString);
|
addErrorMessage(result.m_errorString);
|
||||||
};
|
};
|
||||||
return Transfer(setupHandler, doneHandler, errorHandler);
|
return Transfer(setupHandler, doneHandler, errorHandler);
|
||||||
}
|
}
|
||||||
@@ -105,19 +105,19 @@ TaskItem TarPackageDeployStep::installTask()
|
|||||||
process.setCommand({deviceConfiguration()->filePath("/bin/sh"), {"-c", cmdLine}});
|
process.setCommand({deviceConfiguration()->filePath("/bin/sh"), {"-c", cmdLine}});
|
||||||
QtcProcess *proc = &process;
|
QtcProcess *proc = &process;
|
||||||
connect(proc, &QtcProcess::readyReadStandardOutput, this, [this, proc] {
|
connect(proc, &QtcProcess::readyReadStandardOutput, this, [this, proc] {
|
||||||
emit stdOutData(proc->readAllStandardOutput());
|
handleStdOutData(proc->readAllStandardOutput());
|
||||||
});
|
});
|
||||||
connect(proc, &QtcProcess::readyReadStandardError, this, [this, proc] {
|
connect(proc, &QtcProcess::readyReadStandardError, this, [this, proc] {
|
||||||
emit stdErrData(proc->readAllStandardError());
|
handleStdErrData(proc->readAllStandardError());
|
||||||
});
|
});
|
||||||
emit progressMessage(Tr::tr("Installing package to device..."));
|
addProgressMessage(Tr::tr("Installing package to device..."));
|
||||||
};
|
};
|
||||||
const auto doneHandler = [this](const QtcProcess &) {
|
const auto doneHandler = [this](const QtcProcess &) {
|
||||||
saveDeploymentTimeStamp(DeployableFile(m_packageFilePath, {}), {});
|
saveDeploymentTimeStamp(DeployableFile(m_packageFilePath, {}), {});
|
||||||
emit progressMessage(Tr::tr("Successfully installed package file."));
|
addProgressMessage(Tr::tr("Successfully installed package file."));
|
||||||
};
|
};
|
||||||
const auto errorHandler = [this](const QtcProcess &process) {
|
const auto errorHandler = [this](const QtcProcess &process) {
|
||||||
emit errorMessage(Tr::tr("Installing package failed.") + process.errorString());
|
addErrorMessage(Tr::tr("Installing package failed.") + process.errorString());
|
||||||
};
|
};
|
||||||
return Process(setupHandler, doneHandler, errorHandler);
|
return Process(setupHandler, doneHandler, errorHandler);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user