diff options
author | Tim Jenssen <tim.jenssen@digia.com> | 2013-05-31 16:40:12 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@digia.com> | 2013-06-03 16:35:23 +0200 |
commit | c2cfa6dd833f60d75cc7aafe7282d052cdae5257 (patch) | |
tree | 61abe2480beaef69b583e7ff420fa5db7ba1925d /src/libs/installer/qtpatchoperation.cpp | |
parent | 955db4b7492cbb044de2a7f1d3a145e533f5a701 (diff) |
adding ConsumeOutputOperation
- With that operation we can save the original qmake output,
before the installer does the patching. So we can use the old values
for modules patching if they will be installed later.
- added a autotest which does that with the current used qmake
Change-Id: Ie07d273bf64d1813b7af3374a0db35a9e1215503
Reviewed-by: Niels Weber <niels.weber@digia.com>
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Diffstat (limited to 'src/libs/installer/qtpatchoperation.cpp')
-rw-r--r-- | src/libs/installer/qtpatchoperation.cpp | 68 |
1 files changed, 47 insertions, 21 deletions
diff --git a/src/libs/installer/qtpatchoperation.cpp b/src/libs/installer/qtpatchoperation.cpp index 018d4e24a..997b92b77 100644 --- a/src/libs/installer/qtpatchoperation.cpp +++ b/src/libs/installer/qtpatchoperation.cpp @@ -176,7 +176,24 @@ bool QtPatchOperation::performOperation() return false; } - QString type = arguments().at(0); + QStringList args = arguments(); + QString qmakeOutputInstallerKey; + QStringList filteredQmakeOutputInstallerKey = args.filter(QLatin1String("QmakeOutputInstallerKey="), + Qt::CaseInsensitive); + PackageManagerCore *const core = value(QLatin1String("installer")).value<PackageManagerCore*>(); + if (!filteredQmakeOutputInstallerKey.isEmpty()) { + if (!core) { + setError(UserDefinedError); + setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name())); + return false; + } + QString qmakeOutputInstallerKeyArgument = filteredQmakeOutputInstallerKey.at(0); + qmakeOutputInstallerKey = qmakeOutputInstallerKeyArgument; + qmakeOutputInstallerKey.replace(QLatin1String("QmakeOutputInstallerKey="), QString(), Qt::CaseInsensitive); + args.removeAll(qmakeOutputInstallerKeyArgument); + } + + QString type = args.at(0); bool isPlatformSupported = type.contains(QLatin1String("linux"), Qt::CaseInsensitive) || type.contains(QLatin1String("windows"), Qt::CaseInsensitive) || type.contains(QLatin1String("mac"), Qt::CaseInsensitive); @@ -187,31 +204,42 @@ bool QtPatchOperation::performOperation() return false; } - const QString newQtPathStr = QDir::toNativeSeparators(arguments().at(1)); - const QByteArray newQtPath = newQtPathStr.toUtf8(); + if (!filteredQmakeOutputInstallerKey.isEmpty() && core->value(qmakeOutputInstallerKey).isEmpty()) { + setError(UserDefinedError); + setErrorString(tr("Could not find the needed QmakeOutputInstallerKey(%1) value on the installer " + "object. The ConsumeOutput operation on the valid qmake needs to be called first.").arg( + qmakeOutputInstallerKey)); + return false; + } + const QString newQtPathStr = QDir::toNativeSeparators(args.at(1)); + const QByteArray newQtPath = newQtPathStr.toUtf8(); QString qmakePath = QString::fromUtf8(newQtPath) + QLatin1String("/bin/qmake"); #ifdef Q_OS_WIN qmakePath = qmakePath + QLatin1String(".exe"); #endif - if (!QFile::exists(qmakePath)) { - setError(UserDefinedError); - setErrorString(tr("QMake from the current Qt version \n(%1)is not existing. Please file a bugreport " - "with this dialog at https://bugreports.qt-project.org.").arg(QDir::toNativeSeparators(qmakePath))); - return false; + QHash<QString, QByteArray> qmakeValueHash; + if (!core->value(qmakeOutputInstallerKey).isEmpty()) { + qmakeValueHash = QtPatch::readQmakeOutput(core->value(qmakeOutputInstallerKey).toLatin1()); + } else { + if (!QFile::exists(qmakePath)) { + setError(UserDefinedError); + setErrorString(tr("QMake from the current Qt version \n(%1)is not existing. Please file a bugreport " + "with this dialog at https://bugreports.qt-project.org.").arg(QDir::toNativeSeparators(qmakePath))); + return false; + } + QByteArray qmakeOutput; + qmakeValueHash = QtPatch::qmakeValues(qmakePath, &qmakeOutput); + if (qmakeValueHash.isEmpty()) { + setError(UserDefinedError); + setErrorString(tr("The output of \n%1 -query\nis not parseable. Please file a bugreport with this " + "dialog https://bugreports.qt-project.org.\noutput: \"%2\"").arg(QDir::toNativeSeparators(qmakePath), + QString::fromUtf8(qmakeOutput))); + return false; + } } - QByteArray qmakeOutput; - QHash<QString, QByteArray> qmakeValueHash = QtPatch::qmakeValues(qmakePath, &qmakeOutput); - - if (qmakeValueHash.isEmpty()) { - setError(UserDefinedError); - setErrorString(tr("The output of \n%1 -query\nis not parseable. Please file a bugreport with this " - "dialog https://bugreports.qt-project.org.\noutput: \"%2\"").arg(QDir::toNativeSeparators(qmakePath), - QString::fromUtf8(qmakeOutput))); - return false; - } const QByteArray oldQtPath = qmakeValueHash.value(QLatin1String("QT_INSTALL_PREFIX")); bool oldQtPathFromQMakeIsEmpty = oldQtPath.isEmpty(); @@ -246,13 +274,11 @@ bool QtPatchOperation::performOperation() fileName = QString::fromLatin1(":/files-to-patch-windows"); else if (type == QLatin1String("linux")) fileName = QString::fromLatin1(":/files-to-patch-linux"); - else if (type == QLatin1String("linux-emb-arm")) - fileName = QString::fromLatin1(":/files-to-patch-linux-emb-arm"); else if (type == QLatin1String("mac")) fileName = QString::fromLatin1(":/files-to-patch-macx"); QFile patchFileListFile(fileName); - QString version = arguments().value(2).toLower(); + QString version = args.value(2).toLower(); if (!version.isEmpty()) patchFileListFile.setFileName(fileName + QLatin1Char('-') + version); |