summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuanhuan Li <huanhuanx.li@intel.com>2013-08-21 07:49:12 +0800
committerHuanhuan Li <huanhuanx.li@intel.com>2013-08-21 13:30:59 +0800
commit65a53c2bba4c098cb9831e8ca674aeb772418347 (patch)
tree5964623f0983beb8bb36660eb1ea3af70cb74415
parentdd49037385eb0a58e9364f3579c055786b0961d1 (diff)
downloadmic-65a53c2bba4c098cb9831e8ca674aeb772418347.tar.gz
mic-65a53c2bba4c098cb9831e8ca674aeb772418347.tar.bz2
mic-65a53c2bba4c098cb9831e8ca674aeb772418347.zip
Fix --pkgmgr=yum does not use cached download packages
Change-Id: I81fba9c393a7fd13b0ce22c5c9e8027fa14bf315 Fixes: #1547
-rw-r--r--plugins/backend/yumpkgmgr.py10
1 files 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