zypp: search package provides info in selectPackage
authorZhang Qiang <qiang.z.zhang@intel.com>
Wed, 14 Sep 2011 14:07:30 +0000 (22:07 +0800)
committerJF Ding <Jian-feng.Ding@intel.com>
Thu, 15 Sep 2011 07:50:21 +0000 (16:50 +0900)
This patch provide the ability to search package provides info while
selecting packages.

plugins/backend/zypppkgmgr.py

index a29d826..394c355 100644 (file)
@@ -123,6 +123,21 @@ class Zypp(BackendPlugin):
             kind = "%s" % item.kind()
             if kind == "package":
                 name = "%s" % item.name()
+                resolvable = item.resolvable()
+                try:
+                    caps = resolvable.provides().CapNames().split(':')
+                    for cap in caps:
+                        if cap.split('=')[0].strip() == pkg:
+                            found = True
+                            if name not in self.packages:
+                                self.packages.append(name)
+                                item.status().setToBeInstalled (zypp.ResStatus.USER)
+                            break
+                    if found == True:
+                        break
+                except AttributeError:
+                    msger.warning('python-zypp in host system cannot support CapNames interface, please'
+                            ' update it to enhanced version which can be found in repo.meego.com/tools')
                 if not ispattern:
                     if name in self.incpkgs or self.excpkgs:
                         found = True