summaryrefslogtreecommitdiffstats
path: root/pym/portage/locks.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-03-03 09:49:30 +0000
committerZac Medico <zmedico@gentoo.org>2007-03-03 09:49:30 +0000
commit46cb74fbac6d2636f84e6e38982e088893427bed (patch)
treedb70fa86b04d20854a2901950fcafaa4881d6253 /pym/portage/locks.py
parent0a7f8edb5017eae4e639cd771530054aa9cf9d8b (diff)
downloadportage-46cb74fbac6d2636f84e6e38982e088893427bed.tar.gz
portage-46cb74fbac6d2636f84e6e38982e088893427bed.tar.bz2
portage-46cb74fbac6d2636f84e6e38982e088893427bed.zip
For bug #138840, show a more informative message when waiting for a distfiles lock due to parallel-fetch. Thanks to David Watzke <david@watzke.cz> for the initial patch.
svn path=/main/trunk/; revision=6143
Diffstat (limited to 'pym/portage/locks.py')
-rw-r--r--pym/portage/locks.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/pym/portage/locks.py b/pym/portage/locks.py
index 3def88a38..cbf7ee4b5 100644
--- a/pym/portage/locks.py
+++ b/pym/portage/locks.py
@@ -17,7 +17,7 @@ def lockdir(mydir):
def unlockdir(mylock):
return unlockfile(mylock)
-def lockfile(mypath,wantnewlockfile=0,unlinkfile=0):
+def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, waiting_msg=None):
"""Creates all dirs upto, the given dir. Creates a lockfile
for the given directory as the file: directoryname+'.portage_lockfile'."""
import fcntl
@@ -76,10 +76,13 @@ def lockfile(mypath,wantnewlockfile=0,unlinkfile=0):
raise
if e.errno == errno.EAGAIN:
# resource temp unavailable; eg, someone beat us to the lock.
- if type(mypath) == types.IntType:
- print "waiting for lock on fd %i" % myfd
- else:
- print "waiting for lock on %s" % lockfilename
+ if waiting_msg is None:
+ if isinstance(mypath, int):
+ print "waiting for lock on fd %i" % myfd
+ else:
+ print "waiting for lock on %s" % lockfilename
+ elif waiting_msg:
+ print waiting_msg
# try for the exclusive lock now.
fcntl.lockf(myfd,fcntl.LOCK_EX)
elif e.errno == errno.ENOLCK: