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

diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index 607e9fc..d6fe824 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -622,6 +622,10 @@ When installing/reinstalling/upgrading packages go through 
each package's
 installed dependencies and check for an update.
 Boolean (1, 0, True, False, yes,no) Defaults to False
 
+.IP
+\fBreset_nice \fR
+If set to true then yum will try to reset the nice value to zero, before
+running an rpm transaction. Defaults to False.
 
 
 .SH "[repository] OPTIONS"
diff --git a/yum/__init__.py b/yum/__init__.py
index 53043de..3ede145 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1603,10 +1603,23 @@ class YumBase(depsolve.Depsolve):
                 pass
         self._ts_save_file = None
         
+        if self.conf.reset_nice:
+            onice = os.nice(0)
+            if onice:
+                try:
+                    os.nice(-onice)
+                except:
+                    onice = 0
+
         errors = self.ts.run(cb.callback, '')
         # ts.run() exit codes are, hmm, "creative": None means all ok, empty 
         # list means some errors happened in the transaction and non-empty 
         # list that there were errors preventing the ts from starting...
+        if self.conf.reset_nice:
+            try:
+                os.nice(onice)
+            except:
+                pass
         
         # make resultobject - just a plain yumgenericholder object
         resultobject = misc.GenericHolder()
diff --git a/yum/config.py b/yum/config.py
index fffd0d1..f9789de 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -720,6 +720,7 @@ class YumConf(StartupConf):
     """
     retries = PositiveIntOption(10, names_of_0=["<forever>"])
     recent = IntOption(7, range_min=0)
+    reset_nice = BoolOption(False)
 
     cachedir = Option('/var/cache/yum')
 
-- 
1.7.6.4

_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to