Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 932725 Details for
Bug 1135558
Implement superset lookup for GStreamer plugins
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
possible patch
0001-yum-Implement-subset-search-for-GStreamer-plugins.patch (text/plain), 6.65 KB, created by
Wim Taymans
on 2014-08-29 15:39:48 UTC
(
hide
)
Description:
possible patch
Filename:
MIME Type:
Creator:
Wim Taymans
Created:
2014-08-29 15:39:48 UTC
Size:
6.65 KB
patch
obsolete
>From 95299b1a008c40a923c49ffff456cd35c719627f Mon Sep 17 00:00:00 2001 >From: Wim Taymans <wtaymans@redhat.com> >Date: Fri, 29 Aug 2014 17:20:12 +0200 >Subject: [PATCH] yum: Implement subset search for GStreamer plugins > >The provides line of the GStreamer packages contain a list of key/value >pairs that specify the provided versions and features of the codecs. >When a key is not present, it means that it can handle all values of it. > >When looking for GStreamer plugins, we don't need an exact match for the >provides line but we are happy if it is a superset of the requested >key/values. > >Implement this by creating an extra dictionary with key/value pairs >derived from the requested provides value and by querying the database >with a wildcard. We then loop over all the returned packages and >implement a superset check on the provides dictionaries. >--- > backends/yum/yumBackend.py | 73 ++++++++++++++++++++++++++++++++++++++-------- > 1 file changed, 61 insertions(+), 12 deletions(-) > >diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py >index f0b8204..6f7ef88 100755 >--- a/backends/yum/yumBackend.py >+++ b/backends/yum/yumBackend.py >@@ -884,28 +884,51 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage): > package_list = pkgfilter.get_package_list() > self._show_package_list(package_list) > >+ def _make_match_dictionary(self, match): >+ result = None >+ >+ if match.startswith("gstreamer0.10(") or match.startswith("gstreamer1("): >+ fields = match.split(")(") >+ result = {} >+ >+ for f in fields: >+ if f.startswith("gstreamer0.10("): >+ result.update({"*media-type*" : f[14:]}) >+ elif f.startswith("gstreamer1("): >+ result.update({"*media-type*" : f[11:]}) >+ elif f == '': >+ break; >+ else: >+ v = f.split("=") >+ result.update({v[0] : v[1]}) >+ >+ return result >+ > def _get_provides_query(self, provides_type, value): > # gets a list of provides >+ mdict = self._make_match_dictionary(value); > > # old standard >- if value.startswith("gstreamer0.10(") or value.startswith("gstreamer1("): >- return [ value ] >+ if value.startswith("gstreamer0.10("): >+ return [("gstreamer0.10(*)", mdict )] >+ if value.startswith("gstreamer1("): >+ return [("gstreamer1(*)", mdict)] > > # new standard > if provides_type == PROVIDES_CODEC: >- return [ "gstreamer0.10(%s)" % value ] >+ return [("gstreamer0.10(*)", "gstreamer0.10(%s)" % mdict)] > if provides_type == PROVIDES_FONT: >- return [ "font(%s)" % value ] >+ return [ ("font(%s)" % value, mdict) ] > if provides_type == PROVIDES_MIMETYPE: >- return [ "mimehandler(%s)" % value ] >+ return [ ("mimehandler(%s)" % value, mdict) ] > if provides_type == PROVIDES_POSTSCRIPT_DRIVER: >- return [ "postscriptdriver(%s)" % value ] >+ return [ ("postscriptdriver(%s)" % value, mdict) ] > if provides_type == PROVIDES_PLASMA_SERVICE: > # We need to allow the Plasma version to be specified. > if value.startswith("plasma"): >- return [ value ] >+ return [ (value, mdict) ] > # For compatibility, we default to plasma4. >- return [ "plasma4(%s)" % value ] >+ return [ ("plasma4(%s)" % value, mdict) ] > if provides_type == PROVIDES_ANY: > provides = [] > provides.append(self._get_provides_query(PROVIDES_CODEC, value)[0]) >@@ -913,12 +936,33 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage): > provides.append(self._get_provides_query(PROVIDES_MIMETYPE, value)[0]) > provides.append(self._get_provides_query(PROVIDES_POSTSCRIPT_DRIVER, value)[0]) > provides.append(self._get_provides_query(PROVIDES_PLASMA_SERVICE, value)[0]) >- provides.append(value) >+ provides.append((value, mdict)) > return provides > > # not supported > raise PkError(ERROR_NOT_SUPPORTED, "this backend does not support '%s' provides" % provides_type) > >+ def _do_match(self, pkgs, match): >+ result = [] >+ >+ for pkg in pkgs: >+ provides = pkg.returnPrco('provides') >+ for (n, f, (e, v, r)) in provides: >+ mdict = self._make_match_dictionary (n); >+ if mdict == None: >+ continue >+ # we want to propose the package if it exposes a superset of the >+ # requested fields. >+ superset = True >+ for k in mdict: >+ # all keys in the superset must exist in the subset and match >+ if match.get(k) == None or match.get(k) != mdict.get(k): >+ superset = False >+ break >+ if superset: >+ result.append(pkg) >+ return result >+ > def what_provides(self, filters, provides_type, values): > ''' > Implement the what-provides functionality >@@ -945,10 +989,13 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage): > self.error(e.code, e.details, exit=False) > else: > # there may be multiple provide strings >- for provide in values_provides: >+ for (provide, match) in values_provides: > # Check installed packages for provide > try: >- pkgs = self.yumbase.rpmdb.searchProvides(provide) >+ pkgs = self.yumbase.rpmdb.searchAll(provide, 'like') >+ if match != None: >+ pkgs = self._do_match (pkgs, match) >+ > except Exception, e: > self.error(ERROR_INTERNAL_ERROR, _format_str(traceback.format_exc())) > else: >@@ -957,7 +1004,9 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage): > if not FILTER_INSTALLED in filters: > # Check available packages for provide > try: >- pkgs = self.yumbase.pkgSack.searchProvides(provide) >+ pkgs = self.yumbase.pkgSack.searchAll(provide, 'like') >+ if match != None: >+ pkgs = self._do_match (pkgs, match) > except yum.Errors.RepoError, e: > self.error(ERROR_NO_CACHE, "failed to get provides for sack: %s" %_to_unicode(e), exit=False) > return >-- >1.9.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1135558
: 932725