forked from qt-creator/qt-creator
Maemo: Remove redundant code for adding "-t <target>" to mad command.
This commit is contained in:
@@ -613,10 +613,9 @@ void MaemoDeployStep::installToSysroot()
|
|||||||
const Qt4BuildConfiguration * const bc
|
const Qt4BuildConfiguration * const bc
|
||||||
= static_cast<Qt4BuildConfiguration *>(buildConfiguration());
|
= static_cast<Qt4BuildConfiguration *>(buildConfiguration());
|
||||||
const QtVersion * const qtVersion = bc->qtVersion();
|
const QtVersion * const qtVersion = bc->qtVersion();
|
||||||
const QStringList args = QStringList() << QLatin1String("-t")
|
const QStringList args = QStringList() << QLatin1String("xdpkg")
|
||||||
<< MaemoGlobal::targetName(qtVersion) << QLatin1String("xdpkg")
|
|
||||||
<< QLatin1String("-i") << packagingStep()->packageFilePath();
|
<< QLatin1String("-i") << packagingStep()->packageFilePath();
|
||||||
MaemoGlobal::callMadAdmin(*m_sysrootInstaller, args, qtVersion);
|
MaemoGlobal::callMadAdmin(*m_sysrootInstaller, args, qtVersion, true);
|
||||||
if (!m_sysrootInstaller->waitForStarted()) {
|
if (!m_sysrootInstaller->waitForStarted()) {
|
||||||
writeOutput(tr("Installation to sysroot failed, continuing anyway."),
|
writeOutput(tr("Installation to sysroot failed, continuing anyway."),
|
||||||
ErrorMessageOutput);
|
ErrorMessageOutput);
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ bool MaemoGlobal::isValidMaemoQtVersion(const QtVersion *qtVersion,
|
|||||||
return false;
|
return false;
|
||||||
QProcess madAdminProc;
|
QProcess madAdminProc;
|
||||||
const QStringList arguments(QLatin1String("list"));
|
const QStringList arguments(QLatin1String("list"));
|
||||||
if (!callMadAdmin(madAdminProc, arguments, qtVersion))
|
if (!callMadAdmin(madAdminProc, arguments, qtVersion, false))
|
||||||
return false;
|
return false;
|
||||||
if (!madAdminProc.waitForStarted() || !madAdminProc.waitForFinished())
|
if (!madAdminProc.waitForStarted() || !madAdminProc.waitForFinished())
|
||||||
return false;
|
return false;
|
||||||
@@ -202,10 +202,9 @@ MaemoGlobal::MaemoVersion MaemoGlobal::version(const QtVersion *qtVersion)
|
|||||||
QString MaemoGlobal::architecture(const QtVersion *qtVersion)
|
QString MaemoGlobal::architecture(const QtVersion *qtVersion)
|
||||||
{
|
{
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
const QStringList args = QStringList() << QLatin1String("-t")
|
const QStringList args = QStringList() << QLatin1String("uname")
|
||||||
<< targetName(qtVersion) << QLatin1String("uname")
|
|
||||||
<< QLatin1String("-m");
|
<< QLatin1String("-m");
|
||||||
if (!callMad(proc, args, qtVersion))
|
if (!callMad(proc, args, qtVersion, true))
|
||||||
return QString();
|
return QString();
|
||||||
if (!proc.waitForFinished())
|
if (!proc.waitForFinished())
|
||||||
return QString();
|
return QString();
|
||||||
@@ -246,41 +245,50 @@ bool MaemoGlobal::removeRecursively(const QString &filePath, QString &error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool MaemoGlobal::callMad(QProcess &proc, const QStringList &args,
|
bool MaemoGlobal::callMad(QProcess &proc, const QStringList &args,
|
||||||
const QtVersion *qtVersion)
|
const QtVersion *qtVersion, bool useTarget)
|
||||||
{
|
{
|
||||||
return callMaddeShellScript(proc, maddeRoot(qtVersion),
|
return callMaddeShellScript(proc, qtVersion, madCommand(qtVersion), args,
|
||||||
madCommand(qtVersion), args);
|
useTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MaemoGlobal::callMadAdmin(QProcess &proc, const QStringList &args,
|
bool MaemoGlobal::callMadAdmin(QProcess &proc, const QStringList &args,
|
||||||
const QtVersion *qtVersion)
|
const QtVersion *qtVersion, bool useTarget)
|
||||||
{
|
{
|
||||||
return callMaddeShellScript(proc, maddeRoot(qtVersion),
|
return callMaddeShellScript(proc, qtVersion, madAdminCommand(qtVersion),
|
||||||
madAdminCommand(qtVersion), args);
|
args, useTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MaemoGlobal::callMaddeShellScript(QProcess &proc, const QString &maddeRoot,
|
bool MaemoGlobal::callMaddeShellScript(QProcess &proc,
|
||||||
const QString &command, const QStringList &args)
|
const QtVersion *qtVersion, const QString &command, const QStringList &args,
|
||||||
|
bool useTarget)
|
||||||
{
|
{
|
||||||
if (!QFileInfo(command).exists())
|
if (!QFileInfo(command).exists())
|
||||||
return false;
|
return false;
|
||||||
QString actualCommand = command;
|
QString actualCommand = command;
|
||||||
QStringList actualArgs = args;
|
QStringList actualArgs = targetArgs(qtVersion, useTarget) + args;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
Utils::Environment env(proc.systemEnvironment());
|
Utils::Environment env(proc.systemEnvironment());
|
||||||
env.prependOrSetPath(maddeRoot + QLatin1String("/bin"));
|
const QString root = maddeRoot(qtVersion);
|
||||||
|
env.prependOrSetPath(root + QLatin1String("/bin"));
|
||||||
env.prependOrSet(QLatin1String("HOME"),
|
env.prependOrSet(QLatin1String("HOME"),
|
||||||
QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
|
QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
|
||||||
proc.setEnvironment(env.toStringList());
|
proc.setEnvironment(env.toStringList());
|
||||||
actualArgs.prepend(command);
|
actualArgs.prepend(command);
|
||||||
actualCommand = maddeRoot + QLatin1String("/bin/sh.exe");
|
actualCommand = root + QLatin1String("/bin/sh.exe");
|
||||||
#else
|
|
||||||
Q_UNUSED(maddeRoot);
|
|
||||||
#endif
|
#endif
|
||||||
proc.start(actualCommand, actualArgs);
|
proc.start(actualCommand, actualArgs);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList MaemoGlobal::targetArgs(const QtVersion *qtVersion, bool useTarget)
|
||||||
|
{
|
||||||
|
QStringList args;
|
||||||
|
if (useTarget) {
|
||||||
|
args << QLatin1String("-t") << targetName(qtVersion);
|
||||||
|
}
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
MaemoGlobal::FileUpdate::FileUpdate(const QString &fileName)
|
MaemoGlobal::FileUpdate::FileUpdate(const QString &fileName)
|
||||||
: m_fileName(fileName)
|
: m_fileName(fileName)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,11 +92,10 @@ public:
|
|||||||
static MaemoVersion version(const QtVersion *qtVersion);
|
static MaemoVersion version(const QtVersion *qtVersion);
|
||||||
static QString architecture(const QtVersion *version);
|
static QString architecture(const QtVersion *version);
|
||||||
|
|
||||||
// TODO: Provide version that inserts "-t <target>" itself.
|
|
||||||
static bool callMad(QProcess &proc, const QStringList &args,
|
static bool callMad(QProcess &proc, const QStringList &args,
|
||||||
const QtVersion *qtVersion);
|
const QtVersion *qtVersion, bool useTarget);
|
||||||
static bool callMadAdmin(QProcess &proc, const QStringList &args,
|
static bool callMadAdmin(QProcess &proc, const QStringList &args,
|
||||||
const QtVersion *qtVersion);
|
const QtVersion *qtVersion, bool useTarget);
|
||||||
|
|
||||||
static bool removeRecursively(const QString &filePath, QString &error);
|
static bool removeRecursively(const QString &filePath, QString &error);
|
||||||
|
|
||||||
@@ -134,8 +133,9 @@ private:
|
|||||||
static bool isValidMaemoQtVersion(const Qt4ProjectManager::QtVersion *qtVersion,
|
static bool isValidMaemoQtVersion(const Qt4ProjectManager::QtVersion *qtVersion,
|
||||||
MaemoVersion maemoVersion);
|
MaemoVersion maemoVersion);
|
||||||
static QString madAdminCommand(const QtVersion *qtVersion);
|
static QString madAdminCommand(const QtVersion *qtVersion);
|
||||||
static bool callMaddeShellScript(QProcess &proc, const QString &maddeRoot,
|
static bool callMaddeShellScript(QProcess &proc, const QtVersion *qtVersion,
|
||||||
const QString &command, const QStringList &args);
|
const QString &command, const QStringList &args, bool useTarget);
|
||||||
|
static QStringList targetArgs(const QtVersion *qtVersion, bool useTarget);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -173,8 +173,7 @@ bool MaemoPackageCreationStep::createPackage(QProcess *buildProc)
|
|||||||
|
|
||||||
const QtVersion * const qtVersion = qt4BuildConfiguration()->qtVersion();
|
const QtVersion * const qtVersion = qt4BuildConfiguration()->qtVersion();
|
||||||
const QString madCommand = MaemoGlobal::madCommand(qtVersion);
|
const QString madCommand = MaemoGlobal::madCommand(qtVersion);
|
||||||
QStringList args = QStringList() << QLatin1String("-t")
|
QStringList args;
|
||||||
<< MaemoGlobal::targetName(qtVersion);
|
|
||||||
if (debBasedMaemoTarget()) {
|
if (debBasedMaemoTarget()) {
|
||||||
args << QLatin1String("dpkg-buildpackage") << QLatin1String("-nc")
|
args << QLatin1String("dpkg-buildpackage") << QLatin1String("-nc")
|
||||||
<< QLatin1String("-uc") << QLatin1String("-us");
|
<< QLatin1String("-uc") << QLatin1String("-us");
|
||||||
@@ -186,7 +185,7 @@ bool MaemoPackageCreationStep::createPackage(QProcess *buildProc)
|
|||||||
+ args.join(QLatin1String(" "));
|
+ args.join(QLatin1String(" "));
|
||||||
emit addOutput(tr("Package Creation: Running command '%1'.").arg(cmdLine),
|
emit addOutput(tr("Package Creation: Running command '%1'.").arg(cmdLine),
|
||||||
BuildStep::MessageOutput);
|
BuildStep::MessageOutput);
|
||||||
MaemoGlobal::callMad(*buildProc, args, qtVersion);
|
MaemoGlobal::callMad(*buildProc, args, qtVersion, true);
|
||||||
if (!buildProc->waitForStarted()) {
|
if (!buildProc->waitForStarted()) {
|
||||||
raiseError(tr("Packaging failed."),
|
raiseError(tr("Packaging failed."),
|
||||||
tr("Packaging error: Could not start command '%1'. Reason: %2")
|
tr("Packaging error: Could not start command '%1'. Reason: %2")
|
||||||
|
|||||||
@@ -364,11 +364,9 @@ void MaemoPublisherFremantleFree::runDpkgBuildPackage()
|
|||||||
return;
|
return;
|
||||||
setState(BuildingPackage);
|
setState(BuildingPackage);
|
||||||
emit progressReport(tr("Building source package..."));
|
emit progressReport(tr("Building source package..."));
|
||||||
const QStringList args = QStringList() << QLatin1String("-t")
|
const QStringList args = QStringList() << QLatin1String("dpkg-buildpackage")
|
||||||
<< MaemoGlobal::targetName(m_buildConfig->qtVersion())
|
<< QLatin1String("-S") << QLatin1String("-us") << QLatin1String("-uc");
|
||||||
<< QLatin1String("dpkg-buildpackage") << QLatin1String("-S")
|
MaemoGlobal::callMad(*m_process, args, m_buildConfig->qtVersion(), true);
|
||||||
<< QLatin1String("-us") << QLatin1String("-uc");
|
|
||||||
MaemoGlobal::callMad(*m_process, args, m_buildConfig->qtVersion());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have to implement the SCP protocol, because the maemo.org
|
// We have to implement the SCP protocol, because the maemo.org
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ MaemoQemuRuntime MaemoQemuRuntimeParser::parseRuntime(const QtVersion *qtVersion
|
|||||||
MaemoQemuRuntime runtime;
|
MaemoQemuRuntime runtime;
|
||||||
const QString maddeRootPath = MaemoGlobal::maddeRoot(qtVersion);
|
const QString maddeRootPath = MaemoGlobal::maddeRoot(qtVersion);
|
||||||
QProcess madProc;
|
QProcess madProc;
|
||||||
if (!MaemoGlobal::callMad(madProc, QStringList() << QLatin1String("info"), qtVersion))
|
if (!MaemoGlobal::callMad(madProc, QStringList() << QLatin1String("info"), qtVersion, false))
|
||||||
return runtime;
|
return runtime;
|
||||||
if (!madProc.waitForStarted() || !madProc.waitForFinished())
|
if (!madProc.waitForStarted() || !madProc.waitForFinished())
|
||||||
return runtime;
|
return runtime;
|
||||||
|
|||||||
Reference in New Issue
Block a user