yifengyou / rpms / yum

Forked from rpms/yum 3 years ago
Clone

Blame SOURCES/BZ-1208803-autosavets.patch

5e9bef
commit 8d5248c4ab3e8efab00537da8f35a77b86f3c333
5e9bef
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
5e9bef
Date:   Fri May 6 11:30:56 2016 +0200
5e9bef
5e9bef
    Add autosavets option allowing to avoid autosaving transactions. BZ 1208803
5e9bef
5e9bef
diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
5e9bef
index efc6765..4d53c8e 100644
5e9bef
--- a/docs/yum.conf.5
5e9bef
+++ b/docs/yum.conf.5
5e9bef
@@ -897,6 +897,12 @@ Note that if loadts_ignorerpm is True, this option does nothing.
5e9bef
 Boolean (1, 0, True, False, yes, no) Defaults to False
5e9bef
 
5e9bef
 .IP
5e9bef
+\fBautosavets\fR
5e9bef
+Should yum automatically save a transaction to a file when the transaction is
5e9bef
+solved but not run.
5e9bef
+Boolean (1, 0, True, False, yes, no) Defaults to True
5e9bef
+
5e9bef
+.IP
5e9bef
 \fBfssnap_automatic_pre\fR
5e9bef
 Should yum try to automatically create a snapshot before it runs a transaction.
5e9bef
 Boolean (1, 0, True, False, yes, no) Defaults to False
5e9bef
diff --git a/yum/__init__.py b/yum/__init__.py
5e9bef
index c896fff..764e97d 100644
5e9bef
--- a/yum/__init__.py
5e9bef
+++ b/yum/__init__.py
5e9bef
@@ -1355,7 +1355,8 @@ much more problems).
5e9bef
             self._depsolving_failed = False
5e9bef
 
5e9bef
         if rescode == 2:
5e9bef
-            self.save_ts(auto=True)
5e9bef
+            if self.conf.autosavets:
5e9bef
+                self.save_ts(auto=True)
5e9bef
 
5e9bef
         # Make sure we don't fail in rpm if we're installing a package that is
5e9bef
         # allowed multiple installs but has a newer version already installed.
5e9bef
diff --git a/yum/config.py b/yum/config.py
5e9bef
index 84be564..cae914d 100644
5e9bef
--- a/yum/config.py
5e9bef
+++ b/yum/config.py
5e9bef
@@ -893,6 +893,7 @@ class YumConf(StartupConf):
5e9bef
     loadts_ignoremissing = BoolOption(False)
5e9bef
     loadts_ignorerpm = BoolOption(False)
5e9bef
     loadts_ignorenewrpm = BoolOption(False)
5e9bef
+    autosavets = BoolOption(True)
5e9bef
     
5e9bef
     clean_requirements_on_remove = BoolOption(False)
5e9bef
 
5e9bef
diff -up yum-3.4.3/test/testbase.py.old yum-3.4.3/test/testbase.py
5e9bef
--- yum-3.4.3/test/testbase.py.old	2016-05-10 16:58:02.812286775 +0200
5e9bef
+++ yum-3.4.3/test/testbase.py	2016-05-10 16:58:43.590544423 +0200
5e9bef
@@ -69,6 +69,7 @@ class FakeConf(object):
5e9bef
         self.diskspacecheck = True
5e9bef
         self.depsolve_loop_limit = 10
5e9bef
         self.override_install_langs = ''
5e9bef
+        self.autosavets = True
5e9bef
 
5e9bef
 class FakeSack:
5e9bef
     """ Fake PackageSack to use with FakeRepository"""