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

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