summaryrefslogtreecommitdiffstats
path: root/tools/maddehelper/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/maddehelper/main.cpp')
-rw-r--r--tools/maddehelper/main.cpp108
1 files changed, 57 insertions, 51 deletions
diff --git a/tools/maddehelper/main.cpp b/tools/maddehelper/main.cpp
index 1f4ed555b..28e8c8b3c 100644
--- a/tools/maddehelper/main.cpp
+++ b/tools/maddehelper/main.cpp
@@ -9,38 +9,39 @@
//which I used for testing
bool rebaseDlls(const QString &maddeBinLocation,
const QString &rebaseBinaryLocation,
- const QString &adressValue = "0x50000000",
- const QString &dllFilter = "msys*.dll")
+ const QString &adressValue = QLatin1String("0x50000000"),
+ const QString &dllFilter = QLatin1String("msys*.dll"))
{
QStringList dllStringList = QDir(maddeBinLocation).entryList(QStringList(dllFilter), QDir::Files, QDir::Size | QDir::Reversed);
QString dlls;
QString dllsEnd; //of an unknown issue msys-1.0.dll should be the last on my system
foreach (QString dll, dllStringList) {
- dll.prepend(maddeBinLocation + "/");
- if (dll.contains("msys-1")) {
- dllsEnd.append(dll + " ");
+ dll.prepend(maddeBinLocation + QLatin1String("/"));
+ if (dll.contains(QLatin1String("msys-1"))) {
+ dllsEnd.append(dll + QLatin1String(" "));
} else {
- dlls.append(dll + " ");
+ dlls.append(dll + QLatin1String(" "));
}
}
dlls = dlls.append(dllsEnd);
QProcess process;
- process.setEnvironment(QStringList("EMPTY_ENVIRONMENT=true"));
+ process.setEnvironment(QStringList(QLatin1String("EMPTY_ENVIRONMENT=true")));
QProcess::ProcessError initError(process.error());
process.setProcessChannelMode(QProcess::MergedChannels);
- process.setNativeArguments(QString("-b %1 -o 0x10000 -v %2").arg(adressValue, dlls));
+ process.setNativeArguments(QString::fromLatin1("-b %1 -o 0x10000 -v %2").arg(adressValue, dlls));
process.start(rebaseBinaryLocation);
process.waitForFinished();
if (process.exitCode() != 0 ||
initError != process.error() ||
process.exitStatus() == QProcess::CrashExit)
{
- qWarning() << rebaseBinaryLocation + " " + process.nativeArguments();
- qWarning() << QString("\t Adress rebasing failed! Maybe a process(bash.exe, ssh, ...) is using some of the dlls(%1).").arg(dllStringList.join(", "));
+ qWarning() << rebaseBinaryLocation + QString::fromLatin1(" ") + process.nativeArguments();
+ qWarning() << QString::fromLatin1("\t Adress rebasing failed! Maybe a process(bash.exe, ssh, ...) "
+ "is using some of the dlls(%1).").arg(dllStringList.join(QLatin1String(", ")));
qWarning() << "\t Output: \n" << process.readAll();
if (initError != process.error()) {
- qDebug() << QString("\tError(%1): ").arg(process.error()) << process.errorString();
+ qDebug() << QString::fromLatin1("\tError(%1): ").arg(process.error()) << process.errorString();
}
if (process.exitStatus() == QProcess::CrashExit) {
@@ -48,7 +49,7 @@ bool rebaseDlls(const QString &maddeBinLocation,
}
return false;
}
- qWarning() << rebaseBinaryLocation + " " + process.nativeArguments();
+ qWarning() << rebaseBinaryLocation + QString::fromLatin1(" ") + process.nativeArguments();
//qWarning() << "\t Output: \n" << process.readAll();
return true;
}
@@ -64,23 +65,25 @@ bool checkTools(const QString &maddeBinLocation, const QStringList &binaryCheckL
}
bool testedToolState = true;
QProcess process;
- process.setEnvironment(QStringList("EMPTY_ENVIRONMENT=true"));
+ process.setEnvironment(QStringList(QString::fromLatin1("EMPTY_ENVIRONMENT=true")));
QProcess::ProcessError initError(process.error());
process.setProcessChannelMode(QProcess::MergedChannels);
- process.start(processPath, QStringList("--version"));
+ process.start(processPath, QStringList(QString::fromLatin1("--version")));
process.waitForFinished(1000);
- QString processOutput = process.readAll();
+ QString processOutput = QString::fromLocal8Bit(process.readAll());
//check for the unpossible load dll error
- if (processOutput.contains("VirtualAlloc pointer is null") ||
- processOutput.contains("Couldn't reserve space for") ||
- process.exitStatus() == QProcess::CrashExit)
+ if (processOutput.contains(QString::fromLatin1("VirtualAlloc pointer is null"))
+ || processOutput.contains(QString::fromLatin1("Couldn't reserve space for"))
+ || process.exitStatus() == QProcess::CrashExit)
{
- qWarning() << QString("found dll loading problem with(ExitCode: %1): ").arg(QString::number(process.exitCode())) << processPath;
+ qWarning() << QString::fromLatin1("found dll loading problem with(ExitCode: %1): ")
+ .arg(QString::number(process.exitCode())) << processPath;
qWarning() << processOutput;
testedToolState = false;
if (initError != process.error()) {
- qWarning() << QString("\tError(%1): ").arg(process.error()) << process.errorString();
+ qWarning() << QString::fromLatin1("\tError(%1): ").arg(process.error())
+ << process.errorString();
}
if (process.exitStatus() == QProcess::CrashExit) {
@@ -127,7 +130,7 @@ bool removeDirectory( const QString& path )
}
if ( !QDir().rmdir(path))
- return QDir().rename(path, path + "_" + QDateTime::currentDateTime().toString());
+ return QDir().rename(path, path + QString::fromLatin1("_") + QDateTime::currentDateTime().toString());
return true;
}
@@ -138,12 +141,12 @@ bool cleanUpSubDirectories(const QString &maddeLocation, const QStringList &subD
return false;
}
if (!QFileInfo(maddeLocation).exists()) {
- qWarning() << QString("Ups, location '%1' is not existing.").arg(maddeLocation);
+ qWarning() << QString::fromLatin1("Ups, location '%1' is not existing.").arg(maddeLocation);
return false;
}
foreach (const QString &subDirectory, subDirectoryList) {
- bool removed = removeDirectory(maddeLocation + "/" + subDirectory);
+ bool removed = removeDirectory(maddeLocation + QString::fromLatin1("/") + subDirectory);
if (!removed) {
qWarning() << "Can't remove " << subDirectory <<" for a clean up step";
return false;
@@ -165,7 +168,7 @@ bool cleanUpSubDirectories(const QString &maddeLocation, const QStringList &subD
bool runInstall(const QString &postinstallCommand, const QString &checkFileForAnOkInstallation)
{
QProcess process;
- process.setEnvironment(QStringList("EMPTY_ENVIRONMENT=true"));
+ process.setEnvironment(QStringList(QString::fromLatin1("EMPTY_ENVIRONMENT=true")));
QProcess::ProcessError initError(process.error());
process.setProcessChannelMode(QProcess::ForwardedChannels);
process.setNativeArguments(postinstallCommand);
@@ -176,9 +179,10 @@ bool runInstall(const QString &postinstallCommand, const QString &checkFileForAn
initError != process.error() ||
process.exitStatus() == QProcess::CrashExit)
{
- qWarning() << QString("runInstall(ExitCode: %1) went wrong \n'%2'").arg(QString::number(process.exitCode()), postinstallCommand);
+ qWarning() << QString::fromLatin1("runInstall(ExitCode: %1) went wrong \n'%2'")
+ .arg(QString::number(process.exitCode()), postinstallCommand);
if (initError != process.error()) {
- qDebug() << QString("\tError(%1): ").arg(process.error()) << process.errorString();
+ qDebug() << QString::fromLatin1("\tError(%1): ").arg(process.error()) << process.errorString();
}
if (process.exitStatus() == QProcess::CrashExit) {
@@ -219,11 +223,11 @@ int main(int argc, char *argv[])
for ( int i = 1; i < app.arguments().size(); ++i ) {
if ( app.arguments().at( i ) == QLatin1String( "" ) )
continue;
- if (app.arguments().at(i) == "-r") {
+ if (app.arguments().at(i) == QString::fromLatin1("-r")) {
i++;
rebaseBinaryLocation = app.arguments().at(i);
}
- if (app.arguments().at(i) == "-m") {
+ if (app.arguments().at(i) == QString::fromLatin1("-m")) {
i++;
maddeLocation = app.arguments().at(i);
}
@@ -232,24 +236,25 @@ int main(int argc, char *argv[])
qDebug() << "MADDE location is not existing.";
return 4;
}
- if (!QFileInfo(maddeLocation + "/bin").isDir()) {
+ if (!QFileInfo(maddeLocation + QString::fromLatin1("/bin")).isDir()) {
qDebug() << "It seems that the madde location don't have a 'bin'' directory.";
return 5;
}
- QString maddeBinLocation = maddeLocation + "/bin";
+ QString maddeBinLocation = maddeLocation + QString::fromLatin1("/bin");
//from qs
// var envExecutable = installer.value("TargetDir") + "/" + winMaddeSubPath + "/bin/env.exe";
// var postShell = installer.value("TargetDir") + "/" + winMaddeSubPath + "/postinstall/postinstall.sh";
// component.addOperation("Execute", "{0,1}", envExecutable, "-i" , "/bin/sh", "--login", postShell, "--nosleepontrap", "showStandardError");
- QString postinstallShell = maddeLocation + "/postinstall/postinstall.sh";
+ QString postinstallShell = maddeLocation + QString::fromLatin1("/postinstall/postinstall.sh");
//"--nosleepontrap" is not used in our Madde, but later maybe it is there again
- QString postinstallCommand = maddeBinLocation + QString("/env.exe -i /bin/sh --login %1").arg(postinstallShell + " --nosleepontrap");
- QString successFileCheck = maddeLocation + "/madbin/mad.cmd";
- QString directoriesForCleanUpArgument = "sysroots, toolchains, targets, runtimes, wbin";
- directoriesForCleanUpArgument.remove(" ");
- QStringList directoriesForCleanUp(directoriesForCleanUpArgument.split(","));
+ QString postinstallCommand = maddeBinLocation + QString::fromLatin1("/env.exe -i /bin/sh --login %1")
+ .arg(postinstallShell + QString::fromLatin1(" --nosleepontrap"));
+ QString successFileCheck = maddeLocation + QString::fromLatin1("/madbin/mad.cmd");
+ QString directoriesForCleanUpArgument = QString::fromLatin1("sysroots, toolchains, targets, runtimes, wbin");
+ directoriesForCleanUpArgument.remove(QString::fromLatin1(" "));
+ QStringList directoriesForCleanUp(directoriesForCleanUpArgument.split(QString::fromLatin1(",")));
//this was used for testings
//cleanUpSubDirectories(maddeLocation, directoriesForCleanUp, QStringList(successFileCheck));
@@ -260,23 +265,24 @@ int main(int argc, char *argv[])
return 0;
- QString binaryCheckArgument = ("a2p.exe, basename.exe, bash.exe, bzip2.exe, cat.exe, chmod.exe, cmp.exe, comm.exe, cp.exe, cut.exe, " \
- "date.exe, diff.exe, diff3.exe, dirname.exe, du.exe, env.exe, expr.exe, find.exe, fold.exe, gawk.exe, " \
- "grep.exe, gzip.exe, head.exe, id.exe, install.exe, join.exe, less.exe, ln.exe, ls.exe, lzma.exe, m4.exe, " \
- "make.exe, md5sum.exe, mkdir.exe, mv.exe, od.exe, paste.exe, patch.exe, perl.exe, perl5.6.1.exe, ps.exe, " \
- "rm.exe, rmdir.exe, sed.exe, sh.exe, sleep.exe, sort.exe, split.exe, ssh-agent.exe, ssh-keygen.exe, " \
- "stty.exe, tail.exe, tar.exe, tee.exe, touch.exe, tr.exe, true.exe, uname.exe, uniq.exe, vim.exe, wc.exe, xargs.exe");
- binaryCheckArgument.remove(" ");
- QStringList binaryCheckList(binaryCheckArgument.split(","));
+ QString binaryCheckArgument =
+ QString::fromLatin1("a2p.exe, basename.exe, bash.exe, bzip2.exe, cat.exe, chmod.exe, cmp.exe, comm.exe, cp.exe, cut.exe, " \
+ "date.exe, diff.exe, diff3.exe, dirname.exe, du.exe, env.exe, expr.exe, find.exe, fold.exe, gawk.exe, " \
+ "grep.exe, gzip.exe, head.exe, id.exe, install.exe, join.exe, less.exe, ln.exe, ls.exe, lzma.exe, m4.exe, " \
+ "make.exe, md5sum.exe, mkdir.exe, mv.exe, od.exe, paste.exe, patch.exe, perl.exe, perl5.6.1.exe, ps.exe, " \
+ "rm.exe, rmdir.exe, sed.exe, sh.exe, sleep.exe, sort.exe, split.exe, ssh-agent.exe, ssh-keygen.exe, " \
+ "stty.exe, tail.exe, tar.exe, tee.exe, touch.exe, tr.exe, true.exe, uname.exe, uniq.exe, vim.exe, wc.exe, xargs.exe");
+ binaryCheckArgument.remove(QString::fromLatin1(" "));
+ QStringList binaryCheckList(binaryCheckArgument.split(QString::fromLatin1(",")));
QStringList possibleRebaseAdresses;
- possibleRebaseAdresses << "0x5200000"; //this uses perl
- possibleRebaseAdresses << "0x30000000";
- possibleRebaseAdresses << "0x35000000";
- possibleRebaseAdresses << "0x40000000";
- possibleRebaseAdresses << "0x60000000";
- possibleRebaseAdresses << "0x60800000";
- possibleRebaseAdresses << "0x68000000"; //this uses git
+ possibleRebaseAdresses << QString::fromLatin1("0x5200000"); //this uses perl
+ possibleRebaseAdresses << QString::fromLatin1("0x30000000");
+ possibleRebaseAdresses << QString::fromLatin1("0x35000000");
+ possibleRebaseAdresses << QString::fromLatin1("0x40000000");
+ possibleRebaseAdresses << QString::fromLatin1("0x60000000");
+ possibleRebaseAdresses << QString::fromLatin1("0x60800000");
+ possibleRebaseAdresses << QString::fromLatin1("0x68000000"); //this uses git
foreach (const QString &newAdress, possibleRebaseAdresses) {
bool rebased = rebaseDlls(maddeBinLocation, rebaseBinaryLocation, newAdress);