From a9b7904472b8172f82e751999837b16082731a76 Mon Sep 17 00:00:00 2001 From: Arttu Tarkiainen Date: Thu, 20 Oct 2022 09:58:00 +0300 Subject: 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::clear(). Change-Id: I25ade37baca048e98cc8edb9d90585dcd6d0f142 Reviewed-by: Katja Marttila --- src/libs/installer/metadatajob.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/libs/installer') 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 -- cgit v1.2.3