Commit 1914d05d authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Maemo: Introduce explicit states to deploy step.

Probably fixed some subtle error handling bugs along the way.

Task-number: QTCREATORBUG-2705
parent 706a04c6
...@@ -83,13 +83,14 @@ public: ...@@ -83,13 +83,14 @@ public:
bool isDeployToSysrootEnabled() const { return m_deployToSysroot; } bool isDeployToSysrootEnabled() const { return m_deployToSysroot; }
void setDeployToSysrootEnabled(bool deploy) { m_deployToSysroot = deploy; } void setDeployToSysrootEnabled(bool deploy) { m_deployToSysroot = deploy; }
Q_INVOKABLE void stop();
signals: signals:
void done(); void done();
void error(); void error();
private slots: private slots:
void start(); void start();
void stop();
void handleConnected(); void handleConnected();
void handleConnectionFailure(); void handleConnectionFailure();
void handleMounted(); void handleMounted();
...@@ -98,13 +99,13 @@ private slots: ...@@ -98,13 +99,13 @@ private slots:
void handleMountDebugOutput(const QString &output); void handleMountDebugOutput(const QString &output);
void handleProgressReport(const QString &progressMsg); void handleProgressReport(const QString &progressMsg);
void handleCopyProcessFinished(int exitStatus); void handleCopyProcessFinished(int exitStatus);
void handleCleanupTimeout();
void handleSysrootInstallerFinished(); void handleSysrootInstallerFinished();
void handleSysrootInstallerOutput(); void handleSysrootInstallerOutput();
void handleSysrootInstallerErrorOutput(); void handleSysrootInstallerErrorOutput();
void handleSftpChannelInitialized(); void handleSftpChannelInitialized();
void handleSftpChannelInitializationFailed(const QString &error); void handleSftpChannelInitializationFailed(const QString &error);
void handleSftpJobFinished(Core::SftpJobId job, const QString &error); void handleSftpJobFinished(Core::SftpJobId job, const QString &error);
void handleSftpChannelClosed();
void handleInstallationFinished(int exitStatus); void handleInstallationFinished(int exitStatus);
void handleDeviceInstallerOutput(const QByteArray &output); void handleDeviceInstallerOutput(const QByteArray &output);
void handleDeviceInstallerErrorOutput(const QByteArray &output); void handleDeviceInstallerErrorOutput(const QByteArray &output);
...@@ -112,6 +113,13 @@ private slots: ...@@ -112,6 +113,13 @@ private slots:
void handlePortListReady(); void handlePortListReady();
private: private:
enum State {
Inactive, StopRequested, InstallingToSysroot, Connecting,
UnmountingOldDirs, UnmountingCurrentDirs, GatheringPorts, Mounting,
InstallingToDevice, UnmountingCurrentMounts, CopyingFile,
InitializingSftp, Uploading
};
MaemoDeployStep(ProjectExplorer::BuildStepList *bc, MaemoDeployStep(ProjectExplorer::BuildStepList *bc,
MaemoDeployStep *other); MaemoDeployStep *other);
virtual bool init(); virtual bool init();
...@@ -136,7 +144,9 @@ private: ...@@ -136,7 +144,9 @@ private:
void unmountOldDirs(); void unmountOldDirs();
void setupMount(); void setupMount();
void prepareSftpConnection(); void prepareSftpConnection();
void runDpkg(const QString &packageFilePath, bool removeAfterInstall); void runDpkg(const QString &packageFilePath);
void setState(State newState);
void unmount();
static const QLatin1String Id; static const QLatin1String Id;
...@@ -147,22 +157,17 @@ private: ...@@ -147,22 +157,17 @@ private:
QScopedPointer<DeviceDeployAction> m_currentDeviceDeployAction; QScopedPointer<DeviceDeployAction> m_currentDeviceDeployAction;
QList<MaemoDeployable> m_filesToCopy; QList<MaemoDeployable> m_filesToCopy;
MaemoRemoteMounter *m_mounter; MaemoRemoteMounter *m_mounter;
QTimer *m_cleanupTimer;
bool m_canStart;
bool m_deployToSysroot; bool m_deployToSysroot;
enum UnmountState { OldDirsUnmount, CurrentDirsUnmount, CurrentMountsUnmount };
UnmountState m_unmountState;
QSharedPointer<Core::SftpChannel> m_uploader; QSharedPointer<Core::SftpChannel> m_uploader;
QSharedPointer<Core::SshRemoteProcess> m_deviceInstaller; QSharedPointer<Core::SshRemoteProcess> m_deviceInstaller;
bool m_stopped;
bool m_needsInstall; bool m_needsInstall;
bool m_connecting;
typedef QPair<MaemoDeployable, QString> DeployablePerHost; typedef QPair<MaemoDeployable, QString> DeployablePerHost;
QHash<DeployablePerHost, QDateTime> m_lastDeployed; QHash<DeployablePerHost, QDateTime> m_lastDeployed;
MaemoDeviceConfigListModel *m_deviceConfigModel; MaemoDeviceConfigListModel *m_deviceConfigModel;
MaemoUsedPortsGatherer *m_portsGatherer; MaemoUsedPortsGatherer *m_portsGatherer;
MaemoPortList m_freePorts; MaemoPortList m_freePorts;
State m_state;
}; };
class MaemoDeployEventHandler : public QObject class MaemoDeployEventHandler : public QObject
...@@ -178,9 +183,10 @@ private slots: ...@@ -178,9 +183,10 @@ private slots:
void checkForCanceled(); void checkForCanceled();
private: private:
const MaemoDeployStep * const m_deployStep; MaemoDeployStep * const m_deployStep;
const QFutureInterface<bool> m_future; const QFutureInterface<bool> m_future;
QEventLoop * const m_eventLoop; QEventLoop * const m_eventLoop;
bool m_error;
}; };
} // namespace Internal } // namespace Internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment