[Matthias Klumpp]
>> Thanks. What kind of versioned dependency should the package get?
>
> gir1.2-appstream >= 0.10
> That should do it :-)
Hm, perhaps better to make sure the code work both with new and old API,
to ease backporting? What do you think about this approach:
diff --git a/isenkram/lookup.py b/isenkram/lookup.py
index d56bacc..9702b04 100644
--- a/isenkram/lookup.py
+++ b/isenkram/lookup.py
@@ -94,10 +94,15 @@ def pkgs_handling_appstream_modaliases(modaliaslist):
thepkgs = {}
gi.require_version('AppStream', '1.0')
from gi.repository import AppStream
- db = AppStream.Database()
- db.open()
-
- cpts = db.get_all_components()
+ try:
+ pool = AppStream.Pool()
+ pool.load()
+ cpts = pool.get_components()
+ except AttributeError:
+ # Handle old API too (before version 0.10)
+ db = AppStream.Database()
+ db.open()
+ cpts = db.get_all_components()
ma_cpts = list()
for cpt in cpts:
provided = cpt.get_provided_for_kind(AppStream.ProvidedKind.MODALIAS)
When I run it in unstable I do not quite get the result I hoped for:
% python ./isenkram/lookup.py
Locating packages supporting this hardware (AppStream):
./isenkram/lookup.py:181: Warning: g_object_unref: assertion 'G_IS_OBJECT
(object)' failed
for pkg in sorted(pkgs_handling_appstream_modaliases(hwaliases)):
./isenkram/lookup.py:181: Warning: g_object_get_qdata: assertion 'G_IS_OBJECT
(object)' failed
for pkg in sorted(pkgs_handling_appstream_modaliases(hwaliases)):
./isenkram/lookup.py:181: Warning: g_object_set_qdata_full: assertion
'G_IS_OBJECT (object)' failed
for pkg in sorted(pkgs_handling_appstream_modaliases(hwaliases)):
Locating packages supporting this hardware (extra, svn/local):
bluez
cheese
fprintd
fprintd-demo
gkrellm-thinkbat
hdapsd
libpam-fprintd
pidgin-blinklight
thinkfan
tleds
tp-smapi-dkms
tp-smapi-source
tpb
Locating packages supporting this hardware (APT control field):
%
Any ideas what is wrong here?
PS: Please remember cc to bts.
--
Happy hacking
Petter Reinholdtsen