Commit 60cd3d18 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Maemo: Call dpkg-buildpackage via mad script.

Task-number: QTCREATORBUG-2708
Reviewed-by: kh1
parent 1eb2f2bd
......@@ -172,8 +172,34 @@ bool MaemoPackageCreationStep::createPackage(QProcess *buildProc)
if (!copyDebianFiles(inSourceBuild))
return false;
if (!runCommand(buildProc, QLatin1String("dpkg-buildpackage -nc -uc -us")))
const QString maddeRoot = maemoToolChain()->maddeRoot();
const QString madCommand = maddeRoot + QLatin1String("/bin/mad");
const QStringList args = QStringList() << QLatin1String("-t")
<< maemoToolChain()->targetName() << QLatin1String("dpkg-buildpackage")
<< QLatin1String("-nc") << QLatin1String("-uc") << QLatin1String("-us");
const QString cmdLine = madCommand + QLatin1Char(' ')
+ args.join(QLatin1String(" "));
emit addOutput(tr("Package Creation: Running command '%1'.").arg(cmdLine),
BuildStep::MessageOutput);
MaemoGlobal::callMaddeShellScript(*buildProc, maddeRoot, madCommand, args);
if (!buildProc->waitForStarted()) {
raiseError(tr("Packaging failed."),
tr("Packaging error: Could not start command '%1'. Reason: %2")
.arg(cmdLine, buildProc->errorString()));
return false;
}
buildProc->waitForFinished(-1);
if (buildProc->error() != QProcess::UnknownError
|| buildProc->exitCode() != 0) {
QString mainMessage = tr("Packaging Error: Command '%1' failed.")
.arg(cmdLine);
if (buildProc->error() != QProcess::UnknownError)
mainMessage += tr(" Reason: %1").arg(buildProc->errorString());
else
mainMessage += tr("Exit code: %1").arg(buildProc->exitCode());
raiseError(mainMessage);
return false;
}
// Workaround for non-working dh_builddeb --destdir=.
if (!QDir(buildDirectory()).isRoot()) {
......@@ -272,32 +298,6 @@ bool MaemoPackageCreationStep::copyDebianFiles(bool inSourceBuild)
return true;
}
bool MaemoPackageCreationStep::runCommand(QProcess *buildProc,
const QString &command)
{
emit addOutput(tr("Package Creation: Running command '%1'.").arg(command), BuildStep::MessageOutput);
buildProc->start(packagingCommand(maemoToolChain(), command));
if (!buildProc->waitForStarted()) {
raiseError(tr("Packaging failed."),
tr("Packaging error: Could not start command '%1'. Reason: %2")
.arg(command).arg(buildProc->errorString()));
return false;
}
buildProc->waitForFinished(-1);
if (buildProc->error() != QProcess::UnknownError
|| buildProc->exitCode() != 0) {
QString mainMessage = tr("Packaging Error: Command '%1' failed.")
.arg(command);
if (buildProc->error() != QProcess::UnknownError)
mainMessage += tr(" Reason: %1").arg(buildProc->errorString());
else
mainMessage += tr("Exit code: %1").arg(buildProc->exitCode());
raiseError(mainMessage);
return false;
}
return true;
}
void MaemoPackageCreationStep::handleBuildOutput()
{
QProcess * const buildProc = qobject_cast<QProcess *>(sender());
......
......@@ -111,7 +111,6 @@ private:
bool createPackage(QProcess *buildProc);
bool copyDebianFiles(bool inSourceBuild);
bool runCommand(QProcess *buildProc, const QString &command);
QString maddeRoot() const;
QString targetRoot() const;
static QString nativePath(const QFile &file);
......
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