forked from qt-creator/qt-creator
RemoteLinux: Let user specify the rsync flags
Task-number: QTCREATORBUG-22352 Change-Id: I11c16b5f7c58093bb89a9493a8742f338dbdd9c1 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -230,7 +230,8 @@ void GenericLinuxDeviceTester::testRsync()
|
|||||||
this, [this] {
|
this, [this] {
|
||||||
handleRsyncFinished();
|
handleRsyncFinished();
|
||||||
});
|
});
|
||||||
const RsyncCommandLine cmdLine = RsyncDeployStep::rsyncCommand(*d->connection);
|
const RsyncCommandLine cmdLine = RsyncDeployStep::rsyncCommand(*d->connection,
|
||||||
|
RsyncDeployStep::defaultFlags());
|
||||||
const QStringList args = QStringList(cmdLine.options)
|
const QStringList args = QStringList(cmdLine.options)
|
||||||
<< "-n" << "--exclude=*" << (cmdLine.remoteHostSpec + ":/tmp");
|
<< "-n" << "--exclude=*" << (cmdLine.remoteHostSpec + ":/tmp");
|
||||||
d->rsyncProcess.start("rsync", args);
|
d->rsyncProcess.start("rsync", args);
|
||||||
|
@@ -51,6 +51,7 @@ public:
|
|||||||
|
|
||||||
void setDeployableFiles(const QList<DeployableFile> &files) { m_deployableFiles = files; }
|
void setDeployableFiles(const QList<DeployableFile> &files) { m_deployableFiles = files; }
|
||||||
void setIgnoreMissingFiles(bool ignore) { m_ignoreMissingFiles = ignore; }
|
void setIgnoreMissingFiles(bool ignore) { m_ignoreMissingFiles = ignore; }
|
||||||
|
void setFlags(const QString &flags) { m_flags = flags; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isDeploymentNecessary() const override;
|
bool isDeploymentNecessary() const override;
|
||||||
@@ -69,6 +70,7 @@ private:
|
|||||||
|
|
||||||
mutable QList<DeployableFile> m_deployableFiles;
|
mutable QList<DeployableFile> m_deployableFiles;
|
||||||
bool m_ignoreMissingFiles = false;
|
bool m_ignoreMissingFiles = false;
|
||||||
|
QString m_flags;
|
||||||
SshProcess m_rsync;
|
SshProcess m_rsync;
|
||||||
SshRemoteProcessPtr m_mkdir;
|
SshRemoteProcessPtr m_mkdir;
|
||||||
};
|
};
|
||||||
@@ -155,7 +157,7 @@ void RsyncDeployService::deployNextFile()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const DeployableFile file = m_deployableFiles.takeFirst();
|
const DeployableFile file = m_deployableFiles.takeFirst();
|
||||||
const RsyncCommandLine cmdLine = RsyncDeployStep::rsyncCommand(*connection());
|
const RsyncCommandLine cmdLine = RsyncDeployStep::rsyncCommand(*connection(), m_flags);
|
||||||
const QStringList args = QStringList(cmdLine.options)
|
const QStringList args = QStringList(cmdLine.options)
|
||||||
<< file.localFilePath().toString()
|
<< file.localFilePath().toString()
|
||||||
<< (cmdLine.remoteHostSpec + ':' + file.remoteFilePath());
|
<< (cmdLine.remoteHostSpec + ':' + file.remoteFilePath());
|
||||||
@@ -180,11 +182,18 @@ class RsyncDeployStep::RsyncDeployStepPrivate
|
|||||||
public:
|
public:
|
||||||
Internal::RsyncDeployService deployService;
|
Internal::RsyncDeployService deployService;
|
||||||
BaseBoolAspect *ignoreMissingFilesAspect;
|
BaseBoolAspect *ignoreMissingFilesAspect;
|
||||||
|
BaseStringAspect *flagsAspect;
|
||||||
};
|
};
|
||||||
|
|
||||||
RsyncDeployStep::RsyncDeployStep(BuildStepList *bsl)
|
RsyncDeployStep::RsyncDeployStep(BuildStepList *bsl)
|
||||||
: AbstractRemoteLinuxDeployStep(bsl, stepId()), d(new RsyncDeployStepPrivate)
|
: AbstractRemoteLinuxDeployStep(bsl, stepId()), d(new RsyncDeployStepPrivate)
|
||||||
{
|
{
|
||||||
|
d->flagsAspect = addAspect<BaseStringAspect>();
|
||||||
|
d->flagsAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
|
||||||
|
d->flagsAspect->setSettingsKey("RemoteLinux.RsyncDeployStep.Flags");
|
||||||
|
d->flagsAspect->setLabelText(tr("Flags:"));
|
||||||
|
d->flagsAspect->setValue(defaultFlags());
|
||||||
|
|
||||||
d->ignoreMissingFilesAspect = addAspect<BaseBoolAspect>();
|
d->ignoreMissingFilesAspect = addAspect<BaseBoolAspect>();
|
||||||
d->ignoreMissingFilesAspect
|
d->ignoreMissingFilesAspect
|
||||||
->setSettingsKey("RemoteLinux.RsyncDeployStep.IgnoreMissingFiles");
|
->setSettingsKey("RemoteLinux.RsyncDeployStep.IgnoreMissingFiles");
|
||||||
@@ -202,6 +211,7 @@ RsyncDeployStep::~RsyncDeployStep()
|
|||||||
CheckResult RsyncDeployStep::initInternal()
|
CheckResult RsyncDeployStep::initInternal()
|
||||||
{
|
{
|
||||||
d->deployService.setIgnoreMissingFiles(d->ignoreMissingFilesAspect->value());
|
d->deployService.setIgnoreMissingFiles(d->ignoreMissingFilesAspect->value());
|
||||||
|
d->deployService.setFlags(d->flagsAspect->value());
|
||||||
return d->deployService.isDeploymentPossible();
|
return d->deployService.isDeploymentPossible();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,13 +236,19 @@ QString RsyncDeployStep::displayName()
|
|||||||
return tr("Deploy files via rsync");
|
return tr("Deploy files via rsync");
|
||||||
}
|
}
|
||||||
|
|
||||||
RsyncCommandLine RsyncDeployStep::rsyncCommand(const SshConnection &sshConnection)
|
QString RsyncDeployStep::defaultFlags()
|
||||||
|
{
|
||||||
|
return QString("-av");
|
||||||
|
}
|
||||||
|
|
||||||
|
RsyncCommandLine RsyncDeployStep::rsyncCommand(const SshConnection &sshConnection,
|
||||||
|
const QString &flags)
|
||||||
{
|
{
|
||||||
const QString sshCmdLine = QtcProcess::joinArgs(
|
const QString sshCmdLine = QtcProcess::joinArgs(
|
||||||
QStringList{SshSettings::sshFilePath().toUserOutput()}
|
QStringList{SshSettings::sshFilePath().toUserOutput()}
|
||||||
<< sshConnection.connectionOptions());
|
<< sshConnection.connectionOptions());
|
||||||
const SshConnectionParameters sshParams = sshConnection.connectionParameters();
|
const SshConnectionParameters sshParams = sshConnection.connectionParameters();
|
||||||
return RsyncCommandLine(QStringList{"-e", sshCmdLine, "-av"},
|
return RsyncCommandLine(QStringList{"-e", sshCmdLine, flags},
|
||||||
sshParams.userName() + '@' + sshParams.host());
|
sshParams.userName() + '@' + sshParams.host());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,7 +51,9 @@ public:
|
|||||||
static Core::Id stepId();
|
static Core::Id stepId();
|
||||||
static QString displayName();
|
static QString displayName();
|
||||||
|
|
||||||
static RsyncCommandLine rsyncCommand(const QSsh::SshConnection &sshConnection);
|
static QString defaultFlags();
|
||||||
|
static RsyncCommandLine rsyncCommand(const QSsh::SshConnection &sshConnection,
|
||||||
|
const QString &flags);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AbstractRemoteLinuxDeployService *deployService() const override;
|
AbstractRemoteLinuxDeployService *deployService() const override;
|
||||||
|
Reference in New Issue
Block a user