diff options
author | Katja Marttila <katja.marttila@qt.io> | 2024-04-19 14:22:51 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2024-04-22 12:56:49 +0300 |
commit | f9e3e9fa91eb004a6b744a212b515397def1c10f (patch) | |
tree | 9eee47c4c3eba9b5eecfe6553f34c00dbf77bd0c /src/libs/installer/packagemanagercore.cpp | |
parent | 31fc0eb9a715a8de08085621a92b09ce878a74b5 (diff) |
Fix metadata fetch in updater mode
If no component is given to update command, look for updates from all
categories so no update is missed. If component is given, utilize the
meta fetch from default repositories first. Checkupdates command
searches update from all categories.
Change-Id: I6dbd9f130c9b008cb066ad7767d2b9a287ecac9f
Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'src/libs/installer/packagemanagercore.cpp')
-rw-r--r-- | src/libs/installer/packagemanagercore.cpp | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp index 3f2686efd..f1dec9b8f 100644 --- a/src/libs/installer/packagemanagercore.cpp +++ b/src/libs/installer/packagemanagercore.cpp @@ -2936,6 +2936,25 @@ void PackageManagerCore::listInstalledPackages(const QString ®exp) LoggingHandler::instance().printLocalPackageInformation(packages); } +PackageManagerCore::Status PackageManagerCore::searchAvailableUpdates() +{ + setUpdater(); + d->enableAllCategories(); + if (!fetchRemotePackagesTree()) { + qCWarning(QInstaller::lcInstallerInstallLog) << error(); + return status(); + } + + const QList<QInstaller::Component *> availableUpdates = + components(QInstaller::PackageManagerCore::ComponentType::Root); + if (availableUpdates.isEmpty()) { + qCWarning(QInstaller::lcInstallerInstallLog) << "There are currently no updates available."; + return status(); + } + QInstaller::LoggingHandler::instance().printUpdateInformation(availableUpdates); + return status(); +} + /*! Updates the selected components \a componentsToUpdate without GUI. If essential components are found, then only those will be updated. @@ -2947,14 +2966,19 @@ PackageManagerCore::Status PackageManagerCore::updateComponentsSilently(const QS ComponentModel *model = updaterComponentModel(); - bool fallbackReposFetched = false; - bool packagesFound = fetchPackagesWithFallbackRepositories(componentsToUpdate, fallbackReposFetched); + if (componentsToUpdate.isEmpty()) { + d->enableAllCategories(); + fetchRemotePackagesTree(); + } else { + bool fallbackReposFetched = false; + bool packagesFound = fetchPackagesWithFallbackRepositories(componentsToUpdate, fallbackReposFetched); - if (!packagesFound) { - qCDebug(QInstaller::lcInstallerInstallLog).noquote().nospace() - << "No components available for update with the current selection."; - d->setStatus(Canceled); - return status(); + if (!packagesFound) { + qCDebug(QInstaller::lcInstallerInstallLog).noquote().nospace() + << "No components available for update with the current selection."; + d->setStatus(Canceled); + return status(); + } } // List contains components containing update, if essential found contains only essential component |