From 65a53c2bba4c098cb9831e8ca674aeb772418347 Mon Sep 17 00:00:00 2001 From: Huanhuan Li Date: Wed, 21 Aug 2013 07:49:12 +0800 Subject: [PATCH] Fix --pkgmgr=yum does not use cached download packages Change-Id: I81fba9c393a7fd13b0ce22c5c9e8027fa14bf315 Fixes: #1547 --- plugins/backend/yumpkgmgr.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/backend/yumpkgmgr.py b/plugins/backend/yumpkgmgr.py index d4bf31f..93c54cb 100644 --- a/plugins/backend/yumpkgmgr.py +++ b/plugins/backend/yumpkgmgr.py @@ -45,6 +45,10 @@ sslverify=1 """ class MyYumRepository(yum.yumRepo.YumRepository): + def __init__(self, repoid, nocache): + super(MyYumRepository, self).__init__(repoid) + self.nocache = nocache + def __del__(self): pass @@ -264,8 +268,7 @@ class Yum(BackendPlugin, yum.YumBase): option = option.replace("$basearch", rpmUtils.arch.getBaseArch()) option = option.replace("$arch", rpmUtils.arch.getCanonArch()) return option - - repo = MyYumRepository(name) + repo = MyYumRepository(name, nocache) # Set proxy repo.proxy = proxy @@ -284,7 +287,6 @@ class Yum(BackendPlugin, yum.YumBase): repo.setAttribute(k, v) repo.sslverify = ssl_verify - repo.cache = not nocache repo.basecachedir = self.cachedir repo.base_persistdir = self.conf.persistdir @@ -374,7 +376,7 @@ class Yum(BackendPlugin, yum.YumBase): for po in dlpkgs: local = po.localPkg() repo = filter(lambda r: r.id == po.repoid, self.repos.listEnabled())[0] - if not repo.cache and os.path.exists(local): + if repo.nocache and os.path.exists(local): os.unlink(local) if not os.path.exists(local): continue -- 2.7.4