[PATCH] Add per-repository "keepcache" option. BZ 1001072

Zdenek Pavlas zpavlas at redhat.com
Thu Aug 29 13:29:10 UTC 2013


---
 docs/yum.conf.5 | 4 ++++
 yum/__init__.py | 5 +++--
 yum/config.py   | 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index 8a7de80..fcacbae 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -914,6 +914,10 @@ value of mirrorlist is copied to metalink (if metalink is not set).
 Either `1' or `0'. This tells yum whether or not use this repository.
 
 .IP
+\fBkeepcache\fR
+Overrides the \fBkeepcache\fR option from the [main] section for this repository.
+
+.IP
 \fBgpgcheck\fR
 Either `1' or `0'. This tells yum whether or not it should perform a GPG
 signature check on the packages gotten from this repository.
diff --git a/yum/__init__.py b/yum/__init__.py
index a43f493..06631c3 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1845,8 +1845,7 @@ much more problems).
                                           errors=errors)
 
                           
-        if (not self.conf.keepcache and
-            not self.ts.isTsFlagSet(rpm.RPMTRANS_FLAG_TEST)):
+        if not self.ts.isTsFlagSet(rpm.RPMTRANS_FLAG_TEST):
             self.cleanUsedHeadersPackages()
         
         for i in ('ts_all_fn', 'ts_done_fn'):
@@ -2686,6 +2685,8 @@ much more problems).
                 continue
             if txmbr.po.repoid not in self.repos.repos:
                 continue
+            if txmbr.po.repo.keepcache:
+                continue
             
             # make sure it's not a local file
             repo = self.repos.repos[txmbr.po.repoid]
diff --git a/yum/config.py b/yum/config.py
index 1d446c0..3bc5bd1 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -942,6 +942,7 @@ class RepoConf(BaseConfig):
 
     name = Option()
     enabled = Inherit(YumConf.enabled)
+    keepcache = Inherit(YumConf.keepcache)
     baseurl = UrlListOption()
     mirrorlist = UrlOption()
     metalink   = UrlOption()
-- 
1.7.11.7



More information about the Yum-devel mailing list