On Thu, 2007-07-26 at 10:41 -0400, Jeremy Katz wrote:
> Per a suggestion on fedora-devel-list from Hans de Goede, the following
> makes it so that we don't immediately exit on the command line if the
> lock is held by another process. Instead, we spin checking every two
> seconds to see if the lock has been released. This helps in the case
> where, eg, yum-updatesd is downloading metadata so that you don't have
> to guess when it's done. And if you don't want to wait, ctrl-c exits
> immediately.
>
> Other opinions/thoughts?
Seth thinks it helps when I actually attach the patch. I can't
disagree.
Jeremy
diff --git a/yum/__init__.py b/yum/__init__.py
index 2ab4bb2..3868838 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -656,7 +656,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):
diff --git a/yummain.py b/yummain.py
index 8be78f4..1775484 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("Waiting for lock to be released...")
+ time.sleep(2)
+ else:
+ break
try:
result, resultmsgs = base.doCommands()
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel