Reuse cached rpm between yum and zypp, making the same package dir for them
authorGui Chen <gui.chen@intel.com>
Mon, 27 Feb 2012 12:04:27 +0000 (20:04 +0800)
committerGui Chen <gui.chen@intel.com>
Mon, 27 Feb 2012 12:10:56 +0000 (20:10 +0800)
Signed-off-by: Gui Chen <gui.chen@intel.com>
plugins/backend/yumpkgmgr.py
plugins/backend/zypppkgmgr.py

index 4fb0b17..b855034 100644 (file)
@@ -46,6 +46,13 @@ class MyYumRepository(yum.yumRepo.YumRepository):
     def __del__(self):
         pass
 
+    def dirSetup(self):
+        super(MyYumRepository, self).dirSetup()
+        # relocate package dir
+        pkgdir = os.path.join(self.basecachedir, 'packages', self.id)
+        self.setAttribute('_dir_setup_pkgdir', pkgdir)
+        self._dirSetupMkdir_p(self.pkgdir)
+
     def _getFile(self, url=None,
                        relative=None,
                        local=None,
index 2064cd7..13f7759 100755 (executable)
@@ -548,7 +548,7 @@ class Zypp(BackendPlugin):
         cacheroot = repoinfo.packagesPath()
         location= zypp.asKindPackage(po).location()
         rpmpath = str(location.filename())
-        pkgpath = "%s/%s" % (cacheroot, rpmpath)
+        pkgpath = "%s/%s" % (cacheroot, os.path.basename(rpmpath))
         return pkgpath
 
     def installLocal(self, pkg, po=None, updateonly=False):