PackageKit/PackageKit-0.9.1-smart-what_provides.patch
Silvan Calarco da3742ddc4 provide directory /var/cache/PackgeKit/downloads
smartBackend.py: patched to raise correct exceptions, hopefully fixes pk lockups on errors [release 0.9.5-3mamba;Tue Aug 18 2015]
2024-01-05 17:51:42 +01:00

60 lines
2.0 KiB
Diff

--- PackageKit-0.7.3/backends/smart/pk-backend-smart.c.orig 2012-04-09 15:51:47.815045302 +0200
+++ PackageKit-0.7.3/backends/smart/pk-backend-smart.c 2012-04-09 15:52:44.828441254 +0200
@@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <stdio.h>
#include <pk-backend.h>
#include <pk-backend-spawn.h>
@@ -492,6 +493,22 @@
}
/**
+ * pk_backend_what_provides:
+ */
+static void
+backend_what_provides (PkBackend *backend, PkBitfield filters, gchar **values)
+{
+ gchar *search_tmp;
+ gchar *filters_text;
+
+ filters_text = pk_filter_bitfield_to_string (filters);
+ search_tmp = g_strjoinv ("&", values);
+ pk_backend_spawn_helper (spawn, BACKEND_FILE, "what-provides", filters_text, "any", search_tmp, NULL);
+ g_free (filters_text);
+ g_free (search_tmp);
+}
+
+/**
* pk_backend_get_description:
*/
gchar *
--- PackageKit-0.6.13.orig//backends/smart/smartBackend.py 2011-04-24 13:53:16.796854052 +0200
+++ PackageKit-0.6.13/backends/smart/smartBackend.py 2011-04-24 15:03:58.644185808 +0200
@@ -551,6 +551,23 @@
self._post_process_package_list(filters)
self._show_package_list()
+ @needs_cache
+ def what_provides(self, filters, provides_type, values):
+ self.status(STATUS_QUERY)
+ self.allow_cancel(True)
+ if provides_type != PROVIDES_ANY:
+ self.error(ERROR_NOT_SUPPORTED,
+ "provide %s not supported" % provides_type)
+ return
+ for value in values:
+ providers = self.ctrl.getCache().getProvides(value)
+ for provider in providers:
+ for package in provider.packages:
+ if self._package_passes_filters(package, filters):
+ self._add_package(package)
+ self._post_process_package_list(filters)
+ self._show_package_list()
+
def refresh_cache(self, force):
# TODO: use force ?
self.status(STATUS_REFRESH_CACHE)