2011-03-09 12:07:35 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2011-03-09 12:07:35 +01:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2011-03-09 12:07:35 +01:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
2011-05-06 15:05:37 +02:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2011-03-09 12:07:35 +01:00
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-05-06 15:05:37 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2011-03-09 12:07:35 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-05-06 15:05:37 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2011-03-09 12:07:35 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2011-03-09 12:07:35 +01:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
2011-05-06 15:05:37 +02:00
|
|
|
|
2011-03-09 12:07:35 +01:00
|
|
|
#include "maemoinstalltosysrootstep.h"
|
|
|
|
|
|
|
|
|
|
#include "maemoglobal.h"
|
|
|
|
|
#include "maemopackagecreationstep.h"
|
2011-06-08 15:35:43 +02:00
|
|
|
#include "maemoqtversion.h"
|
2011-10-24 17:29:58 +02:00
|
|
|
#include "qt4maemotarget.h"
|
2011-03-09 12:07:35 +01:00
|
|
|
|
2011-07-05 12:59:14 +02:00
|
|
|
#include <utils/fileutils.h>
|
|
|
|
|
|
2011-03-09 12:07:35 +01:00
|
|
|
#include <qt4projectmanager/qt4buildconfiguration.h>
|
|
|
|
|
#include <qt4projectmanager/qt4target.h>
|
2011-05-20 21:40:53 +02:00
|
|
|
#include <qtsupport/baseqtversion.h>
|
2011-08-01 16:44:59 +02:00
|
|
|
#include <remotelinux/deploymentinfo.h>
|
|
|
|
|
#include <remotelinux/remotelinuxdeployconfiguration.h>
|
2011-03-09 12:07:35 +01:00
|
|
|
|
2011-08-01 16:44:59 +02:00
|
|
|
#include <QtCore/QDir>
|
|
|
|
|
#include <QtCore/QFileInfo>
|
2011-03-09 12:07:35 +01:00
|
|
|
#include <QtCore/QLatin1Char>
|
|
|
|
|
#include <QtCore/QProcess>
|
2011-04-20 10:22:45 +02:00
|
|
|
#include <QtCore/QWeakPointer>
|
2011-03-09 12:07:35 +01:00
|
|
|
|
|
|
|
|
using namespace ProjectExplorer;
|
2011-05-25 11:23:25 +02:00
|
|
|
using namespace Qt4ProjectManager;
|
2011-09-20 12:16:36 +02:00
|
|
|
using namespace RemoteLinux;
|
2011-03-09 12:07:35 +01:00
|
|
|
|
2011-09-20 12:16:36 +02:00
|
|
|
namespace Madde {
|
2011-03-09 12:07:35 +01:00
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class AbstractMaemoInstallPackageToSysrootWidget : public BuildStepConfigWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
AbstractMaemoInstallPackageToSysrootWidget(AbstractMaemoInstallPackageToSysrootStep *step)
|
2011-05-30 13:30:10 +02:00
|
|
|
: m_step(step)
|
2011-03-09 12:07:35 +01:00
|
|
|
{
|
2011-04-07 15:45:26 +02:00
|
|
|
BuildStepList * const list
|
|
|
|
|
= qobject_cast<BuildStepList *>(m_step->parent());
|
2011-03-09 12:07:35 +01:00
|
|
|
connect(list, SIGNAL(stepInserted(int)), SIGNAL(updateSummary()));
|
|
|
|
|
connect(list, SIGNAL(stepMoved(int,int)), SIGNAL(updateSummary()));
|
2011-04-07 15:45:26 +02:00
|
|
|
connect(list, SIGNAL(aboutToRemoveStep(int)), SLOT(handleStepToBeRemoved(int)));
|
2011-03-09 12:07:35 +01:00
|
|
|
connect(list, SIGNAL(stepRemoved(int)), SIGNAL(updateSummary()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual QString summaryText() const
|
|
|
|
|
{
|
2011-07-25 11:55:00 +02:00
|
|
|
if (!m_step->deployConfiguration()->earlierBuildStep<AbstractMaemoPackageCreationStep>(m_step)) {
|
2011-03-09 12:07:35 +01:00
|
|
|
return QLatin1String("<font color=\"red\">")
|
|
|
|
|
+ tr("Cannot deploy to sysroot: No packaging step found.")
|
|
|
|
|
+ QLatin1String("</font>");
|
|
|
|
|
}
|
|
|
|
|
return QLatin1String("<b>") + displayName() + QLatin1String("</b>");
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-09 13:22:57 +01:00
|
|
|
virtual bool showWidget() const { return false; }
|
|
|
|
|
|
2011-03-09 12:07:35 +01:00
|
|
|
private:
|
2011-04-07 15:45:26 +02:00
|
|
|
Q_SLOT void handleStepToBeRemoved(int step)
|
|
|
|
|
{
|
|
|
|
|
BuildStepList * const list
|
|
|
|
|
= qobject_cast<BuildStepList *>(m_step->parent());
|
|
|
|
|
if (list->steps().at(step) == m_step)
|
|
|
|
|
disconnect(list, 0, this, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-09 12:07:35 +01:00
|
|
|
const AbstractMaemoInstallPackageToSysrootStep * const m_step;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MaemoInstallDebianPackageToSysrootWidget : public AbstractMaemoInstallPackageToSysrootWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
MaemoInstallDebianPackageToSysrootWidget(AbstractMaemoInstallPackageToSysrootStep *step)
|
|
|
|
|
: AbstractMaemoInstallPackageToSysrootWidget(step) {}
|
|
|
|
|
|
2011-06-14 12:22:14 +02:00
|
|
|
virtual QString displayName() const { return MaemoInstallDebianPackageToSysrootStep::displayName(); }
|
2011-03-09 12:07:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class MaemoInstallRpmPackageToSysrootWidget : public AbstractMaemoInstallPackageToSysrootWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
MaemoInstallRpmPackageToSysrootWidget(AbstractMaemoInstallPackageToSysrootStep *step)
|
|
|
|
|
: AbstractMaemoInstallPackageToSysrootWidget(step) {}
|
|
|
|
|
|
2011-06-14 12:22:14 +02:00
|
|
|
virtual QString displayName() const { return MaemoInstallRpmPackageToSysrootStep::displayName(); }
|
2011-03-09 12:07:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class MaemoCopyFilesToSysrootWidget : public BuildStepConfigWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2011-04-20 10:22:45 +02:00
|
|
|
MaemoCopyFilesToSysrootWidget(const BuildStep *buildStep)
|
2011-05-30 13:30:10 +02:00
|
|
|
: m_buildStep(buildStep)
|
2011-04-20 10:22:45 +02:00
|
|
|
{
|
|
|
|
|
if (m_buildStep) {
|
|
|
|
|
connect(m_buildStep.data(), SIGNAL(displayNameChanged()),
|
|
|
|
|
SIGNAL(updateSummary()));
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-03-09 12:07:35 +01:00
|
|
|
virtual QString summaryText() const {
|
|
|
|
|
return QLatin1String("<b>") + displayName() + QLatin1String("</b>"); }
|
2011-04-20 10:22:45 +02:00
|
|
|
virtual QString displayName() const {
|
|
|
|
|
return m_buildStep ? m_buildStep.data()->displayName() : QString();
|
|
|
|
|
}
|
2011-12-09 13:22:57 +01:00
|
|
|
virtual bool showWidget() const { return false; }
|
2011-04-20 10:22:45 +02:00
|
|
|
private:
|
|
|
|
|
const QWeakPointer<const BuildStep> m_buildStep;
|
2011-03-09 12:07:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AbstractMaemoInstallPackageToSysrootStep::AbstractMaemoInstallPackageToSysrootStep(BuildStepList *bsl,
|
|
|
|
|
const QString &id)
|
|
|
|
|
: BuildStep(bsl, id)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AbstractMaemoInstallPackageToSysrootStep::AbstractMaemoInstallPackageToSysrootStep(BuildStepList *bsl,
|
|
|
|
|
AbstractMaemoInstallPackageToSysrootStep *other)
|
|
|
|
|
: BuildStep(bsl, other)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-25 11:55:00 +02:00
|
|
|
RemoteLinuxDeployConfiguration *AbstractMaemoInstallPackageToSysrootStep::deployConfiguration() const
|
|
|
|
|
{
|
|
|
|
|
return qobject_cast<RemoteLinuxDeployConfiguration *>(BuildStep::deployConfiguration());
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-22 15:30:57 +02:00
|
|
|
bool AbstractMaemoInstallPackageToSysrootStep::init()
|
2011-03-09 12:07:35 +01:00
|
|
|
{
|
|
|
|
|
const Qt4BuildConfiguration * const bc
|
2011-08-18 16:46:44 +02:00
|
|
|
= qobject_cast<Qt4BaseTarget *>(target())->activeQt4BuildConfiguration();
|
2011-03-09 12:07:35 +01:00
|
|
|
if (!bc) {
|
2011-06-14 17:17:24 +02:00
|
|
|
addOutput(tr("Cannot install to sysroot without build configuration."),
|
2011-03-09 12:07:35 +01:00
|
|
|
ErrorMessageOutput);
|
2011-09-22 15:30:57 +02:00
|
|
|
return false;
|
2011-03-09 12:07:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const AbstractMaemoPackageCreationStep * const pStep
|
2011-07-25 11:55:00 +02:00
|
|
|
= deployConfiguration()->earlierBuildStep<AbstractMaemoPackageCreationStep>(this);
|
2011-03-09 12:07:35 +01:00
|
|
|
if (!pStep) {
|
2011-06-14 17:17:24 +02:00
|
|
|
addOutput(tr("Cannot install package to sysroot without packaging step."),
|
2011-03-09 12:07:35 +01:00
|
|
|
ErrorMessageOutput);
|
2011-09-22 15:30:57 +02:00
|
|
|
return false;
|
2011-03-09 12:07:35 +01:00
|
|
|
}
|
|
|
|
|
|
2011-05-04 13:14:46 +02:00
|
|
|
if (!bc->qtVersion()) {
|
2011-06-14 17:17:24 +02:00
|
|
|
addOutput(tr("Cannot install package to sysroot without a Qt version."),
|
2011-05-04 13:14:46 +02:00
|
|
|
ErrorMessageOutput);
|
2011-09-22 15:30:57 +02:00
|
|
|
return false;
|
2011-05-04 13:14:46 +02:00
|
|
|
}
|
|
|
|
|
|
2011-11-25 13:19:58 +01:00
|
|
|
m_qmakeCommand = bc->qtVersion()->qmakeCommand().toString();
|
2011-09-22 15:30:57 +02:00
|
|
|
m_packageFilePath = pStep->packageFilePath();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AbstractMaemoInstallPackageToSysrootStep::run(QFutureInterface<bool> &fi)
|
|
|
|
|
{
|
2011-03-09 12:07:35 +01:00
|
|
|
m_installerProcess = new QProcess;
|
|
|
|
|
connect(m_installerProcess, SIGNAL(readyReadStandardOutput()),
|
|
|
|
|
SLOT(handleInstallerStdout()));
|
|
|
|
|
connect(m_installerProcess, SIGNAL(readyReadStandardError()),
|
|
|
|
|
SLOT(handleInstallerStderr()));
|
|
|
|
|
|
|
|
|
|
emit addOutput(tr("Installing package to sysroot ..."), MessageOutput);
|
2011-09-22 15:30:57 +02:00
|
|
|
const int packageFileSize = QFileInfo(m_packageFilePath).size() / (1024*1024);
|
|
|
|
|
const QStringList args = madArguments() << m_packageFilePath;
|
|
|
|
|
MaemoGlobal::callMadAdmin(*m_installerProcess, args, m_qmakeCommand, true);
|
2011-03-09 12:07:35 +01:00
|
|
|
if (!m_installerProcess->waitForFinished((2*packageFileSize + 10)*1000)
|
|
|
|
|
|| m_installerProcess->exitStatus() != QProcess::NormalExit
|
|
|
|
|
|| m_installerProcess->exitCode() != 0) {
|
|
|
|
|
emit addOutput(tr("Installation to sysroot failed, continuing anyway."),
|
|
|
|
|
ErrorMessageOutput);
|
|
|
|
|
if (m_installerProcess->state() != QProcess::NotRunning) {
|
|
|
|
|
m_installerProcess->terminate();
|
|
|
|
|
m_installerProcess->waitForFinished();
|
|
|
|
|
m_installerProcess->kill();
|
|
|
|
|
}
|
|
|
|
|
fi.reportResult(true);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fi.reportResult(true);
|
|
|
|
|
m_installerProcess->deleteLater();
|
|
|
|
|
m_installerProcess = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AbstractMaemoInstallPackageToSysrootStep::handleInstallerStdout()
|
|
|
|
|
{
|
|
|
|
|
if (m_installerProcess)
|
|
|
|
|
emit addOutput(QString::fromLocal8Bit(m_installerProcess->readAllStandardOutput()), NormalOutput);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AbstractMaemoInstallPackageToSysrootStep::handleInstallerStderr()
|
|
|
|
|
{
|
|
|
|
|
if (m_installerProcess)
|
|
|
|
|
emit addOutput(QString::fromLocal8Bit(m_installerProcess->readAllStandardError()), ErrorOutput);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MaemoInstallDebianPackageToSysrootStep::MaemoInstallDebianPackageToSysrootStep(BuildStepList *bsl)
|
|
|
|
|
: AbstractMaemoInstallPackageToSysrootStep(bsl, Id)
|
|
|
|
|
{
|
2011-06-14 12:22:14 +02:00
|
|
|
setDisplayName(displayName());
|
2011-03-09 12:07:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MaemoInstallDebianPackageToSysrootStep::MaemoInstallDebianPackageToSysrootStep(BuildStepList *bsl,
|
|
|
|
|
MaemoInstallDebianPackageToSysrootStep *other)
|
|
|
|
|
: AbstractMaemoInstallPackageToSysrootStep(bsl, other)
|
|
|
|
|
{
|
2011-06-14 12:22:14 +02:00
|
|
|
setDisplayName(displayName());
|
2011-03-09 12:07:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildStepConfigWidget *MaemoInstallDebianPackageToSysrootStep::createConfigWidget()
|
|
|
|
|
{
|
|
|
|
|
return new MaemoInstallDebianPackageToSysrootWidget(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList MaemoInstallDebianPackageToSysrootStep::madArguments() const
|
|
|
|
|
{
|
2011-10-24 17:29:58 +02:00
|
|
|
QStringList args;
|
|
|
|
|
args << QLatin1String("xdpkg");
|
|
|
|
|
if (qobject_cast<Qt4HarmattanTarget *>(target()))
|
|
|
|
|
args << QLatin1String("--no-force-downgrade");
|
|
|
|
|
args << QLatin1String("-i");
|
|
|
|
|
return args;
|
2011-03-09 12:07:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QString MaemoInstallDebianPackageToSysrootStep::Id
|
|
|
|
|
= QLatin1String("MaemoInstallDebianPackageToSysrootStep");
|
2011-06-14 12:22:14 +02:00
|
|
|
|
|
|
|
|
QString MaemoInstallDebianPackageToSysrootStep::displayName()
|
|
|
|
|
{
|
|
|
|
|
return tr("Install Debian package to sysroot");
|
|
|
|
|
}
|
2011-03-09 12:07:35 +01:00
|
|
|
|
|
|
|
|
MaemoInstallRpmPackageToSysrootStep::MaemoInstallRpmPackageToSysrootStep(BuildStepList *bsl)
|
|
|
|
|
: AbstractMaemoInstallPackageToSysrootStep(bsl, Id)
|
|
|
|
|
{
|
2011-06-14 12:22:14 +02:00
|
|
|
setDisplayName(displayName());
|
2011-03-09 12:07:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MaemoInstallRpmPackageToSysrootStep::MaemoInstallRpmPackageToSysrootStep(BuildStepList *bsl,
|
|
|
|
|
MaemoInstallRpmPackageToSysrootStep *other)
|
|
|
|
|
: AbstractMaemoInstallPackageToSysrootStep(bsl, other)
|
|
|
|
|
{
|
2011-06-14 12:22:14 +02:00
|
|
|
setDisplayName(displayName());
|
2011-03-09 12:07:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildStepConfigWidget *MaemoInstallRpmPackageToSysrootStep::createConfigWidget()
|
|
|
|
|
{
|
|
|
|
|
return new MaemoInstallRpmPackageToSysrootWidget(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QStringList MaemoInstallRpmPackageToSysrootStep::madArguments() const
|
|
|
|
|
{
|
|
|
|
|
return QStringList() << QLatin1String("xrpm") << QLatin1String("-i");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QString MaemoInstallRpmPackageToSysrootStep::Id
|
|
|
|
|
= QLatin1String("MaemoInstallRpmPackageToSysrootStep");
|
|
|
|
|
|
2011-06-14 12:22:14 +02:00
|
|
|
QString MaemoInstallRpmPackageToSysrootStep::displayName()
|
|
|
|
|
{
|
|
|
|
|
return tr("Install RPM package to sysroot");
|
|
|
|
|
}
|
2011-03-09 12:07:35 +01:00
|
|
|
|
|
|
|
|
MaemoCopyToSysrootStep::MaemoCopyToSysrootStep(BuildStepList *bsl)
|
|
|
|
|
: BuildStep(bsl, Id)
|
|
|
|
|
{
|
2011-06-14 12:22:14 +02:00
|
|
|
setDisplayName(displayName());
|
2011-03-09 12:07:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MaemoCopyToSysrootStep::MaemoCopyToSysrootStep(BuildStepList *bsl,
|
|
|
|
|
MaemoCopyToSysrootStep *other)
|
|
|
|
|
: BuildStep(bsl, other)
|
|
|
|
|
{
|
2011-06-14 12:22:14 +02:00
|
|
|
setDisplayName(displayName());
|
2011-03-09 12:07:35 +01:00
|
|
|
}
|
|
|
|
|
|
2011-09-22 15:30:57 +02:00
|
|
|
bool MaemoCopyToSysrootStep::init()
|
2011-03-09 12:07:35 +01:00
|
|
|
{
|
|
|
|
|
const Qt4BuildConfiguration * const bc
|
2011-08-18 16:46:44 +02:00
|
|
|
= qobject_cast<Qt4BaseTarget *>(target())->activeQt4BuildConfiguration();
|
2011-03-09 12:07:35 +01:00
|
|
|
if (!bc) {
|
2011-06-14 17:17:24 +02:00
|
|
|
addOutput(tr("Cannot copy to sysroot without build configuration."),
|
2011-03-09 12:07:35 +01:00
|
|
|
ErrorMessageOutput);
|
2011-09-22 15:30:57 +02:00
|
|
|
return false;
|
2011-03-09 12:07:35 +01:00
|
|
|
}
|
|
|
|
|
|
2011-06-08 15:35:43 +02:00
|
|
|
const MaemoQtVersion * const qtVersion = dynamic_cast<MaemoQtVersion *>(bc->qtVersion());
|
|
|
|
|
if (!qtVersion) {
|
2011-06-14 17:17:24 +02:00
|
|
|
addOutput(tr("Cannot copy to sysroot without valid Qt version."),
|
2011-03-09 12:07:35 +01:00
|
|
|
ErrorMessageOutput);
|
2011-09-22 15:30:57 +02:00
|
|
|
return false;
|
2011-03-09 12:07:35 +01:00
|
|
|
}
|
2011-09-22 15:30:57 +02:00
|
|
|
m_systemRoot = qtVersion->systemRoot();
|
2011-10-13 18:51:15 +02:00
|
|
|
|
2012-02-07 14:13:56 +01:00
|
|
|
const DeploymentInfo * const deploymentInfo
|
2011-10-13 18:51:15 +02:00
|
|
|
= static_cast<RemoteLinuxDeployConfiguration *>(deployConfiguration())->deploymentInfo();
|
|
|
|
|
m_files.clear();
|
|
|
|
|
for (int i = 0; i < deploymentInfo->deployableCount(); ++i)
|
|
|
|
|
m_files << deploymentInfo->deployableAt(i);
|
|
|
|
|
|
2011-09-22 15:30:57 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
2011-03-09 12:07:35 +01:00
|
|
|
|
2011-09-22 15:30:57 +02:00
|
|
|
void MaemoCopyToSysrootStep::run(QFutureInterface<bool> &fi)
|
|
|
|
|
{
|
2011-03-09 12:07:35 +01:00
|
|
|
emit addOutput(tr("Copying files to sysroot ..."), MessageOutput);
|
2011-09-22 15:30:57 +02:00
|
|
|
QDir sysrootDir(m_systemRoot);
|
2011-10-13 18:51:15 +02:00
|
|
|
|
2011-03-09 12:07:35 +01:00
|
|
|
const QChar sep = QLatin1Char('/');
|
2011-10-13 18:51:15 +02:00
|
|
|
foreach (const DeployableFile &deployable, m_files) {
|
2011-03-09 12:07:35 +01:00
|
|
|
const QFileInfo localFileInfo(deployable.localFilePath);
|
2011-09-22 15:30:57 +02:00
|
|
|
const QString targetFilePath = m_systemRoot + sep
|
2011-03-09 12:07:35 +01:00
|
|
|
+ deployable.remoteDir + sep + localFileInfo.fileName();
|
2011-05-30 12:56:26 +02:00
|
|
|
sysrootDir.mkpath(deployable.remoteDir.mid(1));
|
2011-04-21 11:10:47 +02:00
|
|
|
QString errorMsg;
|
2011-07-05 12:59:14 +02:00
|
|
|
Utils::FileUtils::removeRecursively(targetFilePath, &errorMsg);
|
|
|
|
|
if (!Utils::FileUtils::copyRecursively(deployable.localFilePath,
|
2011-04-21 11:10:47 +02:00
|
|
|
targetFilePath, &errorMsg)) {
|
2011-04-29 09:53:34 +02:00
|
|
|
emit addOutput(tr("Sysroot installation failed: %1\n"
|
2011-04-21 11:10:47 +02:00
|
|
|
" Continuing anyway.").arg(errorMsg), ErrorMessageOutput);
|
2011-03-09 12:07:35 +01:00
|
|
|
}
|
|
|
|
|
if (fi.isCanceled()) {
|
|
|
|
|
fi.reportResult(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fi.reportResult(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildStepConfigWidget *MaemoCopyToSysrootStep::createConfigWidget()
|
|
|
|
|
{
|
2011-04-20 10:22:45 +02:00
|
|
|
return new MaemoCopyFilesToSysrootWidget(this);
|
2011-03-09 12:07:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QString MaemoCopyToSysrootStep::Id
|
|
|
|
|
= QLatin1String("MaemoCopyToSysrootStep");
|
2011-06-14 12:22:14 +02:00
|
|
|
QString MaemoCopyToSysrootStep::displayName()
|
|
|
|
|
{
|
|
|
|
|
return tr("Copy files to sysroot");
|
|
|
|
|
}
|
2011-04-20 09:41:09 +02:00
|
|
|
|
|
|
|
|
MaemoMakeInstallToSysrootStep::MaemoMakeInstallToSysrootStep(BuildStepList *bsl)
|
|
|
|
|
: AbstractProcessStep(bsl, Id)
|
|
|
|
|
{
|
2011-06-14 12:22:14 +02:00
|
|
|
setDefaultDisplayName(displayName());
|
2011-04-20 09:41:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MaemoMakeInstallToSysrootStep::MaemoMakeInstallToSysrootStep(BuildStepList *bsl,
|
|
|
|
|
MaemoMakeInstallToSysrootStep *other)
|
|
|
|
|
: AbstractProcessStep(bsl, other)
|
|
|
|
|
{
|
2011-06-14 12:22:14 +02:00
|
|
|
setDefaultDisplayName(displayName());
|
2011-04-20 09:41:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MaemoMakeInstallToSysrootStep::init()
|
|
|
|
|
{
|
|
|
|
|
const Qt4BuildConfiguration * const bc
|
|
|
|
|
= qobject_cast<Qt4BuildConfiguration *>(target()->activeBuildConfiguration());
|
|
|
|
|
if (!bc) {
|
2011-06-14 17:17:24 +02:00
|
|
|
addOutput("Cannot deploy: No active build dconfiguration.",
|
2011-04-20 09:41:09 +02:00
|
|
|
ErrorMessageOutput);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2011-05-20 21:40:53 +02:00
|
|
|
const QtSupport::BaseQtVersion * const qtVersion = bc->qtVersion();
|
2011-04-20 09:41:09 +02:00
|
|
|
if (!qtVersion) {
|
2011-06-14 17:17:24 +02:00
|
|
|
addOutput("Cannot deploy: Unusable build configuration.",
|
2011-04-20 09:41:09 +02:00
|
|
|
ErrorMessageOutput);
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
}
|
2011-06-08 11:07:00 +02:00
|
|
|
Utils::Environment env = bc->environment();
|
2011-11-25 13:19:58 +01:00
|
|
|
MaemoGlobal::addMaddeEnvironment(env, qtVersion->qmakeCommand().toString());
|
|
|
|
|
QString command = MaemoGlobal::madCommand(qtVersion->qmakeCommand().toString());
|
2011-06-08 11:07:00 +02:00
|
|
|
QStringList args = QStringList() << QLatin1String("-t")
|
2011-11-25 13:19:58 +01:00
|
|
|
<< MaemoGlobal::targetName(qtVersion->qmakeCommand().toString()) << QLatin1String("make")
|
2011-06-08 11:07:00 +02:00
|
|
|
<< QLatin1String("install") << (QLatin1String("INSTALL_ROOT=") + qtVersion->systemRoot());
|
2011-11-25 13:19:58 +01:00
|
|
|
MaemoGlobal::transformMaddeCall(command, args, qtVersion->qmakeCommand().toString());
|
2011-06-08 11:07:00 +02:00
|
|
|
processParameters()->setCommand(command);
|
2011-04-20 09:41:09 +02:00
|
|
|
processParameters()->setArguments(args.join(QLatin1String(" ")));
|
2011-06-08 11:07:00 +02:00
|
|
|
processParameters()->setEnvironment(env);
|
2011-04-20 09:41:09 +02:00
|
|
|
processParameters()->setWorkingDirectory(bc->buildDirectory());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuildStepConfigWidget *MaemoMakeInstallToSysrootStep::createConfigWidget()
|
|
|
|
|
{
|
2011-04-20 10:22:45 +02:00
|
|
|
return new MaemoCopyFilesToSysrootWidget(this);
|
2011-04-20 09:41:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QString MaemoMakeInstallToSysrootStep::Id
|
|
|
|
|
= QLatin1String("MaemoMakeInstallToSysrootStep");
|
2011-06-14 12:22:14 +02:00
|
|
|
QString MaemoMakeInstallToSysrootStep::displayName()
|
|
|
|
|
{
|
|
|
|
|
return tr("Copy files to sysroot");
|
|
|
|
|
}
|
2011-04-20 09:41:09 +02:00
|
|
|
|
2011-03-09 12:07:35 +01:00
|
|
|
} // namespace Internal
|
2011-09-20 12:16:36 +02:00
|
|
|
} // namespace Madde
|
2011-03-09 12:07:35 +01:00
|
|
|
|
|
|
|
|
#include "maemoinstalltosysrootstep.moc"
|