diff options
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/installer/adminauthorization_x11.cpp | 1 | ||||
-rw-r--r-- | src/libs/installer/binaryformatengine.cpp | 2 | ||||
-rw-r--r-- | src/libs/installer/component.cpp | 9 | ||||
-rw-r--r-- | src/libs/installer/component.h | 2 | ||||
-rw-r--r-- | src/libs/installer/downloadfiletask.cpp | 13 | ||||
-rw-r--r-- | src/libs/installer/elevatedexecuteoperation.cpp | 5 | ||||
-rw-r--r-- | src/libs/installer/installercalculator.cpp | 66 | ||||
-rw-r--r-- | src/libs/installer/installercalculator.h | 4 | ||||
-rw-r--r-- | src/libs/installer/packagemanagercore.cpp | 1 | ||||
-rw-r--r-- | src/libs/installer/packagemanagercoredata.cpp | 1 | ||||
-rw-r--r-- | src/libs/installer/remotefileengine.cpp | 2 | ||||
-rw-r--r-- | src/libs/installer/remoteobject.cpp | 3 | ||||
-rw-r--r-- | src/libs/kdtools/sysinfo_x11.cpp | 1 | ||||
-rw-r--r-- | src/libs/kdtools/updatefinder.cpp | 1 |
14 files changed, 77 insertions, 34 deletions
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; |