From d1659f7e1159459e1a2ea168bd4f1519d231b133 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 13 Sep 2022 09:11:57 +0200 Subject: [PATCH] Resolves: #2124869 (Cannot install RPM package file) --- 0002-install-rpm-file.patch | 108 ++++++++++++++++++++++++++++++++++++ gnome-software.spec | 6 +- 2 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 0002-install-rpm-file.patch diff --git a/0002-install-rpm-file.patch b/0002-install-rpm-file.patch new file mode 100644 index 0000000..745ceb7 --- /dev/null +++ b/0002-install-rpm-file.patch @@ -0,0 +1,108 @@ +From e706a530aeeba360fd60fa7ccde63a147f1e14d4 Mon Sep 17 00:00:00 2001 +Date: Wed, 7 Sep 2022 16:18:50 +0200 +Subject: [PATCH 1/2] gs-details-page: Filter out alternatives without origin + +When an alternative app has no origin set, it cannot be installed or +even shown in the GUI, thus filter such alternatives out. + +Helps https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1895 +--- + src/gs-details-page.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/src/gs-details-page.c b/src/gs-details-page.c +index cfe3cc797..d35ee0a98 100644 +--- a/src/gs-details-page.c ++++ b/src/gs-details-page.c +@@ -1637,6 +1637,16 @@ _set_app (GsDetailsPage *self, GsApp *app) + self, 0); + } + ++static gboolean ++gs_details_page_filter_origin (GsApp *app, ++ gpointer user_data) ++{ ++ /* Keep only local apps or those, which have an origin set */ ++ return gs_app_get_state (app) == GS_APP_STATE_AVAILABLE_LOCAL || ++ gs_app_get_local_file (app) != NULL || ++ gs_app_get_origin (app) != NULL; ++} ++ + /* show the UI and do operations that should not block page load */ + static void + gs_details_page_load_stage2 (GsDetailsPage *self, +@@ -1676,6 +1686,7 @@ gs_details_page_load_stage2 (GsDetailsPage *self, + query = gs_app_query_new ("alternate-of", self->app, + "refine-flags", GS_DETAILS_PAGE_REFINE_FLAGS, + "dedupe-flags", GS_APP_LIST_FILTER_FLAG_NONE, ++ "filter-func", gs_details_page_filter_origin, + "sort-func", gs_utils_app_sort_priority, + NULL); + plugin_job2 = gs_plugin_job_list_apps_new (query, GS_PLUGIN_LIST_APPS_FLAGS_INTERACTIVE); +-- +GitLab + + +From 7962414c7ef62494512a93df5855249debc39415 Mon Sep 17 00:00:00 2001 +Date: Wed, 7 Sep 2022 16:58:34 +0200 +Subject: [PATCH 2/2] gs-details-page: Include local file as an alternative + when not installed + +It's not enough to add the local file to the GsAppList, because it can +contain an app with the same ID, thus the local file app won't be added +to the list. + +Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1895 +--- + src/gs-details-page.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/src/gs-details-page.c b/src/gs-details-page.c +index d35ee0a98..50b80e159 100644 +--- a/src/gs-details-page.c ++++ b/src/gs-details-page.c +@@ -645,6 +645,7 @@ gs_details_page_get_alternates_cb (GObject *source_object, + GtkWidget *select_row = NULL; + GtkWidget *origin_row_by_packaging_format = NULL; + gint origin_row_by_packaging_format_index = 0; ++ guint n_rows = 0; + + self->origin_by_packaging_format = FALSE; + gs_widget_remove_all (self->origin_popover_list_box, (GsRemoveFunc) gtk_list_box_remove); +@@ -699,7 +700,15 @@ gs_details_page_get_alternates_cb (GObject *source_object, + /* add the local file to the list so that we can carry it over when + * switching between alternates */ + if (self->app_local_file != NULL) { +- gs_app_list_add (list, self->app_local_file); ++ if (gs_app_get_state (self->app_local_file) != GS_APP_STATE_INSTALLED) { ++ GtkWidget *row = gs_origin_popover_row_new (self->app_local_file); ++ gtk_widget_show (row); ++ gtk_list_box_append (GTK_LIST_BOX (self->origin_popover_list_box), row); ++ first_row = row; ++ select_row = row; ++ n_rows++; ++ } ++ + /* Do not allow change of the app by the packaging format when it's a local file */ + origin_by_packaging_format = FALSE; + } +@@ -716,6 +725,7 @@ gs_details_page_get_alternates_cb (GObject *source_object, + GsApp *app = gs_app_list_index (list, i); + GtkWidget *row = gs_origin_popover_row_new (app); + gtk_widget_show (row); ++ n_rows++; + if (first_row == NULL) + first_row = row; + if (app == self->app || ( +@@ -766,7 +776,7 @@ gs_details_page_get_alternates_cb (GObject *source_object, + } + + /* Do not show the "selected" check when there's only one app in the list */ +- if (select_row && gs_app_list_length (list) > 1) ++ if (select_row && n_rows > 1) + gs_origin_popover_row_set_selected (GS_ORIGIN_POPOVER_ROW (select_row), TRUE); + else if (select_row) + gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (select_row), FALSE); +-- +GitLab + diff --git a/gnome-software.spec b/gnome-software.spec index 9545378..6979b0c 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -18,7 +18,7 @@ Name: gnome-software Version: 43.rc -Release: 1%{?dist} +Release: 2%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -26,6 +26,7 @@ URL: https://wiki.gnome.org/Apps/Software Source0: https://download.gnome.org/sources/gnome-software/43/%{name}-%{tarball_version}.tar.xz Patch01: 0001-crash-with-broken-theme.patch +Patch02: 0002-install-rpm-file.patch BuildRequires: docbook-style-xsl BuildRequires: desktop-file-utils @@ -211,6 +212,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software/ %changelog +* Tue Sep 13 2022 Milan Crha - 43.rc-2 +- Resolves: #2124869 (Cannot install RPM package file) + * Fri Sep 02 2022 Milan Crha - 43.rc-1 - Update to 43.rc