summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2022-10-20 09:58:00 +0300
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2022-10-20 11:01:27 +0300
commita9b7904472b8172f82e751999837b16082731a76 (patch)
treeab5415b19475f723f16160a878dda44b2fb4d43c
parent70749445ce67636a27a157cbafcebc641f679ac9 (diff)
Fix installer not respecting PersistentLocalCache value properly
In case the installer is configured to use a non-persistent cache, it is not enough anymore to mark the subdirectories of the cache for deletion. Instead it should be done by properly clearing the cache with GenericDataCache<T>::clear(). Change-Id: I25ade37baca048e98cc8edb9d90585dcd6d0f142 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
-rw-r--r--src/libs/installer/metadatajob.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libs/installer/metadatajob.cpp b/src/libs/installer/metadatajob.cpp
index a5be056a3..a15209a31 100644
--- a/src/libs/installer/metadatajob.cpp
+++ b/src/libs/installer/metadatajob.cpp
@@ -106,6 +106,12 @@ MetadataJob::~MetadataJob()
{
resetCompressedFetch();
reset();
+
+ if (!m_core)
+ return;
+
+ if (m_metaFromCache.isValid() && !m_core->settings().persistentLocalCache())
+ m_metaFromCache.clear();
}
/*
@@ -180,6 +186,10 @@ bool MetadataJob::resetCache(bool init)
"missing package manager core engine.";
return false;
}
+
+ if (m_metaFromCache.isValid() && !m_core->settings().persistentLocalCache())
+ m_metaFromCache.clear();
+
m_metaFromCache.setPath(m_core->settings().localCachePath());
m_metaFromCache.setType(QLatin1String("Metadata"));
m_metaFromCache.setVersion(QLatin1String(QUOTE(IFW_REPOSITORY_FORMAT_VERSION)));
@@ -344,9 +354,6 @@ bool MetadataJob::updateCache()
return false;
}
meta->setPersistentRepositoryPath(meta->repository().url());
- if (!m_core->settings().persistentLocalCache())
- m_tempDirDeleter.add(meta->path());
-
registeredKeys.append(m_fetchedMetadata.key(meta));
}
// Remove items whose ownership was transferred to cache