forked from qt-creator/qt-creator
Maemo: Add option to disable packaging.
Task-number: QTCREATORBUG-1636 Reviewed-by: kh1
This commit is contained in:
@@ -63,6 +63,7 @@ static const QLatin1String SimulatorPathKey(PREFIX ".Simulator");
|
|||||||
static const QLatin1String DeviceIdKey(PREFIX ".DeviceId");
|
static const QLatin1String DeviceIdKey(PREFIX ".DeviceId");
|
||||||
static const QLatin1String LastDeployedHostsKey(PREFIX ".LastDeployedHosts");
|
static const QLatin1String LastDeployedHostsKey(PREFIX ".LastDeployedHosts");
|
||||||
static const QLatin1String LastDeployedFilesKey(PREFIX ".LastDeployedFiles");
|
static const QLatin1String LastDeployedFilesKey(PREFIX ".LastDeployedFiles");
|
||||||
|
static const QLatin1String LastDeployedRemotePathsKey(PREFIX ".LastDeployedRemotePaths");
|
||||||
static const QLatin1String LastDeployedTimesKey(PREFIX ".LastDeployedTimes");
|
static const QLatin1String LastDeployedTimesKey(PREFIX ".LastDeployedTimes");
|
||||||
static const QLatin1String ProFileKey(".ProFile");
|
static const QLatin1String ProFileKey(".ProFile");
|
||||||
|
|
||||||
|
|||||||
@@ -58,16 +58,16 @@ MaemoPackageContents::MaemoPackageContents(MaemoPackageCreationStep *packageStep
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
MaemoPackageContents::Deployable MaemoPackageContents::deployableAt(int row) const
|
MaemoDeployable MaemoPackageContents::deployableAt(int row) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(row >= 0 && row < rowCount());
|
Q_ASSERT(row >= 0 && row < rowCount());
|
||||||
return row == 0
|
return row == 0
|
||||||
? Deployable(m_packageStep->localExecutableFilePath(),
|
? MaemoDeployable(m_packageStep->localExecutableFilePath(),
|
||||||
remoteExecutableFilePath())
|
remoteExecutableFilePath())
|
||||||
: m_deployables.at(row - 1);
|
: m_deployables.at(row - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MaemoPackageContents::addDeployable(const Deployable &deployable)
|
bool MaemoPackageContents::addDeployable(const MaemoDeployable &deployable)
|
||||||
{
|
{
|
||||||
if (m_deployables.contains(deployable) || deployableAt(0) == deployable)
|
if (m_deployables.contains(deployable) || deployableAt(0) == deployable)
|
||||||
return false;
|
return false;
|
||||||
@@ -103,7 +103,7 @@ QVariant MaemoPackageContents::data(const QModelIndex &index, int role) const
|
|||||||
if (!index.isValid() || index.row() >= rowCount())
|
if (!index.isValid() || index.row() >= rowCount())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
const Deployable &d = deployableAt(index.row());
|
const MaemoDeployable &d = deployableAt(index.row());
|
||||||
if (index.column() == 0 && role == Qt::DisplayRole)
|
if (index.column() == 0 && role == Qt::DisplayRole)
|
||||||
return d.localFilePath;
|
return d.localFilePath;
|
||||||
if (role == Qt::DisplayRole || role == Qt::EditRole)
|
if (role == Qt::DisplayRole || role == Qt::EditRole)
|
||||||
@@ -151,7 +151,7 @@ QVariantMap MaemoPackageContents::toMap() const
|
|||||||
map.insert(REMOTE_EXE_KEY, m_remoteExecutableFilePath);
|
map.insert(REMOTE_EXE_KEY, m_remoteExecutableFilePath);
|
||||||
QStringList localFiles;
|
QStringList localFiles;
|
||||||
QStringList remoteFiles;
|
QStringList remoteFiles;
|
||||||
foreach (const Deployable &p, m_deployables) {
|
foreach (const MaemoDeployable &p, m_deployables) {
|
||||||
localFiles << p.localFilePath;
|
localFiles << p.localFilePath;
|
||||||
remoteFiles << p.remoteFilePath;
|
remoteFiles << p.remoteFilePath;
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,7 @@ void MaemoPackageContents::fromMap(const QVariantMap &map)
|
|||||||
qWarning("%s: serialized data inconsistent", Q_FUNC_INFO);
|
qWarning("%s: serialized data inconsistent", Q_FUNC_INFO);
|
||||||
const int count = qMin(localFiles.count(), remoteFiles.count());
|
const int count = qMin(localFiles.count(), remoteFiles.count());
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
m_deployables << Deployable(localFiles.at(i), remoteFiles.at(i));
|
m_deployables << MaemoDeployable(localFiles.at(i), remoteFiles.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MaemoPackageContents::remoteExecutableFilePath() const
|
QString MaemoPackageContents::remoteExecutableFilePath() const
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#define MAEMOPACKAGECONTENTS_H
|
#define MAEMOPACKAGECONTENTS_H
|
||||||
|
|
||||||
#include <QtCore/QAbstractTableModel>
|
#include <QtCore/QAbstractTableModel>
|
||||||
|
#include <QtCore/QHash>
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtCore/QVariantMap>
|
#include <QtCore/QVariantMap>
|
||||||
@@ -38,27 +39,32 @@
|
|||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
struct MaemoDeployable
|
||||||
|
{
|
||||||
|
MaemoDeployable(const QString &localFilePath, const QString &remoteFilePath)
|
||||||
|
: localFilePath(localFilePath), remoteFilePath(remoteFilePath) {}
|
||||||
|
|
||||||
|
bool operator==(const MaemoDeployable &other) const
|
||||||
|
{
|
||||||
|
return localFilePath == other.localFilePath
|
||||||
|
&& remoteFilePath == other.remoteFilePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString localFilePath;
|
||||||
|
QString remoteFilePath;
|
||||||
|
};
|
||||||
|
inline uint qHash(const MaemoDeployable &d)
|
||||||
|
{
|
||||||
|
return qHash(qMakePair(d.localFilePath, d.remoteFilePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class MaemoPackageCreationStep;
|
class MaemoPackageCreationStep;
|
||||||
|
|
||||||
class MaemoPackageContents : public QAbstractTableModel
|
class MaemoPackageContents : public QAbstractTableModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
struct Deployable
|
|
||||||
{
|
|
||||||
Deployable(const QString &localFilePath, const QString &remoteFilePath)
|
|
||||||
: localFilePath(localFilePath), remoteFilePath(remoteFilePath) {}
|
|
||||||
|
|
||||||
bool operator==(const Deployable &other) const
|
|
||||||
{
|
|
||||||
return localFilePath == other.localFilePath
|
|
||||||
&& remoteFilePath == other.remoteFilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString localFilePath;
|
|
||||||
QString remoteFilePath;
|
|
||||||
};
|
|
||||||
|
|
||||||
MaemoPackageContents(MaemoPackageCreationStep *packageStep);
|
MaemoPackageContents(MaemoPackageCreationStep *packageStep);
|
||||||
|
|
||||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
@@ -66,8 +72,8 @@ public:
|
|||||||
QVariantMap toMap() const;
|
QVariantMap toMap() const;
|
||||||
void fromMap(const QVariantMap &map);
|
void fromMap(const QVariantMap &map);
|
||||||
|
|
||||||
Deployable deployableAt(int row) const;
|
MaemoDeployable deployableAt(int row) const;
|
||||||
bool addDeployable(const Deployable &deployable);
|
bool addDeployable(const MaemoDeployable &deployable);
|
||||||
void removeDeployableAt(int row);
|
void removeDeployableAt(int row);
|
||||||
bool isModified() const { return m_modified; }
|
bool isModified() const { return m_modified; }
|
||||||
void setUnModified() { m_modified = false; }
|
void setUnModified() { m_modified = false; }
|
||||||
@@ -85,7 +91,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const MaemoPackageCreationStep * const m_packageStep;
|
const MaemoPackageCreationStep * const m_packageStep;
|
||||||
QList<Deployable> m_deployables;
|
QList<MaemoDeployable> m_deployables;
|
||||||
bool m_modified;
|
bool m_modified;
|
||||||
mutable QString m_remoteExecutableFilePath;
|
mutable QString m_remoteExecutableFilePath;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -186,8 +186,7 @@ bool MaemoPackageCreationStep::createPackage()
|
|||||||
const QDir debianRoot = QDir(buildDir % QLatin1String("/debian/")
|
const QDir debianRoot = QDir(buildDir % QLatin1String("/debian/")
|
||||||
% executableFileName().toLower());
|
% executableFileName().toLower());
|
||||||
for (int i = 0; i < m_packageContents->rowCount(); ++i) {
|
for (int i = 0; i < m_packageContents->rowCount(); ++i) {
|
||||||
const MaemoPackageContents::Deployable &d
|
const MaemoDeployable &d = m_packageContents->deployableAt(i);
|
||||||
= m_packageContents->deployableAt(i);
|
|
||||||
const QString targetFile = debianRoot.path() + '/' + d.remoteFilePath;
|
const QString targetFile = debianRoot.path() + '/' + d.remoteFilePath;
|
||||||
const QString absTargetDir = QFileInfo(targetFile).dir().path();
|
const QString absTargetDir = QFileInfo(targetFile).dir().path();
|
||||||
const QString relTargetDir = debianRoot.relativeFilePath(absTargetDir);
|
const QString relTargetDir = debianRoot.relativeFilePath(absTargetDir);
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ MaemoPackageCreationWidget::MaemoPackageCreationWidget(MaemoPackageCreationStep
|
|||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_ui->skipCheckBox->setChecked(!m_step->isPackagingEnabled());
|
m_ui->skipCheckBox->setChecked(!m_step->isPackagingEnabled());
|
||||||
m_ui->packageContentsView->setEnabled(m_step->isPackagingEnabled());
|
|
||||||
m_ui->packageContentsView->setModel(step->packageContents());
|
m_ui->packageContentsView->setModel(step->packageContents());
|
||||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
connect(step->packageContents(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
|
connect(step->packageContents(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
|
||||||
@@ -104,8 +103,7 @@ void MaemoPackageCreationWidget::addFile()
|
|||||||
const QString localFile = QFileDialog::getOpenFileName(this, title, baseDir);
|
const QString localFile = QFileDialog::getOpenFileName(this, title, baseDir);
|
||||||
if (localFile.isEmpty())
|
if (localFile.isEmpty())
|
||||||
return;
|
return;
|
||||||
const MaemoPackageContents::Deployable
|
const MaemoDeployable deployable(QFileInfo(localFile).absoluteFilePath(), "/");
|
||||||
deployable(QFileInfo(localFile).absoluteFilePath(), "/");
|
|
||||||
MaemoPackageContents * const contents = m_step->packageContents();
|
MaemoPackageContents * const contents = m_step->packageContents();
|
||||||
if (!contents->addDeployable(deployable)) {
|
if (!contents->addDeployable(deployable)) {
|
||||||
QMessageBox::information(this, tr("File already in package"),
|
QMessageBox::information(this, tr("File already in package"),
|
||||||
@@ -141,7 +139,6 @@ void MaemoPackageCreationWidget::enableOrDisableRemoveButton()
|
|||||||
void MaemoPackageCreationWidget::handleSkipButtonToggled(bool checked)
|
void MaemoPackageCreationWidget::handleSkipButtonToggled(bool checked)
|
||||||
{
|
{
|
||||||
m_step->setPackagingEnabled(!checked);
|
m_step->setPackagingEnabled(!checked);
|
||||||
m_ui->packageContentsView->setEnabled(m_step->isPackagingEnabled());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -23,8 +23,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="skipCheckBox">
|
<widget class="QCheckBox" name="skipCheckBox">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Check this if you build the package externally. It still needs to be at the location listed above
|
<string>Check this if you want the files below to be deployed directly.</string>
|
||||||
and the remote executable is assumed to be in the directory mentioned below.</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Skip Packaging Step</string>
|
<string>Skip Packaging Step</string>
|
||||||
@@ -40,7 +39,7 @@ and the remote executable is assumed to be in the directory mentioned below.</st
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Package contents:</string>
|
<string>Files to deploy:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -134,15 +134,18 @@ void MaemoRunConfiguration::addDeployTimesToMap(QVariantMap &map) const
|
|||||||
{
|
{
|
||||||
QVariantList hostList;
|
QVariantList hostList;
|
||||||
QVariantList fileList;
|
QVariantList fileList;
|
||||||
|
QVariantList remotePathList;
|
||||||
QVariantList timeList;
|
QVariantList timeList;
|
||||||
typedef QMap<DeployablePerHost, QDateTime>::ConstIterator DepIt;
|
typedef QHash<DeployablePerHost, QDateTime>::ConstIterator DepIt;
|
||||||
for (DepIt it = m_lastDeployed.begin(); it != m_lastDeployed.end(); ++it) {
|
for (DepIt it = m_lastDeployed.begin(); it != m_lastDeployed.end(); ++it) {
|
||||||
hostList << it.key().first;
|
hostList << it.key().first.localFilePath;
|
||||||
|
remotePathList << it.key().first.remoteFilePath;
|
||||||
fileList << it.key().second;
|
fileList << it.key().second;
|
||||||
timeList << it.value();
|
timeList << it.value();
|
||||||
}
|
}
|
||||||
map.insert(LastDeployedHostsKey, hostList);
|
map.insert(LastDeployedHostsKey, hostList);
|
||||||
map.insert(LastDeployedFilesKey, fileList);
|
map.insert(LastDeployedFilesKey, fileList);
|
||||||
|
map.insert(LastDeployedRemotePathsKey, remotePathList);
|
||||||
map.insert(LastDeployedTimesKey, timeList);
|
map.insert(LastDeployedTimesKey, timeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,28 +168,33 @@ void MaemoRunConfiguration::getDeployTimesFromMap(const QVariantMap &map)
|
|||||||
{
|
{
|
||||||
const QVariantList &hostList = map.value(LastDeployedHostsKey).toList();
|
const QVariantList &hostList = map.value(LastDeployedHostsKey).toList();
|
||||||
const QVariantList &fileList = map.value(LastDeployedFilesKey).toList();
|
const QVariantList &fileList = map.value(LastDeployedFilesKey).toList();
|
||||||
|
const QVariantList &remotePathList
|
||||||
|
= map.value(LastDeployedRemotePathsKey).toList();
|
||||||
const QVariantList &timeList = map.value(LastDeployedTimesKey).toList();
|
const QVariantList &timeList = map.value(LastDeployedTimesKey).toList();
|
||||||
const int elemCount
|
const int elemCount
|
||||||
= qMin(qMin(hostList.size(), fileList.size()), timeList.size());
|
= qMin(qMin(hostList.size(), fileList.size()),
|
||||||
|
qMin(remotePathList.size(), timeList.size()));
|
||||||
for (int i = 0; i < elemCount; ++i) {
|
for (int i = 0; i < elemCount; ++i) {
|
||||||
m_lastDeployed.insert(DeployablePerHost(hostList.at(i).toString(),
|
const MaemoDeployable d(fileList.at(i).toString(),
|
||||||
fileList.at(i).toString()), timeList.at(i).toDateTime());
|
remotePathList.at(i).toString());
|
||||||
|
m_lastDeployed.insert(DeployablePerHost(d, hostList.at(i).toString()),
|
||||||
|
timeList.at(i).toDateTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MaemoRunConfiguration::currentlyNeedsDeployment(const QString &host,
|
bool MaemoRunConfiguration::currentlyNeedsDeployment(const QString &host,
|
||||||
const QString &file) const
|
const MaemoDeployable &deployable) const
|
||||||
{
|
{
|
||||||
const QDateTime &lastDeployed
|
const QDateTime &lastDeployed
|
||||||
= m_lastDeployed.value(DeployablePerHost(host, file));
|
= m_lastDeployed.value(DeployablePerHost(deployable, host));
|
||||||
return !lastDeployed.isValid()
|
return !lastDeployed.isValid()
|
||||||
|| QFileInfo(file).lastModified() > lastDeployed;
|
|| QFileInfo(deployable.localFilePath).lastModified() > lastDeployed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRunConfiguration::setDeployed(const QString &host,
|
void MaemoRunConfiguration::setDeployed(const QString &host,
|
||||||
const QString &file)
|
const MaemoDeployable &deployable)
|
||||||
{
|
{
|
||||||
m_lastDeployed.insert(DeployablePerHost(host, file),
|
m_lastDeployed.insert(DeployablePerHost(deployable, host),
|
||||||
QDateTime::currentDateTime());
|
QDateTime::currentDateTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "maemoconstants.h"
|
#include "maemoconstants.h"
|
||||||
#include "maemodeviceconfigurations.h"
|
#include "maemodeviceconfigurations.h"
|
||||||
|
#include "maemopackagecontents.h"
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
|
||||||
@@ -70,8 +71,8 @@ public:
|
|||||||
Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
|
Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
|
||||||
|
|
||||||
bool currentlyNeedsDeployment(const QString &host,
|
bool currentlyNeedsDeployment(const QString &host,
|
||||||
const QString &file) const;
|
const MaemoDeployable &deployable) const;
|
||||||
void setDeployed(const QString &host, const QString &file);
|
void setDeployed(const QString &host, const MaemoDeployable &deployable);
|
||||||
|
|
||||||
const MaemoPackageCreationStep *packageStep() const;
|
const MaemoPackageCreationStep *packageStep() const;
|
||||||
|
|
||||||
@@ -118,8 +119,8 @@ private:
|
|||||||
MaemoDeviceConfig m_devConfig;
|
MaemoDeviceConfig m_devConfig;
|
||||||
QStringList m_arguments;
|
QStringList m_arguments;
|
||||||
|
|
||||||
typedef QPair<QString, QString> DeployablePerHost;
|
typedef QPair<MaemoDeployable, QString> DeployablePerHost;
|
||||||
QMap<DeployablePerHost, QDateTime> m_lastDeployed;
|
QHash<DeployablePerHost, QDateTime> m_lastDeployed;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
#include "maemoruncontrol.h"
|
#include "maemoruncontrol.h"
|
||||||
|
|
||||||
#include "maemopackagecontents.h"
|
|
||||||
#include "maemopackagecreationstep.h"
|
#include "maemopackagecreationstep.h"
|
||||||
#include "maemosshthread.h"
|
#include "maemosshthread.h"
|
||||||
#include "maemorunconfiguration.h"
|
#include "maemorunconfiguration.h"
|
||||||
@@ -46,6 +45,7 @@
|
|||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <QtCore/QCryptographicHash>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
#include <QtCore/QFuture>
|
#include <QtCore/QFuture>
|
||||||
@@ -123,27 +123,55 @@ void AbstractMaemoRunControl::startDeployment(bool forDebugging)
|
|||||||
if (m_stoppedByUser) {
|
if (m_stoppedByUser) {
|
||||||
emit finished();
|
emit finished();
|
||||||
} else {
|
} else {
|
||||||
|
m_needsInstall = false;
|
||||||
m_deployables.clear();
|
m_deployables.clear();
|
||||||
if (m_runConfig->currentlyNeedsDeployment(m_devConfig.server.host,
|
m_remoteLinks.clear();
|
||||||
packageFilePath())) {
|
const MaemoPackageCreationStep * const packageStep
|
||||||
m_deployables.append(Deployable(packageFileName(),
|
= m_runConfig->packageStep();
|
||||||
QFileInfo(executableOnHost()).canonicalPath()));
|
if (packageStep->isPackagingEnabled()) {
|
||||||
m_needsInstall = true;
|
const MaemoDeployable d(packageFilePath(),
|
||||||
|
remoteDir() + '/' + packageFileName());
|
||||||
|
m_needsInstall = addDeployableIfNeeded(d);
|
||||||
} else {
|
} else {
|
||||||
m_needsInstall = false;
|
const MaemoPackageContents * const packageContents
|
||||||
|
= packageStep->packageContents();
|
||||||
|
for (int i = 0; i < packageContents->rowCount(); ++i) {
|
||||||
|
const MaemoDeployable &d = packageContents->deployableAt(i);
|
||||||
|
if (addDeployableIfNeeded(d))
|
||||||
|
m_needsInstall = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (forDebugging) {
|
if (forDebugging) {
|
||||||
const QFileInfo info(m_runConfig->dumperLib());
|
QFileInfo dumperInfo(m_runConfig->dumperLib());
|
||||||
if (info.exists()
|
if (dumperInfo.exists()) {
|
||||||
&& m_runConfig->currentlyNeedsDeployment(m_devConfig.server.host,
|
const MaemoDeployable d(m_runConfig->dumperLib(),
|
||||||
info.filePath())) {
|
remoteDir() + '/' + dumperInfo.fileName());
|
||||||
m_deployables.append(Deployable(info.fileName(), info.canonicalPath()));
|
m_needsInstall = addDeployableIfNeeded(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deploy();
|
deploy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AbstractMaemoRunControl::addDeployableIfNeeded(const MaemoDeployable &deployable)
|
||||||
|
{
|
||||||
|
if (m_runConfig->currentlyNeedsDeployment(m_devConfig.server.host,
|
||||||
|
deployable)) {
|
||||||
|
const QString fileName
|
||||||
|
= QFileInfo(deployable.remoteFilePath).fileName();
|
||||||
|
const QString sftpTargetFilePath = remoteDir() + '/' + fileName + '.'
|
||||||
|
+ QCryptographicHash::hash(deployable.remoteFilePath.toUtf8(),
|
||||||
|
QCryptographicHash::Md5).toHex();
|
||||||
|
m_deployables.append(MaemoDeployable(deployable.localFilePath,
|
||||||
|
sftpTargetFilePath));
|
||||||
|
m_remoteLinks.insert(sftpTargetFilePath, deployable.remoteFilePath);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractMaemoRunControl::deploy()
|
void AbstractMaemoRunControl::deploy()
|
||||||
{
|
{
|
||||||
Core::ICore::instance()->progressManager()
|
Core::ICore::instance()->progressManager()
|
||||||
@@ -152,14 +180,11 @@ void AbstractMaemoRunControl::deploy()
|
|||||||
if (!m_deployables.isEmpty()) {
|
if (!m_deployables.isEmpty()) {
|
||||||
QList<Core::SftpTransferInfo> deploySpecs;
|
QList<Core::SftpTransferInfo> deploySpecs;
|
||||||
QStringList files;
|
QStringList files;
|
||||||
foreach (const Deployable &deployable, m_deployables) {
|
foreach (const MaemoDeployable &deployable, m_deployables) {
|
||||||
const QString srcFilePath
|
files << deployable.localFilePath;
|
||||||
= deployable.dir % QDir::separator() % deployable.fileName;
|
deploySpecs << Core::SftpTransferInfo(deployable.localFilePath,
|
||||||
const QString tgtFilePath
|
deployable.remoteFilePath.toUtf8(),
|
||||||
= remoteDir() % QDir::separator() % deployable.fileName;
|
Core::SftpTransferInfo::Upload);
|
||||||
files << srcFilePath;
|
|
||||||
deploySpecs << Core::SftpTransferInfo(srcFilePath,
|
|
||||||
tgtFilePath.toUtf8(), Core::SftpTransferInfo::Upload);
|
|
||||||
}
|
}
|
||||||
emit appendMessage(this, tr("Files to deploy: %1.").arg(files.join(" ")), false);
|
emit appendMessage(this, tr("Files to deploy: %1.").arg(files.join(" ")), false);
|
||||||
m_sshDeployer.reset(new MaemoSshDeployer(m_devConfig.server, deploySpecs));
|
m_sshDeployer.reset(new MaemoSshDeployer(m_devConfig.server, deploySpecs));
|
||||||
@@ -179,9 +204,10 @@ void AbstractMaemoRunControl::deploy()
|
|||||||
|
|
||||||
void AbstractMaemoRunControl::handleFileCopied()
|
void AbstractMaemoRunControl::handleFileCopied()
|
||||||
{
|
{
|
||||||
Deployable deployable = m_deployables.takeFirst();
|
const MaemoDeployable &deployable = m_deployables.takeFirst();
|
||||||
m_runConfig->setDeployed(m_devConfig.server.host,
|
m_runConfig->setDeployed(m_devConfig.server.host,
|
||||||
deployable.dir + QLatin1Char('/') + deployable.fileName);
|
MaemoDeployable(deployable.localFilePath,
|
||||||
|
m_remoteLinks.value(deployable.remoteFilePath)));
|
||||||
m_progress.setProgressValue(m_progress.progressValue() + 1);
|
m_progress.setProgressValue(m_progress.progressValue() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,8 +346,21 @@ QString AbstractMaemoRunControl::remoteSudo() const
|
|||||||
|
|
||||||
QString AbstractMaemoRunControl::remoteInstallCommand() const
|
QString AbstractMaemoRunControl::remoteInstallCommand() const
|
||||||
{
|
{
|
||||||
return QString::fromLocal8Bit("%1 dpkg -i %2").arg(remoteSudo())
|
Q_ASSERT(m_needsInstall);
|
||||||
.arg(packageFileName());
|
QString cmd;
|
||||||
|
for (QMap<QString, QString>::ConstIterator it = m_remoteLinks.begin();
|
||||||
|
it != m_remoteLinks.end(); ++it) {
|
||||||
|
cmd += QString::fromLocal8Bit("%1 ln -sf %2 %3 && ")
|
||||||
|
.arg(remoteSudo(), it.key(), it.value());
|
||||||
|
}
|
||||||
|
if (m_runConfig->packageStep()->isPackagingEnabled()) {
|
||||||
|
cmd += QString::fromLocal8Bit("%1 dpkg -i %2").arg(remoteSudo())
|
||||||
|
.arg(packageFileName());
|
||||||
|
} else if (!m_remoteLinks.isEmpty()) {
|
||||||
|
return cmd.remove(cmd.length() - 4, 4); // Trailing " && "
|
||||||
|
}
|
||||||
|
|
||||||
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString AbstractMaemoRunControl::targetCmdLinePrefix() const
|
const QString AbstractMaemoRunControl::targetCmdLinePrefix() const
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#define MAEMORUNCONTROL_H
|
#define MAEMORUNCONTROL_H
|
||||||
|
|
||||||
#include "maemodeviceconfigurations.h"
|
#include "maemodeviceconfigurations.h"
|
||||||
|
#include "maemopackagecontents.h"
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
|
||||||
@@ -97,6 +98,8 @@ protected:
|
|||||||
const MaemoDeviceConfig m_devConfig;
|
const MaemoDeviceConfig m_devConfig;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool addDeployableIfNeeded(const MaemoDeployable &deployable);
|
||||||
|
|
||||||
virtual void startInternal()=0;
|
virtual void startInternal()=0;
|
||||||
virtual void stopInternal()=0;
|
virtual void stopInternal()=0;
|
||||||
virtual QString remoteCall() const=0;
|
virtual QString remoteCall() const=0;
|
||||||
@@ -115,14 +118,8 @@ private:
|
|||||||
QScopedPointer<MaemoSshRunner> m_initialCleaner;
|
QScopedPointer<MaemoSshRunner> m_initialCleaner;
|
||||||
bool m_stoppedByUser;
|
bool m_stoppedByUser;
|
||||||
|
|
||||||
struct Deployable
|
QList<MaemoDeployable> m_deployables;
|
||||||
{
|
QMap<QString, QString> m_remoteLinks;
|
||||||
Deployable(const QString &f, const QString &d)
|
|
||||||
: fileName(f), dir(d) {}
|
|
||||||
QString fileName;
|
|
||||||
QString dir;
|
|
||||||
};
|
|
||||||
QList<Deployable> m_deployables;
|
|
||||||
bool m_needsInstall;
|
bool m_needsInstall;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user