From d0d848e8849a25b4599e9a7b01093721e1b1a366 Mon Sep 17 00:00:00 2001 From: Arttu Tarkiainen Date: Mon, 16 May 2022 15:24:22 +0300 Subject: Swap priority of remote and binary resource package sources When a component with the same name and equal version is available from both remote repository and installer binary, it makes more sense to use the installer resource as the package source for the component. This also fixes the issue of erroneously registering duplicate archives to a single resource collection. Because both the internal resources and downloaded archives are registered in the same naming scheme of "installer:///", we would register the same archive second time when using the remote source. If the packager has not explicitly added Extract operations for the component, these would be created automatically by looking for archive entries from the component's resource collection, and so the same operation would be added twice. Task-number: QTIFW-2242 Change-Id: I82d4ed8a94a67d982b016bf7cec972e43bef8f03 Reviewed-by: Katja Marttila --- src/libs/installer/packagemanagercore_p.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index 92e30c28c..45fe890f9 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -662,7 +662,7 @@ void PackageManagerCorePrivate::initialize(const QHash ¶ms m_localPackageHub->setApplicationVersion(QLatin1String(QUOTE(IFW_REPOSITORY_FORMAT_VERSION))); if (isInstaller()) - m_packageSources.insert(PackageSource(QUrl(QLatin1String("resource://metadata/")), 0)); + m_packageSources.insert(PackageSource(QUrl(QLatin1String("resource://metadata/")), 1)); m_metadataJob.disconnect(); m_metadataJob.setAutoDelete(false); @@ -2786,7 +2786,7 @@ bool PackageManagerCorePrivate::addUpdateResourcesFromRepositories(bool parseChe m_updates = false; m_updateSourcesAdded = false; if (isInstaller()) - m_packageSources.insert(PackageSource(QUrl(QLatin1String("resource://metadata/")), 0)); + m_packageSources.insert(PackageSource(QUrl(QLatin1String("resource://metadata/")), 1)); } foreach (const Metadata &data, metadata) { @@ -2830,7 +2830,7 @@ bool PackageManagerCorePrivate::addUpdateResourcesFromRepositories(bool parseChe if (data.repository.isCompressed()) m_compressedPackageSources.insert(PackageSource(QUrl::fromLocalFile(data.directory), 2)); else - m_packageSources.insert(PackageSource(QUrl::fromLocalFile(data.directory), 1)); + m_packageSources.insert(PackageSource(QUrl::fromLocalFile(data.directory), 0)); ProductKeyCheck::instance()->addPackagesFromXml(data.directory + QLatin1String("/Updates.xml")); } -- cgit v1.2.3