--- 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 #include #include @@ -492,6 +493,25 @@ } /** + * pk_backend_what_provides: + */ +static void +backend_what_provides (PkBackend *backend, PkBitfield filters, PkProvidesEnum provides, gchar **values) +{ + gchar *search_tmp; + gchar *filters_text; + const gchar *provides_text; + + provides_text = pk_provides_enum_to_text (provides); + filters_text = pk_filter_bitfield_to_string (filters); + search_tmp = g_strjoinv ("&", values); + fprintf(stderr,"prova: %s\n", provides_text); + pk_backend_spawn_helper (spawn, BACKEND_FILE, "what-provides", filters_text, provides_text, 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)