diff options
author | Katja Marttila <katja.marttila@qt.io> | 2017-03-30 10:26:40 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2017-03-30 10:34:22 +0300 |
commit | a42a15779a4c75431add40f0b88fc57c591b1efa (patch) | |
tree | 74f97639b2d39be0599f4239f67121bdde846415 | |
parent | 2385184b8b1aeaac6d0b42739b44c4786a6e9cab (diff) | |
parent | 7e91db5b1e01ffeeaa566ebb5b8230dcdc6b514f (diff) |
Merge remote-tracking branch 'origin/3.0'
Change-Id: Ic3c8005de03b2cc71436aaa18486085a845dca78
23 files changed, 128 insertions, 43 deletions
@@ -4,6 +4,7 @@ - Fix hang in Windows when admin rights needed. (QTIFW-902) - Use deterministic sorting order for components. (QTIFW-833) - Resolve relative URLs from Updates.xml. +- Do not fail to install or update if repository is missing 2.0.4 - Set also display name for Repository action "remove" diff --git a/dist/config/config.xml b/dist/config/config.xml index 39ee262bc..2105b53c5 100644 --- a/dist/config/config.xml +++ b/dist/config/config.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <Installer> <Name>Qt Installer Framework</Name> - <Title>Qt Installer Framework 2.0.81</Title> + <Title>Qt Installer Framework 3.0.81</Title> <Version>1.0.0</Version> <Publisher>Qt Project</Publisher> <ProductUrl>http://qt-project.org</ProductUrl> @@ -9,5 +9,5 @@ <MaintenanceToolName>Uninstaller</MaintenanceToolName> <!-- Tweaked for windows in installscript.qs --> - <TargetDir>@HomeDir@/Qt/QtIFW-2.0.81</TargetDir> + <TargetDir>@HomeDir@/Qt/QtIFW-3.0.81</TargetDir> </Installer> diff --git a/dist/packages/org.qtproject.ifw.binaries/meta/package.xml b/dist/packages/org.qtproject.ifw.binaries/meta/package.xml index f820372fc..e2f51aa16 100644 --- a/dist/packages/org.qtproject.ifw.binaries/meta/package.xml +++ b/dist/packages/org.qtproject.ifw.binaries/meta/package.xml @@ -2,7 +2,7 @@ <Package> <DisplayName>Qt Installer Framework Binaries</DisplayName> <Description>Installs the binaries, examples and help files.</Description> - <Version>2.0.81</Version> - <ReleaseDate>2013-12-12</ReleaseDate> + <Version>3.0.81</Version> + <ReleaseDate>2017-03-29</ReleaseDate> <Default>True</Default> </Package> diff --git a/dist/packages/org.qtproject.ifw/meta/package.xml b/dist/packages/org.qtproject.ifw/meta/package.xml index 68646ad28..5997adeaa 100644 --- a/dist/packages/org.qtproject.ifw/meta/package.xml +++ b/dist/packages/org.qtproject.ifw/meta/package.xml @@ -2,8 +2,8 @@ <Package> <DisplayName>Qt Installer Framework</DisplayName> <Description>Installs the Qt Installer Framework.</Description> - <Version>2.0.81</Version> - <ReleaseDate>2013-12-12</ReleaseDate> + <Version>3.0.81</Version> + <ReleaseDate>2017-03-29</ReleaseDate> <Licenses> <License name="The Qt Company GPL Exception 1.0" file="LICENSE.GPL3-EXCEPT" /> <License name="Third Party Code Licenses" file="3RDPARTY" /> diff --git a/installerfw.pri b/installerfw.pri index d089dcf36..106aa89db 100644 --- a/installerfw.pri +++ b/installerfw.pri @@ -3,8 +3,8 @@ } IFW_PRI_INCLUDED = 1 -IFW_VERSION_STR = 2.0.81 -IFW_VERSION = 0x020081 +IFW_VERSION_STR = 3.0.81 +IFW_VERSION = 0x030081 IFW_REPOSITORY_FORMAT_VERSION = 1.0.0 IFW_NEWLINE = $$escape_expand(\\n\\t) diff --git a/src/libs/installer/adminauthorization_x11.cpp b/src/libs/installer/adminauthorization_x11.cpp index aa5e1d91d..7068bb2c6 100644 --- a/src/libs/installer/adminauthorization_x11.cpp +++ b/src/libs/installer/adminauthorization_x11.cpp @@ -29,6 +29,7 @@ #include "adminauthorization.h" #include <QtCore/QFile> +#include <QtCore/QRegExp> #include <QDebug> #include <QApplication> diff --git a/src/libs/installer/binaryformatengine.cpp b/src/libs/installer/binaryformatengine.cpp index 20fd6e3f2..1100bcf08 100644 --- a/src/libs/installer/binaryformatengine.cpp +++ b/src/libs/installer/binaryformatengine.cpp @@ -28,6 +28,8 @@ #include "binaryformatengine.h" +#include <QRegExp> + namespace { class StringListIterator : public QAbstractFileEngineIterator diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index db9f2689d..da0230ade 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -43,6 +43,7 @@ #include <productkeycheck.h> #include <QtCore/QDirIterator> +#include <QtCore/QRegExp> #include <QtCore/QTranslator> #include <QApplication> @@ -1241,9 +1242,13 @@ bool Component::isDefault() const return d->m_vars.value(scDefault).compare(scTrue, Qt::CaseInsensitive) == 0; } -bool Component::isInstalled() const +bool Component::isInstalled(const QString version) const { - return scInstalled == d->m_vars.value(scCurrentState); + if (version.isEmpty()) { + return scInstalled == d->m_vars.value(scCurrentState); + } else { + return d->m_vars.value(scInstalledVersion) == version; + } } /*! diff --git a/src/libs/installer/component.h b/src/libs/installer/component.h index 7492eaf54..01622548f 100644 --- a/src/libs/installer/component.h +++ b/src/libs/installer/component.h @@ -166,7 +166,7 @@ public: Q_INVOKABLE bool isAutoDependOn(const QSet<QString> &componentsToInstall) const; Q_INVOKABLE void setInstalled(); - Q_INVOKABLE bool isInstalled() const; + Q_INVOKABLE bool isInstalled(const QString version = QString()) const; Q_INVOKABLE bool installationRequested() const; bool isSelectedForInstallation() const; diff --git a/src/libs/installer/downloadfiletask.cpp b/src/libs/installer/downloadfiletask.cpp index 200075594..c6cef2183 100644 --- a/src/libs/installer/downloadfiletask.cpp +++ b/src/libs/installer/downloadfiletask.cpp @@ -255,10 +255,17 @@ void Downloader::onError(QNetworkReply::NetworkError error) if (reply) { const Data &data = *m_downloads[reply]; + //Do not throw error if Updates.xml not found. The repository might be removed + //with RepositoryUpdate in Updates.xml later. + if (data.taskItem.source().contains(QLatin1String("Updates.xml"), Qt::CaseInsensitive)) { + qDebug() << QString::fromLatin1("Network error while downloading '%1': %2.").arg( + data.taskItem.source(), reply->errorString()); + } else { + m_futureInterface->reportException( + TaskException(tr("Network error while downloading '%1': %2.").arg( + data.taskItem.source(), reply->errorString()))); + } //: %2 is a sentence describing the error - m_futureInterface->reportException( - TaskException(tr("Network error while downloading \"%1\": %2").arg( - data.taskItem.source(), reply->errorString()))); } else { //: %1 is a sentence describing the error m_futureInterface->reportException( diff --git a/src/libs/installer/elevatedexecuteoperation.cpp b/src/libs/installer/elevatedexecuteoperation.cpp index e0f326a33..2cc988a4d 100644 --- a/src/libs/installer/elevatedexecuteoperation.cpp +++ b/src/libs/installer/elevatedexecuteoperation.cpp @@ -31,9 +31,10 @@ #include "environment.h" #include "qprocesswrapper.h" -#include <QtCore/QThread> -#include <QtCore/QProcessEnvironment> #include <QtCore/QDebug> +#include <QtCore/QProcessEnvironment> +#include <QtCore/QRegExp> +#include <QtCore/QThread> using namespace QInstaller; diff --git a/src/libs/installer/installercalculator.cpp b/src/libs/installer/installercalculator.cpp index 03c62033e..064dbafa5 100644 --- a/src/libs/installer/installercalculator.cpp +++ b/src/libs/installer/installercalculator.cpp @@ -92,9 +92,9 @@ QString InstallerCalculator::componentsToInstallError() const return m_componentsToInstallError; } -void InstallerCalculator::realAppendToInstallComponents(Component *component) +void InstallerCalculator::realAppendToInstallComponents(Component *component, const QString &version) { - if (!component->isInstalled() || component->updateRequested()) { + if (!component->isInstalled(version) || component->updateRequested()) { m_orderedComponentsToInstall.append(component); m_toInstallComponentIds.insert(component->name()); } @@ -154,10 +154,10 @@ bool InstallerCalculator::appendComponentsToInstall(const QList<Component *> &co return true; } -bool InstallerCalculator::appendComponentToInstall(Component *component) +bool InstallerCalculator::appendComponentToInstall(Component *component, const QString &version) { QSet<QString> allDependencies = component->dependencies().toSet(); - + QString requiredDependencyVersion = version; foreach (const QString &dependencyComponentName, allDependencies) { // PackageManagerCore::componentByName returns 0 if dependencyComponentName contains a // version which is not available @@ -171,30 +171,50 @@ bool InstallerCalculator::appendComponentToInstall(Component *component) m_componentsToInstallError.append(errorMessage); return false; } + //Check if component requires higher version than what might be already installed + bool isUpdateRequired = false; + if (dependencyComponentName.contains(QChar::fromLatin1('-')) && + !dependencyComponent->value(scInstalledVersion).isEmpty()) { + QRegExp compEx(QLatin1String("([<=>]+)(.*)")); + const QString installedVersion = compEx.exactMatch(dependencyComponent->value(scInstalledVersion)) ? + compEx.cap(2) : dependencyComponent->value(scInstalledVersion); + + QString requiredVersion = dependencyComponentName.section(QLatin1Char('-'), 1); + requiredVersion = compEx.exactMatch(requiredVersion) ? compEx.cap(2) : requiredVersion; + + if (KDUpdater::compareVersion(requiredVersion, installedVersion) >= 1 ) { + isUpdateRequired = true; + requiredDependencyVersion = requiredVersion; + } + } + //Check dependencies only if + //- Dependency is not installed or update requested, nor newer version of dependency component required + //- And dependency component is not already added for install + //- And component is not already added for install, then dependencies are already resolved + if (((!dependencyComponent->isInstalled() || dependencyComponent->updateRequested()) + || isUpdateRequired) && (!m_toInstallComponentIds.contains(dependencyComponent->name()) + && !m_toInstallComponentIds.contains(component->name()))) { + if (m_visitedComponents.value(component).contains(dependencyComponent)) { + const QString errorMessage = recursionError(component); + qWarning().noquote() << errorMessage; + m_componentsToInstallError = errorMessage; + Q_ASSERT_X(!m_visitedComponents.value(component).contains(dependencyComponent), + Q_FUNC_INFO, qPrintable(errorMessage)); + return false; + } + m_visitedComponents[component].insert(dependencyComponent); + + // add needed dependency components to the next run + insertInstallReason(dependencyComponent, InstallerCalculator::Dependent, + component->name()); - if ((!dependencyComponent->isInstalled() || dependencyComponent->updateRequested()) - && !m_toInstallComponentIds.contains(dependencyComponent->name())) { - if (m_visitedComponents.value(component).contains(dependencyComponent)) { - const QString errorMessage = recursionError(component); - qWarning().noquote() << errorMessage; - m_componentsToInstallError = errorMessage; - Q_ASSERT_X(!m_visitedComponents.value(component).contains(dependencyComponent), - Q_FUNC_INFO, qPrintable(errorMessage)); - return false; - } - m_visitedComponents[component].insert(dependencyComponent); - - // add needed dependency components to the next run - insertInstallReason(dependencyComponent, InstallerCalculator::Dependent, - component->name()); - - if (!appendComponentToInstall(dependencyComponent)) - return false; + if (!appendComponentToInstall(dependencyComponent, requiredDependencyVersion)) + return false; } } if (!m_toInstallComponentIds.contains(component->name())) { - realAppendToInstallComponents(component); + realAppendToInstallComponents(component, requiredDependencyVersion); insertInstallReason(component, InstallerCalculator::Resolved); } return true; diff --git a/src/libs/installer/installercalculator.h b/src/libs/installer/installercalculator.h index 08dd47f78..b2d05bdbe 100644 --- a/src/libs/installer/installercalculator.h +++ b/src/libs/installer/installercalculator.h @@ -64,8 +64,8 @@ private: void insertInstallReason(Component *component, InstallReasonType installReasonType, const QString &referencedComponentName = QString()); - void realAppendToInstallComponents(Component *component); - bool appendComponentToInstall(Component *components); + void realAppendToInstallComponents(Component *component, const QString &version = QString()); + bool appendComponentToInstall(Component *components, const QString &version = QString()); QString recursionError(Component *component); QList<Component*> m_allComponents; diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp index 44d95d1ed..edd2460a8 100644 --- a/src/libs/installer/packagemanagercore.cpp +++ b/src/libs/installer/packagemanagercore.cpp @@ -54,6 +54,7 @@ #include <QtConcurrentRun> #include <QtCore/QMutex> +#include <QtCore/QRegExp> #include <QtCore/QSettings> #include <QtCore/QTemporaryFile> #include <QtCore/QTextCodec> diff --git a/src/libs/installer/packagemanagercoredata.cpp b/src/libs/installer/packagemanagercoredata.cpp index 6e4fe4f94..3b35794cf 100644 --- a/src/libs/installer/packagemanagercoredata.cpp +++ b/src/libs/installer/packagemanagercoredata.cpp @@ -34,6 +34,7 @@ #include <QDesktopServices> #include <QDir> +#include <QRegExp> #ifdef Q_OS_WIN # include <windows.h> diff --git a/src/libs/installer/remotefileengine.cpp b/src/libs/installer/remotefileengine.cpp index 305b64729..05f4ec212 100644 --- a/src/libs/installer/remotefileengine.cpp +++ b/src/libs/installer/remotefileengine.cpp @@ -31,6 +31,8 @@ #include "protocol.h" #include "remoteclient.h" +#include <QRegExp> + namespace QInstaller { diff --git a/src/libs/installer/remoteobject.cpp b/src/libs/installer/remoteobject.cpp index 1ae9e6a41..49c111610 100644 --- a/src/libs/installer/remoteobject.cpp +++ b/src/libs/installer/remoteobject.cpp @@ -51,7 +51,8 @@ RemoteObject::~RemoteObject() { if (m_socket) { if (QThread::currentThread() == m_socket->thread()) { - writeData(QLatin1String(Protocol::Destroy), m_type, dummy, dummy); + if (m_type != QLatin1String("RemoteClientPrivate")) + writeData(QLatin1String(Protocol::Destroy), m_type, dummy, dummy); } else { Q_ASSERT_X(false, Q_FUNC_INFO, "Socket running in a different Thread than this object."); } diff --git a/src/libs/kdtools/sysinfo_x11.cpp b/src/libs/kdtools/sysinfo_x11.cpp index 3c6627791..3099a369a 100644 --- a/src/libs/kdtools/sysinfo_x11.cpp +++ b/src/libs/kdtools/sysinfo_x11.cpp @@ -40,6 +40,7 @@ #include <QtCore/QTextStream> #include <QtCore/QDir> #include <QtCore/QFileInfo> +#include <QtCore/QRegExp> namespace KDUpdater { diff --git a/src/libs/kdtools/updatefinder.cpp b/src/libs/kdtools/updatefinder.cpp index 202bf8cd4..ec1be8a4e 100644 --- a/src/libs/kdtools/updatefinder.cpp +++ b/src/libs/kdtools/updatefinder.cpp @@ -39,6 +39,7 @@ #include <QCoreApplication> #include <QFileInfo> +#include <QRegExp> using namespace KDUpdater; using namespace QInstaller; diff --git a/tests/auto/installer/solver/tst_solver.cpp b/tests/auto/installer/solver/tst_solver.cpp index 5ccf0b2c8..5829621f2 100644 --- a/tests/auto/installer/solver/tst_solver.cpp +++ b/tests/auto/installer/solver/tst_solver.cpp @@ -155,15 +155,19 @@ private slots: componentA->appendComponent(componentAA); componentA->appendComponent(componentAB); NamedComponent *componentB = new NamedComponent(core, QLatin1String("B")); + NamedComponent *componentB_NewVersion = new NamedComponent(core, QLatin1String("B_version"), QLatin1String("2.0.0")); componentB->addDependency(QLatin1String("A.B")); + componentAB->addDependency(QLatin1String("B_version->=2.0.0")); core->appendRootComponent(componentA); core->appendRootComponent(componentB); + core->appendRootComponent(componentB_NewVersion); QTest::newRow("Installer resolved") << core << (QList<Component *>() << componentB) - << (QList<Component *>() << componentAB << componentB) + << (QList<Component *>() << componentB_NewVersion << componentAB << componentB) << (QList<int>() << InstallerCalculator::Dependent + << InstallerCalculator::Dependent << InstallerCalculator::Resolved); } @@ -186,6 +190,40 @@ private slots: delete core; } + void unresolvedDependencyVersion_data() + { + QTest::addColumn<PackageManagerCore *>("core"); + QTest::addColumn<QList<Component *> >("selectedComponents"); + QTest::addColumn<QList<Component *> >("expectedResult"); + + PackageManagerCore *core = new PackageManagerCore(); + core->setPackageManager(); + NamedComponent *componentA = new NamedComponent(core, QLatin1String("A")); + NamedComponent *componentB = new NamedComponent(core, QLatin1String("B"), QLatin1String("1.0.0")); + componentA->addDependency(QLatin1String("B->=2.0.0")); + core->appendRootComponent(componentA); + core->appendRootComponent(componentB); + + QTest::newRow("Installer resolved") << core + << (QList<Component *>() << componentA) + << (QList<Component *>()); + } + + void unresolvedDependencyVersion() + { + QFETCH(PackageManagerCore *, core); + QFETCH(QList<Component *> , selectedComponents); + QFETCH(QList<Component *> , expectedResult); + + InstallerCalculator calc(core->components(PackageManagerCore::ComponentType::AllNoReplacements)); + QTest::ignoreMessage(QtWarningMsg, "Cannot find missing dependency \"B->=2.0.0\" for \"A\"."); + calc.appendComponentsToInstall(selectedComponents); + + QList<Component *> result = calc.orderedComponentsToInstall(); + QCOMPARE(result.count(), expectedResult.count()); + delete core; + } + void resolveUninstaller_data() { QTest::addColumn<PackageManagerCore *>("core"); diff --git a/tools/binarycreator/binarycreator.cpp b/tools/binarycreator/binarycreator.cpp index 85d89aab1..b9497f533 100644 --- a/tools/binarycreator/binarycreator.cpp +++ b/tools/binarycreator/binarycreator.cpp @@ -43,6 +43,7 @@ #include <QDirIterator> #include <QDomDocument> #include <QProcess> +#include <QRegExp> #include <QSettings> #include <QTemporaryFile> #include <QTemporaryDir> diff --git a/tools/binarycreator/rcc/rcc.cpp b/tools/binarycreator/rcc/rcc.cpp index 0c30d9161..2361e43e0 100644 --- a/tools/binarycreator/rcc/rcc.cpp +++ b/tools/binarycreator/rcc/rcc.cpp @@ -36,6 +36,7 @@ #include <QtCore/QFile> #include <QtCore/QIODevice> #include <QtCore/QLocale> +#include <QtCore/QRegExp> #include <QtCore/QStack> #include <QXmlStreamReader> diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp index 0465d8126..2942728c2 100644 --- a/tools/common/repositorygen.cpp +++ b/tools/common/repositorygen.cpp @@ -44,6 +44,7 @@ #include <updater.h> #include <QtCore/QDirIterator> +#include <QtCore/QRegExp> #include <QtXml/QDomDocument> |