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