summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-12-07 20:17:27 +0000
committerZac Medico <zmedico@gentoo.org>2008-12-07 20:17:27 +0000
commitd8d481249099cdb0f486d99548686782d870542e (patch)
tree74d19d7888eb3f614e1f60c0aa806599fca92fce
parentIf pkg_nofetch needs to be spawned inside fetch() and it happens that (diff)
downloadportage-multirepo-d8d481249099cdb0f486d99548686782d870542e.tar.gz
portage-multirepo-d8d481249099cdb0f486d99548686782d870542e.tar.bz2
portage-multirepo-d8d481249099cdb0f486d99548686782d870542e.zip
Bug #249586 - Use writemsg() to send output to stderr instead of stdout.v2.1.6
(trunk r12176) svn path=/main/branches/2.1.6/; revision=12177
-rw-r--r--pym/portage/locks.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/pym/portage/locks.py b/pym/portage/locks.py
index 4be13c11..fc877928 100644
--- a/pym/portage/locks.py
+++ b/pym/portage/locks.py
@@ -3,6 +3,9 @@
# Distributed under the terms of the GNU General Public License v2
# $Id$
+__all__ = ["lockdir", "unlockdir", "lockfile", "unlockfile", \
+ "hardlock_name", "hardlink_is_mine", "hardlink_lockfile", \
+ "unhardlink_lockfile", "hardlock_cleanup"]
import errno, os, stat, time, types
from portage.exception import DirectoryNotFound, FileNotFound, \
@@ -93,11 +96,13 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0,
pass
elif waiting_msg is None:
if isinstance(mypath, int):
- print "waiting for lock on fd %i" % myfd
+ writemsg("waiting for lock on fd %i\n" % myfd,
+ noiselevel=-1)
else:
- print "waiting for lock on %s" % lockfilename
+ writemsg("waiting for lock on %s\n" % lockfilename,
+ noiselevel=-1)
elif waiting_msg:
- print waiting_msg
+ writemsg(waiting_msg + "\n", noiselevel=-1)
# try for the exclusive lock now.
fcntl.lockf(myfd,fcntl.LOCK_EX)
elif e.errno == errno.ENOLCK:
@@ -256,19 +261,19 @@ def hardlink_lockfile(lockfilename, max_wait=14400):
if hardlink_is_mine(myhardlock, lockfilename):
# We have the lock.
if reported_waiting:
- print
+ writemsg("\n", noiselevel=-1)
return True
if reported_waiting:
- writemsg(".")
+ writemsg(".", noiselevel=-1)
else:
reported_waiting = True
from portage.const import PORTAGE_BIN_PATH
- print
- print "Waiting on (hardlink) lockfile: (one '.' per 3 seconds)"
- print "This is a feature to prevent distfiles corruption."
- print "%s/clean_locks can fix stuck locks." % PORTAGE_BIN_PATH
- print "Lockfile: " + lockfilename
+ msg = "\nWaiting on (hardlink) lockfile:" + \
+ " (one '.' per 3 seconds)\n" + \
+ "%s/clean_locks can fix stuck locks.\n" % PORTAGE_BIN_PATH + \
+ "Lockfile: %s\n" % lockfilename
+ writemsg(msg, noiselevel=-1)
time.sleep(3)
os.unlink(myhardlock)