summaryrefslogtreecommitdiff
path: root/src/plugins/remotelinux
diff options
context:
space:
mode:
authorAndreas Holzammer <andreas.holzammer@kdab.com>2012-10-08 15:46:38 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2012-10-09 11:02:48 +0200
commit47ff91a584dedc2be4f09fa4cd92b186b58155b5 (patch)
tree9b08fe1ba58b18d60975dd6d07eb93dc60d4eaec /src/plugins/remotelinux
parent5554e3616e1a584107b3e1c80cf12bc618fff74e (diff)
downloadqt-creator-47ff91a584dedc2be4f09fa4cd92b186b58155b5.tar.gz
Set executable flag on applications while deploying
Under Windows there is no executable flag in the filesystem. So take the information that we got, which file is an executable and set the executable flag if needed. Change-Id: I0a7026911d1f7791434c39cc0917d6e49cfa1667 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'src/plugins/remotelinux')
-rw-r--r--src/plugins/remotelinux/deployablefile.h15
-rw-r--r--src/plugins/remotelinux/deployablefilesperprofile.cpp2
-rw-r--r--src/plugins/remotelinux/genericdirectuploadservice.cpp36
-rw-r--r--src/plugins/remotelinux/genericdirectuploadservice.h1
4 files changed, 46 insertions, 8 deletions
diff --git a/src/plugins/remotelinux/deployablefile.h b/src/plugins/remotelinux/deployablefile.h
index 2e08884c6d..452850207d 100644
--- a/src/plugins/remotelinux/deployablefile.h
+++ b/src/plugins/remotelinux/deployablefile.h
@@ -41,10 +41,16 @@ namespace RemoteLinux {
class REMOTELINUX_EXPORT DeployableFile
{
public:
+ enum Type
+ {
+ TypeNormal,
+ TypeExecutable
+ };
+
DeployableFile() {}
- DeployableFile(const QString &localFilePath, const QString &remoteDir)
- : localFilePath(localFilePath), remoteDir(remoteDir) {}
+ DeployableFile(const QString &localFilePath, const QString &remoteDir, Type type = TypeNormal)
+ : localFilePath(localFilePath), remoteDir(remoteDir), type(type) {}
bool operator==(const DeployableFile &other) const
{
@@ -56,8 +62,13 @@ public:
return remoteDir + QLatin1Char('/') + QFileInfo(localFilePath).fileName();
}
+ bool isExecutable() const {
+ return type == TypeExecutable;
+ }
+
QString localFilePath;
QString remoteDir;
+ Type type;
};
inline uint qHash(const DeployableFile &d)
diff --git a/src/plugins/remotelinux/deployablefilesperprofile.cpp b/src/plugins/remotelinux/deployablefilesperprofile.cpp
index ee3cf3a184..9c7465faea 100644
--- a/src/plugins/remotelinux/deployablefilesperprofile.cpp
+++ b/src/plugins/remotelinux/deployablefilesperprofile.cpp
@@ -77,7 +77,7 @@ DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4ProFileNode *proFi
if (hasTargetPath()) {
if (d->projectType == ApplicationTemplate) {
d->deployables.prepend(DeployableFile(localExecutableFilePath(),
- d->installsList.targetPath));
+ d->installsList.targetPath, DeployableFile::TypeExecutable));
} else if (d->projectType == LibraryTemplate) {
foreach (const QString &filePath, localLibraryFilePaths()) {
d->deployables.prepend(DeployableFile(filePath,
diff --git a/src/plugins/remotelinux/genericdirectuploadservice.cpp b/src/plugins/remotelinux/genericdirectuploadservice.cpp
index 8e4a0ff11a..179401ba45 100644
--- a/src/plugins/remotelinux/genericdirectuploadservice.cpp
+++ b/src/plugins/remotelinux/genericdirectuploadservice.cpp
@@ -61,6 +61,7 @@ public:
SftpChannel::Ptr uploader;
SshRemoteProcess::Ptr mkdirProc;
SshRemoteProcess::Ptr lnProc;
+ SshRemoteProcess::Ptr chmodProc;
QList<DeployableFile> deployableFiles;
};
@@ -173,13 +174,19 @@ void GenericDirectUploadService::handleUploadFinished(QSsh::SftpJobId jobId, con
} else {
saveDeploymentTimeStamp(df);
- // Terrible hack for Windows.
- if (df.remoteDir.contains(QLatin1String("bin"))) {
+ // This is done for Windows.
+ if (df.isExecutable()) {
const QString command = QLatin1String("chmod a+x ") + df.remoteFilePath();
- connection()->createRemoteProcess(command.toUtf8())->start();
+ d->chmodProc = connection()->createRemoteProcess(command.toUtf8());
+ connect(d->chmodProc.data(), SIGNAL(closed(int)), SLOT(handleChmodFinished(int)));
+ connect(d->chmodProc.data(), SIGNAL(readyReadStandardOutput()),
+ SLOT(handleStdOutData()));
+ connect(d->chmodProc.data(), SIGNAL(readyReadStandardError()),
+ SLOT(handleStdErrData()));
+ d->chmodProc->start();
+ } else {
+ uploadNextFile();
}
-
- uploadNextFile();
}
}
@@ -205,6 +212,25 @@ void GenericDirectUploadService::handleLnFinished(int exitStatus)
}
}
+void GenericDirectUploadService::handleChmodFinished(int exitStatus)
+{
+ QTC_ASSERT(d->state == Uploading, setFinished(); return);
+
+ if (d->stopRequested) {
+ setFinished();
+ handleDeploymentDone();
+ return;
+ }
+
+ if (exitStatus != SshRemoteProcess::NormalExit || d->chmodProc->exitCode() != 0) {
+ emit errorMessage(tr("Failed to set executable flag."));
+ setFinished();
+ handleDeploymentDone();
+ return;
+ }
+ uploadNextFile();
+}
+
void GenericDirectUploadService::handleMkdirFinished(int exitStatus)
{
QTC_ASSERT(d->state == Uploading, setFinished(); return);
diff --git a/src/plugins/remotelinux/genericdirectuploadservice.h b/src/plugins/remotelinux/genericdirectuploadservice.h
index a36ba3e07d..e20a113fdb 100644
--- a/src/plugins/remotelinux/genericdirectuploadservice.h
+++ b/src/plugins/remotelinux/genericdirectuploadservice.h
@@ -67,6 +67,7 @@ private slots:
void handleUploadFinished(QSsh::SftpJobId jobId, const QString &errorMsg);
void handleMkdirFinished(int exitStatus);
void handleLnFinished(int exitStatus);
+ void handleChmodFinished(int exitStatus);
void handleStdOutData();
void handleStdErrData();