summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2023-03-14 15:05:10 +0200
committerKatja Marttila <katja.marttila@qt.io>2023-03-15 12:10:46 +0200
commitc145dc914e76bb1532663289f5bca1f2214ea8d2 (patch)
tree87e43b6acf4e7c1309c281e09dfba9118d896374 /src/libs
parentf3647532f74db43077b0c119bae9e2f55f2f4471 (diff)
Fix invalid cache state
Cache ended up in invalid state when there was categories used in the installer which were not all defaultly selected. Cache was only party updated when using CLI command search, and the cache was populated only with Updates.xml and repository.txt. In the next installer or MT launch, installer thought the cache was up to date as the Updates.xml was found and did not know that the metadata was not fetched. This lead to different error messages, like 'Cannot open script file' or 'Cannot open the requested license file' etc. Fixed so that metadata is fetched also when using CLI command search Task-number: QTIFW-2998 Change-Id: I1cdc446469f38cc9e6ddc71f512105fc5d10e74c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/installer/metadatajob.cpp15
-rw-r--r--src/libs/installer/metadatajob.h3
-rw-r--r--src/libs/installer/packagemanagercore.cpp2
3 files changed, 7 insertions, 13 deletions
diff --git a/src/libs/installer/metadatajob.cpp b/src/libs/installer/metadatajob.cpp
index 4bb2b99de..08cc70d0c 100644
--- a/src/libs/installer/metadatajob.cpp
+++ b/src/libs/installer/metadatajob.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2022 The Qt Company Ltd.
+** Copyright (C) 2023 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -234,7 +234,7 @@ void MetadataJob::doStart()
}
const ProductKeyCheck *const productKeyCheck = ProductKeyCheck::instance();
- if (m_downloadType == DownloadType::All || m_downloadType == DownloadType::UpdatesXML) {
+ if (m_downloadType != DownloadType::CompressedPackage) {
emit infoMessage(this, tr("Fetching latest update information..."));
const bool onlineInstaller = m_core->isInstaller() && !m_core->isOfflineOnly();
if (onlineInstaller || m_core->isMaintainer()) {
@@ -540,14 +540,9 @@ void MetadataJob::xmlTaskFinished()
return;
if (status == XmlDownloadSuccess) {
- if (m_downloadType != DownloadType::UpdatesXML) {
- if (!fetchMetaDataPackages()) {
- // No new metadata packages to fetch, still need to update the cache
- // for refreshed repositories.
- if (updateCache())
- emitFinished();
- }
- } else {
+ if (!fetchMetaDataPackages()) {
+ // No new metadata packages to fetch, still need to update the cache
+ // for refreshed repositories.
if (updateCache())
emitFinished();
}
diff --git a/src/libs/installer/metadatajob.h b/src/libs/installer/metadatajob.h
index c0412b9cd..0a059e412 100644
--- a/src/libs/installer/metadatajob.h
+++ b/src/libs/installer/metadatajob.h
@@ -48,8 +48,7 @@ class PackageManagerCore;
enum DownloadType
{
All,
- CompressedPackage,
- UpdatesXML
+ CompressedPackage
};
class INSTALLER_EXPORT MetadataJob : public Job
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 6a449c69a..c598e6c52 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -2497,7 +2497,7 @@ void PackageManagerCore::listAvailablePackages(const QString &regexp, const QHas
<< "Searching packages with regular expression:" << regexp;
ComponentModel *model = defaultComponentModel();
- d->fetchMetaInformationFromRepositories(DownloadType::UpdatesXML);
+ d->fetchMetaInformationFromRepositories();
d->addUpdateResourcesFromRepositories(true);
QRegularExpression re(regexp);