[gnome-software/1876-gnome-software-missing-an-install-upgrade-button-when-opening-an-rpm-file] packagekit: Mark local file as installed only if the version is lower than the installed
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1876-gnome-software-missing-an-install-upgrade-button-when-opening-an-rpm-file] packagekit: Mark local file as installed only if the version is lower than the installed
- Date: Thu, 25 Aug 2022 10:44:54 +0000 (UTC)
commit d4a9ffdad131e826a36679e96662b450cc302e46
Author: Milan Crha <mcrha redhat com>
Date: Thu Aug 25 12:38:46 2022 +0200
packagekit: Mark local file as installed only if the version is lower than the installed
This allows to offer to install, aka update, the package from a file.
When the file has lower version than the installed package then only
a remove is offered.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1876
plugins/packagekit/gs-plugin-packagekit.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/plugins/packagekit/gs-plugin-packagekit.c b/plugins/packagekit/gs-plugin-packagekit.c
index 85f941648..ea9ac4d79 100644
--- a/plugins/packagekit/gs-plugin-packagekit.c
+++ b/plugins/packagekit/gs-plugin-packagekit.c
@@ -2654,11 +2654,18 @@ gs_plugin_packagekit_local_check_installed (GsPluginPackagekit *self,
}
packages = pk_results_get_package_array (results);
if (packages->len > 0) {
- gs_app_set_state (app, GS_APP_STATE_UNKNOWN);
- gs_app_set_state (app, GS_APP_STATE_INSTALLED);
+ gboolean is_higher_version = FALSE;
+ const gchar *app_version = gs_app_get_version (app);
for (guint i = 0; i < packages->len; i++){
PkPackage *pkg = g_ptr_array_index (packages, i);
gs_app_add_source_id (app, pk_package_get_id (pkg));
+ if (!is_higher_version &&
+ as_vercmp_simple (pk_package_get_version (pkg), app_version) < 0)
+ is_higher_version = TRUE;
+ }
+ if (!is_higher_version) {
+ gs_app_set_state (app, GS_APP_STATE_UNKNOWN);
+ gs_app_set_state (app, GS_APP_STATE_INSTALLED);
}
}
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]