Control: tags -1 + patch

I had a look at how to modify the source to fix this.  Here is an
untested patch to implement support for provides in the generated
metadata XML file.  Unfortunately I lacked the required free disk space
to do a test build.  I did not add the provides to the editor metadata
entry, assuming that it is most relevant for the two other components.

diff --git a/src/calibre/linux.py b/src/calibre/linux.py
index bd0b6f9..b81215e 100644
--- a/src/calibre/linux.py
+++ b/src/calibre/linux.py
@@ -1157,6 +1157,10 @@ def get_appdata():
                 _('calibre is the one stop solution to all your e-book 
needs.'),
                 _('You can use calibre to catalog your books, fetch metadata 
for them automatically, convert them from and to all the various e-book 
formats, send them to your e-book reader devices, read the books on your 
computer, edit the books in a dedicated e-book editor and even make them 
available over the network with the built-in Content server. You can also 
download news and periodicals in e-book format from over a thousand different 
news and magazine websites.')  # noqa
             ),
+            'provides': [
+                {'modalias': 'usb:v2237p*d*ic08isc*ip*'},
+                {'modalias': 'usb:v0525pA4A5d*ic08isc*ip*'},
+            ],
             'screenshots':(
                 (1408, 792, 
'https://lh4.googleusercontent.com/-bNE1hc_3pIc/UvHLwKPGBPI/AAAAAAAAASA/8oavs_c6xoU/w1408-h792-no/main-default.png',),
                 (1408, 792, 
'https://lh4.googleusercontent.com/-Zu2httSKABE/UvHMYK30JJI/AAAAAAAAATg/dQTQUjBvV5s/w1408-h792-no/main-grid.png'),
@@ -1188,6 +1192,10 @@ def get_appdata():
                 _('The calibre E-book viewer allows you to read e-books in 
over a dozen different formats.'),
                 _('It has a full screen mode for distraction free reading and 
can display the text with multiple columns per screen.'),
             ),
+            'provides': [
+                {'modalias': 'usb:v2237p*d*ic08isc*ip*'},
+                {'modalias': 'usb:v0525pA4A5d*ic08isc*ip*'},
+            ],
             'screenshots':(
                 (1408, 792, 
'https://lh5.googleusercontent.com/-dzSO82BPpaE/UvHMYY5SpNI/AAAAAAAAATk/I_kF9fYWrZM/w1408-h792-no/viewer-default.png',),
                 (1920, 1080, 
'https://lh6.googleusercontent.com/-n32Ae5RytAk/UvHMY0QD94I/AAAAAAAAATs/Zw8Yz08HIKk/w1920-h1080-no/viewer-fs.png'),
@@ -1260,7 +1268,7 @@ def make_appdata_releases():
 
 def write_appdata(key, entry, base, translators):
     from lxml.builder import E
-    from lxml.etree import tostring
+    from lxml.etree import Element, tostring
     fpath = os.path.join(base, '%s.metainfo.xml' % key)
     screenshots = E.screenshots()
     for w, h, url in entry['screenshots']:
@@ -1300,6 +1308,14 @@ def write_appdata(key, entry, base, translators):
         tp = t.gettext(entry['summary'])
         if tp != entry['summary']:
             root.append(E.summary(tp, 
**{'{http://www.w3.org/XML/1998/namespace}lang': lang}))
+    if 0 < len(entry.get('provides', [])):
+        provides = E.provides()
+        for p in entry['provides']:
+            for tag in p.keys():
+                provided = Elements(tag)
+                provided.text = p[tag]
+                provides.append(provided)
+        root.append(provides)
     if entry.get('include-releases', False):
         try:
             root.append(make_appdata_releases())

-- 
Happy hacking
Petter Reinholdtsen

Reply via email to