Commit 036946cb authored by Christian Kandeler's avatar Christian Kandeler

Madde: Some Fremantle fixes for bugs introduced in recent refactorings.

- Enable remote mounts in run-only mode.
- Fix state machine of remote mounter.
- Suppress mount-related output for Harmattan projects.
- Do not use the df command's -P option, because Fremantle's busybox
does not understand it.

Change-Id: I8d8c96a67896238eb8a57a4dc3aedacd41ed7ab9
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent a5b4effb
......@@ -42,7 +42,9 @@ namespace Internal {
MaemoPreRunAction::MaemoPreRunAction(const IDevice::ConstPtr &device, const FileName &maddeRoot,
const QList<MaemoMountSpecification> &mountSpecs, QObject *parent)
: DeviceApplicationHelperAction(parent), m_mounter(new MaemoRemoteMounter(this))
: DeviceApplicationHelperAction(parent),
m_mounter(new MaemoRemoteMounter(this)),
m_isRunning(false)
{
m_mounter->setParameters(device, maddeRoot);
foreach (const MaemoMountSpecification &m, mountSpecs)
......@@ -69,11 +71,16 @@ void MaemoPreRunAction::start()
{
QTC_ASSERT(!m_isRunning, return);
m_isRunning = true;
if (!m_mounter->hasValidMountSpecifications()) {
setFinished(true);
return;
}
connect(m_mounter, SIGNAL(debugOutput(QString)), SIGNAL(reportProgress(QString)));
connect(m_mounter, SIGNAL(reportProgress(QString)), SIGNAL(reportProgress(QString)));
connect(m_mounter, SIGNAL(mounted()), SLOT(handleMounted()));
connect(m_mounter, SIGNAL(error(QString)), SLOT(handleError(QString)));
m_isRunning = true;
m_mounter->mount();
}
......@@ -81,7 +88,8 @@ void MaemoPreRunAction::stop()
{
QTC_ASSERT(m_isRunning, return);
m_mounter->stop();
if (m_mounter->hasValidMountSpecifications())
m_mounter->stop();
setFinished(false);
}
......@@ -95,7 +103,7 @@ void MaemoPreRunAction::setFinished(bool success)
}
MaemoPostRunAction::MaemoPostRunAction(MaemoRemoteMounter *mounter, QObject *parent)
: DeviceApplicationHelperAction(parent), m_mounter(mounter)
: DeviceApplicationHelperAction(parent), m_mounter(mounter), m_isRunning(false)
{
}
......@@ -119,11 +127,16 @@ void MaemoPostRunAction::start()
{
QTC_ASSERT(!m_isRunning, return);
m_isRunning = true;
if (!m_mounter->hasValidMountSpecifications()) {
setFinished(true);
return;
}
connect(m_mounter, SIGNAL(debugOutput(QString)), SIGNAL(reportProgress(QString)));
connect(m_mounter, SIGNAL(reportProgress(QString)), SIGNAL(reportProgress(QString)));
connect(m_mounter, SIGNAL(unmounted()), SLOT(handleUnmounted()));
connect(m_mounter, SIGNAL(error(QString)), SLOT(handleError(QString)));
m_isRunning = true;
m_mounter->unmount();
}
......@@ -139,8 +152,10 @@ void MaemoPostRunAction::setFinished(bool success)
{
QTC_ASSERT(m_isRunning, return);
m_mounter->disconnect(this);
m_isRunning = false;
if (m_mounter->hasValidMountSpecifications()) {
m_mounter->disconnect(this);
m_isRunning = false;
}
emit finished(success);
}
......
......@@ -103,6 +103,7 @@ void MaemoRemoteMounter::mount()
emit reportProgress(tr("No directories to mount"));
emit mounted();
} else {
setState(GatheringPorts);
m_portsGatherer->start(m_devConf);
}
}
......
......@@ -66,6 +66,19 @@ QString pathFromId(Core::Id id)
return idStr.mid(prefix.size());
}
template<class Receiver> void setHelperActions(Receiver *receiver, MaemoRunConfiguration *runConfig,
RunControl *runControl)
{
const Profile * const profile = runConfig->target()->profile();
MaemoPreRunAction * const preRunAction = new MaemoPreRunAction(
DeviceProfileInformation::device(profile), MaemoGlobal::maddeRoot(profile),
runConfig->remoteMounts()->mountSpecs(), runControl);
MaemoPostRunAction * const postRunAction
= new MaemoPostRunAction(preRunAction->mounter(), runControl);
receiver->setApplicationRunnerPreRunAction(preRunAction);
receiver->setApplicationRunnerPostRunAction(postRunAction);
}
} // namespace
MaemoRunConfigurationFactory::MaemoRunConfigurationFactory(QObject *parent)
......@@ -196,8 +209,11 @@ RunControl* MaemoRunControlFactory::create(RunConfiguration *runConfig, RunMode
MaemoRunConfiguration *rc = qobject_cast<MaemoRunConfiguration *>(runConfig);
Q_ASSERT(rc);
if (mode == NormalRunMode)
return new RemoteLinuxRunControl(rc);
if (mode == NormalRunMode) {
RemoteLinuxRunControl * const runControl = new RemoteLinuxRunControl(rc);
setHelperActions(runControl, rc, runControl);
return runControl;
}
const DebuggerStartParameters params = LinuxDeviceDebugSupport::startParameters(rc);
DebuggerRunControl * const runControl = DebuggerPlugin::createDebugger(params, rc);
......@@ -205,13 +221,7 @@ RunControl* MaemoRunControlFactory::create(RunConfiguration *runConfig, RunMode
return 0;
LinuxDeviceDebugSupport * const debugSupport
= new LinuxDeviceDebugSupport(rc, runControl->engine());
const Profile * const profile = runConfig->target()->profile();
MaemoPreRunAction * const preRunAction = new MaemoPreRunAction(
DeviceProfileInformation::device(profile), MaemoGlobal::maddeRoot(profile),
rc->remoteMounts()->mountSpecs(), rc);
MaemoPostRunAction * const postRunAction = new MaemoPostRunAction(preRunAction->mounter(), rc);
debugSupport->setApplicationRunnerPreRunAction(preRunAction);
debugSupport->setApplicationRunnerPostRunAction(postRunAction);
setHelperActions(debugSupport, rc, runControl);
connect(runControl, SIGNAL(finished()), debugSupport, SLOT(handleDebuggingFinished()));
return runControl;
}
......
......@@ -130,7 +130,7 @@ void RemoteLinuxCheckForFreeDiskSpaceService::doDeploy()
d->processRunner = new QSsh::SshRemoteProcessRunner;
connect(d->processRunner, SIGNAL(processClosed(int)), SLOT(handleProcessFinished()));
connect(d->processRunner, SIGNAL(readyReadStandardError()), SLOT(handleStdErr()));
const QString command = QString::fromLocal8Bit("df -k -P %1 |tail -n 1 |sed 's/ */ /g' "
const QString command = QString::fromLocal8Bit("df -k %1 |tail -n 1 |sed 's/ */ /g' "
"|cut -d ' ' -f 4").arg(d->pathToCheck);
d->processRunner->run(command.toUtf8(), deviceConfiguration()->sshParameters());
}
......
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