Blame SOURCES/BZ-1432319-add-usercache-opt.patch

d2a170
diff -up yum-3.4.3/cli.py.orig yum-3.4.3/cli.py
d2a170
--- yum-3.4.3/cli.py.orig	2017-10-20 18:27:45.114593690 +0200
d2a170
+++ yum-3.4.3/cli.py	2017-10-20 18:27:48.367578901 +0200
d2a170
@@ -2275,8 +2275,10 @@ class YumOptionParser(OptionParser):
d2a170
             self.base.updateinfo_filters['cves'] = self._splitArg(opts.cves)
d2a170
             self.base.updateinfo_filters['sevs'] = self._splitArg(opts.sevs)
d2a170
 
d2a170
+            if not self.base.conf.usercache and os.geteuid() != 0:
d2a170
+                self.base.conf.cache = 1
d2a170
             #  Treat users like root as much as possible:
d2a170
-            if not self.base.setCacheDir():
d2a170
+            elif not self.base.setCacheDir():
d2a170
                 self.base.conf.cache = 1
d2a170
             if opts.cacheonly:
d2a170
                 self.base.conf.cache = 1
d2a170
diff -up yum-3.4.3/docs/yum.8.orig yum-3.4.3/docs/yum.8
d2a170
--- yum-3.4.3/docs/yum.8.orig	2017-10-20 18:27:45.135593595 +0200
d2a170
+++ yum-3.4.3/docs/yum.8	2017-10-20 18:27:48.368578897 +0200
d2a170
@@ -835,8 +835,12 @@ Configuration Option: \fBrpmverbosity\fP
d2a170
 .IP "\fB\-R, \-\-randomwait=[time in minutes]\fP" 
d2a170
 Sets the maximum amount of time yum will wait before performing a command \- it randomizes over the time.
d2a170
 .IP "\fB\-C, \-\-cacheonly\fP" 
d2a170
-Tells yum to run entirely from system cache - does not download or
d2a170
-update any headers unless it has to to perform the requested action.
d2a170
+Tells yum to run entirely from system cache; does not download or update
d2a170
+metadata.
d2a170
+When this is used by a non\-root user, yum will run entirely from user cache in
d2a170
+$TMPDIR.
d2a170
+This option doesn't stop yum from updating user cache from system cache locally
d2a170
+if the latter is newer (this is always done when running as a user).
d2a170
 .IP "\fB\-\-version\fP" 
d2a170
 Reports the \fByum\fP version number and installed package versions for
d2a170
 everything in history_record_packages (can be added to by plugins).
d2a170
diff -up yum-3.4.3/docs/yum.conf.5.orig yum-3.4.3/docs/yum.conf.5
d2a170
--- yum-3.4.3/docs/yum.conf.5.orig	2017-10-20 18:27:45.137593585 +0200
d2a170
+++ yum-3.4.3/docs/yum.conf.5	2017-10-20 18:27:48.368578897 +0200
d2a170
@@ -40,6 +40,19 @@ of headers and packages after successful
d2a170
 .br
d2a170
 
d2a170
 .IP
d2a170
+\fBusercache\fR
d2a170
+Either `1' or `0'. Determines whether or not yum should store per-user cache in
d2a170
+$TMPDIR.
d2a170
+When set to `0', then whenever yum runs as a non\-root user,
d2a170
+\fB\-\-cacheonly\fR is implied and system cache is used directly, and no new
d2a170
+user cache is created in $TMPDIR.
d2a170
+This can be used to prevent $TMPDIR from filling up if many users on the system
d2a170
+often use yum and root tends to have up-to-date metadata that the users can
d2a170
+rely on (they can still enable this feature with \fB\-\-setopt\fR if they
d2a170
+wish).
d2a170
+Default is `1' (user cache enabled).
d2a170
+
d2a170
+.IP
d2a170
 \fBreposdir\fR
d2a170
 A list of directories where yum should look for .repo files which define
d2a170
 repositories to use. Default is `/etc/yum.repos.d'. Each
d2a170
diff -up yum-3.4.3/yum/config.py.orig yum-3.4.3/yum/config.py
d2a170
--- yum-3.4.3/yum/config.py.orig	2017-10-20 18:27:45.136593590 +0200
d2a170
+++ yum-3.4.3/yum/config.py	2017-10-20 18:27:48.369578892 +0200
d2a170
@@ -742,6 +742,7 @@ class YumConf(StartupConf):
d2a170
     cachedir = Option('/var/cache/yum')
d2a170
 
d2a170
     keepcache = BoolOption(True)
d2a170
+    usercache = BoolOption(True)
d2a170
     logfile = Option('/var/log/yum.log')
d2a170
     reposdir = ListOption(['/etc/yum/repos.d', '/etc/yum.repos.d'])
d2a170
 
d2a170
diff -up yum-3.4.3/yummain.py.orig yum-3.4.3/yummain.py
d2a170
--- yum-3.4.3/yummain.py.orig	2017-10-20 18:27:45.062593926 +0200
d2a170
+++ yum-3.4.3/yummain.py	2017-10-20 18:27:48.369578892 +0200
d2a170
@@ -71,7 +71,12 @@ def main(args):
d2a170
     def exRepoError(e):
d2a170
         # For RepoErrors ... help out by forcing new repodata next time.
d2a170
         # XXX: clean only the repo that has failed?
d2a170
-        base.cleanExpireCache()
d2a170
+        try:
d2a170
+            base.cleanExpireCache()
d2a170
+        except Errors.YumBaseError:
d2a170
+            # Let's not confuse the user further (they don't even know we tried
d2a170
+            # the clean).
d2a170
+            pass
d2a170
 
d2a170
         msg = _("""\
d2a170
  One of the configured repositories failed (%(repo)s),