[Yum-devel] [PATCH] preload_from_sys also with --cacheonly, BZ 830523
Zdeněk Pavlas
zpavlas at redhat.com
Mon Jun 11 08:49:37 UTC 2012
Allow creating user dirs, preloading from system cache, and metadata
decompression with --cacheonly option.
This shifts semantic of --cacheonly from "no writes" to "no downloads".
If preloading fails we still err instead of attempting to download.
---
yum/yumRepo.py | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 57a1a29..fb006ff 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -257,8 +257,7 @@ class YumPackageSack(packageSack.PackageSack):
check_can_fail=fast, fast=fast):
return None
- ret = misc.repo_gen_decompress(compressed_fn, db_un_fn,
- cached=repo.cache)
+ ret = misc.repo_gen_decompress(compressed_fn, db_un_fn)
if ret:
return self._check_uncompressed_db_fn(repo, mdtype, ret)
return None
@@ -610,9 +609,6 @@ class YumRepository(Repository, config.RepoConf):
if os.path.exists(dpath) and os.path.isdir(dpath):
return
- if self.cache:
- raise Errors.RepoError, "Cannot access repository dir %s" % dpath
-
try:
os.makedirs(dpath, mode=0755)
except OSError, e:
@@ -1658,6 +1654,12 @@ Insufficient space in download directory %s
# got it, move along
return local
+ if (os.path.exists(local) or
+ self._preload_md_from_system_cache(os.path.basename(local))):
+ if self._checkMD(local, mdtype, check_can_fail=True):
+ self.retrieved[mdtype] = 1
+ return local # it's the same return the local one
+
if self.cache == 1:
if os.path.exists(local):
try:
@@ -1673,12 +1675,6 @@ Insufficient space in download directory %s
"Caching enabled but no local cache of %s from %s" % (local,
self)
- if (os.path.exists(local) or
- self._preload_md_from_system_cache(os.path.basename(local))):
- if self._checkMD(local, mdtype, check_can_fail=True):
- self.retrieved[mdtype] = 1
- return local # it's the same return the local one
-
try:
def checkfunc(obj):
self.checkMD(obj, mdtype)
--
1.7.4.4
More information about the Yum-devel
mailing list