Commit 1166dc39 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Maemo: Use current build environment for packaging.

(Instead of the initial system environment.)

Reviewed-by: kh1
parent 9235e936
...@@ -54,10 +54,10 @@ ...@@ -54,10 +54,10 @@
#include <qt4buildconfiguration.h> #include <qt4buildconfiguration.h>
#include <qt4project.h> #include <qt4project.h>
#include <qt4target.h> #include <qt4target.h>
#include <utils/environment.h>
#include <QtCore/QDateTime> #include <QtCore/QDateTime>
#include <QtCore/QProcess> #include <QtCore/QProcess>
#include <QtCore/QProcessEnvironment>
#include <QtCore/QRegExp> #include <QtCore/QRegExp>
#include <QtCore/QStringBuilder> #include <QtCore/QStringBuilder>
#include <QtGui/QWidget> #include <QtGui/QWidget>
...@@ -503,27 +503,18 @@ bool MaemoPackageCreationStep::preparePackagingProcess(QProcess *proc, ...@@ -503,27 +503,18 @@ bool MaemoPackageCreationStep::preparePackagingProcess(QProcess *proc,
return false; return false;
} }
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); Utils::Environment env = bc->environment();
const QString &path const QString &path
= QDir::toNativeSeparators(tc->maddeRoot() + QLatin1Char('/')); = QDir::toNativeSeparators(tc->maddeRoot() + QLatin1Char('/'));
const QLatin1String key("PATH");
QString colon = QLatin1String(":");
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
colon = QLatin1String(";"); env.prependOrSetPath(path % QLatin1String("bin"));
env.insert(key, path % QLatin1String("bin") % colon % env.value(key));
#endif #endif
env.prependOrSetPath(tc->targetRoot() % QLatin1String("/bin"));
env.insert(key, tc->targetRoot() % "/bin" % colon % env.value(key)); env.prependOrSetPath(path % QLatin1String("madbin"));
env.insert(key, path % QLatin1String("madbin") % colon % env.value(key));
if (bc->qmakeBuildConfiguration() & QtVersion::DebugBuild) { if (bc->qmakeBuildConfiguration() & QtVersion::DebugBuild) {
const QLatin1String debOptionsKey("DEB_BUILD_OPTIONS"); env.appendOrSet(QLatin1String("DEB_BUILD_OPTIONS"),
QString debOptions = env.value(debOptionsKey); QLatin1String("nostrip"), QLatin1String(" "));
if (!debOptions.isEmpty())
debOptions += QLatin1Char(' ');
debOptions += QLatin1String("nostrip");
env.insert(debOptionsKey, debOptions);
} }
QString perlLib QString perlLib
...@@ -532,18 +523,18 @@ bool MaemoPackageCreationStep::preparePackagingProcess(QProcess *proc, ...@@ -532,18 +523,18 @@ bool MaemoPackageCreationStep::preparePackagingProcess(QProcess *proc,
perlLib = perlLib.remove(QLatin1Char(':')); perlLib = perlLib.remove(QLatin1Char(':'));
perlLib = perlLib.prepend(QLatin1Char('/')); perlLib = perlLib.prepend(QLatin1Char('/'));
#endif #endif
env.insert(QLatin1String("PERL5LIB"), perlLib); env.set(QLatin1String("PERL5LIB"), perlLib);
env.insert(QLatin1String("PWD"), workingDir); env.set(QLatin1String("PWD"), workingDir);
const QRegExp envPattern(QLatin1String("([^=]+)=[\"']?([^;\"']+)[\"']? ;.*")); const QRegExp envPattern(QLatin1String("([^=]+)=[\"']?([^;\"']+)[\"']? ;.*"));
QByteArray line; QByteArray line;
do { do {
line = configFile.readLine(200); line = configFile.readLine(200);
if (envPattern.exactMatch(line)) if (envPattern.exactMatch(line))
env.insert(envPattern.cap(1), envPattern.cap(2)); env.set(envPattern.cap(1), envPattern.cap(2));
} while (!line.isEmpty()); } while (!line.isEmpty());
proc->setProcessEnvironment(env); proc->setEnvironment(env.toStringList());
proc->setWorkingDirectory(workingDir); proc->setWorkingDirectory(workingDir);
proc->start("cd " + workingDir); proc->start("cd " + workingDir);
proc->waitForFinished(); proc->waitForFinished();
......
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