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

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