[yum-cvs] 2 commits - yum/__init__.py yummain.py

Jeremy Katz katzj at linux.duke.edu
Tue Aug 7 21:47:00 UTC 2007


 yum/__init__.py |    2 +-
 yummain.py      |   18 +++++++++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 037dd4695c22411131e929de2d22cda9d50e616b
Author: Jeremy Katz <katzj at redhat.com>
Date:   Tue Aug 7 14:45:47 2007 -0400

    Wait for the lock to be released rather than exiting immediately.
    
    Give the user feedback about what's going on, but wait for the lock to be
    released in case the user ran the command and walked away while, eg,
    yum-updatesd is updating metadata.  Based on a suggestion from Hans de Goede

diff --git a/yummain.py b/yummain.py
index 8be78f4..3034d36 100755
--- a/yummain.py
+++ b/yummain.py
@@ -84,11 +84,19 @@ def main(args):
         exPluginExit(e)
     except Errors.YumBaseError, e:
         exFatal(e)
-    try:
-        base.doLock()
-    except Errors.LockError, e:
-        logger.critical('%s', e.msg)
-        sys.exit(200)
+
+    lockerr = ""
+    while True:
+        try:
+            base.doLock()
+        except Errors.LockError, e:
+            if "%s" %(e.msg,) != lockerr:
+                lockerr = "%s" %(e.msg,)
+                logger.critical(lockerr)
+            logger.critical("Another app is currently holding the yum lock; waiting for it to exit...")
+            time.sleep(2)
+        else:
+            break
 
     try:
         result, resultmsgs = base.doCommands()
commit 3235e4b2f76470f1bdd29f84724b08e86d9a0031
Author: Jeremy Katz <katzj at redhat.com>
Date:   Tue Aug 7 14:44:43 2007 -0400

    deciding to abort when the lock is held depends on the caller

diff --git a/yum/__init__.py b/yum/__init__.py
index dbe4432..80a9e52 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -672,7 +672,7 @@ class YumBase(depsolve.Depsolve):
                         raise Errors.LockError(1, msg)
                 else:
                     # Another copy seems to be running.
-                    msg = 'Existing lock %s: another copy is running as pid %s. Aborting.' % (lockfile, oldpid)
+                    msg = 'Existing lock %s: another copy is running as pid %s.' % (lockfile, oldpid)
                     raise Errors.LockError(0, msg)
     
     def doUnlock(self, lockfile = YUM_PID_FILE):



More information about the Yum-cvs-commits mailing list