install the according debuginfo rpms in zypp
authorGui Chen <gui.chen@intel.com>
Mon, 21 Jan 2013 12:00:44 +0000 (20:00 +0800)
committerGui Chen <gui.chen@intel.com>
Mon, 21 Jan 2013 17:38:02 +0000 (01:38 +0800)
normally every binary package would have one
corresponding debuginfo package, and now mic
can install those debuginfo rpm in the meantime
in zypp backend if needed

Change-Id: Id3d4dd678257d21a737632a395031b0776c3d2bc
Signed-off-by: Gui Chen <gui.chen@intel.com>
plugins/backend/yumpkgmgr.py
plugins/backend/zypppkgmgr.py

index 2bba9f8..8f85f9d 100644 (file)
@@ -127,6 +127,8 @@ class Yum(BackendPlugin, yum.YumBase):
         self.__pkgs_license = {}
         self.__pkgs_content = {}
 
+        self.install_debuginfo = False
+
     def doFileLogSetup(self, uid, logfile):
         # don't do the file log for the livecd as it can lead to open fds
         # being left and an inability to clean up after ourself
index 28573d7..28872dd 100755 (executable)
@@ -77,6 +77,7 @@ class Zypp(BackendPlugin):
                                  rpm.RPMPROB_FILTER_REPLACEPKG ]
 
         self.has_prov_query = True
+        self.install_debuginfo = False
 
     def doFileLogSetup(self, uid, logfile):
         # don't do the file log for the livecd as it can lead to open fds
@@ -133,6 +134,15 @@ class Zypp(BackendPlugin):
             return pi
         return None
 
+    def _zyppQueryPackage(self, pkg):
+        query = zypp.PoolQuery()
+        query.addKind(zypp.ResKind.package)
+        query.addAttribute(zypp.SolvAttr.name,pkg)
+        query.setMatchExact()
+        for pi in query.queryResults(self.Z.pool()):
+            return pi
+        return None
+
     def _splitPkgString(self, pkg):
         sp = pkg.rsplit(".",1)
         name = sp[0]
@@ -422,9 +432,19 @@ class Zypp(BackendPlugin):
         dlpkgs = []
         for item in installed_pkgs:
             if not zypp.isKindPattern(item) and \
-               not self.inDeselectPackages(item):
+              not self.inDeselectPackages(item):
                 dlpkgs.append(item)
 
+                if not self.install_debuginfo or str(item.arch()) == "noarch":
+                    continue
+
+                dipkg = self._zyppQueryPackage("%s-debuginfo" % item.name())
+                if dipkg:
+                    dlpkgs.append(dipkg)
+                else:
+                    msger.warning("No debuginfo rpm found for: %s" \
+                                  % item.name())
+
         # record all pkg and the content
         localpkgs = self.localpkgs.keys()
         for pkg in dlpkgs: