Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r12177 - main/branches/2.1.6/pym/portage
Date: Sun, 07 Dec 2008 20:17:30
Message-Id: E1L9Q4G-0004z0-Ch@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-12-07 20:17:27 +0000 (Sun, 07 Dec 2008)
3 New Revision: 12177
4
5 Modified:
6 main/branches/2.1.6/pym/portage/locks.py
7 Log:
8 Bug #249586 - Use writemsg() to send output to stderr instead of stdout.
9 (trunk r12176)
10
11
12 Modified: main/branches/2.1.6/pym/portage/locks.py
13 ===================================================================
14 --- main/branches/2.1.6/pym/portage/locks.py 2008-12-07 20:14:36 UTC (rev 12176)
15 +++ main/branches/2.1.6/pym/portage/locks.py 2008-12-07 20:17:27 UTC (rev 12177)
16 @@ -3,6 +3,9 @@
17 # Distributed under the terms of the GNU General Public License v2
18 # $Id$
19
20 +__all__ = ["lockdir", "unlockdir", "lockfile", "unlockfile", \
21 + "hardlock_name", "hardlink_is_mine", "hardlink_lockfile", \
22 + "unhardlink_lockfile", "hardlock_cleanup"]
23
24 import errno, os, stat, time, types
25 from portage.exception import DirectoryNotFound, FileNotFound, \
26 @@ -93,11 +96,13 @@
27 pass
28 elif waiting_msg is None:
29 if isinstance(mypath, int):
30 - print "waiting for lock on fd %i" % myfd
31 + writemsg("waiting for lock on fd %i\n" % myfd,
32 + noiselevel=-1)
33 else:
34 - print "waiting for lock on %s" % lockfilename
35 + writemsg("waiting for lock on %s\n" % lockfilename,
36 + noiselevel=-1)
37 elif waiting_msg:
38 - print waiting_msg
39 + writemsg(waiting_msg + "\n", noiselevel=-1)
40 # try for the exclusive lock now.
41 fcntl.lockf(myfd,fcntl.LOCK_EX)
42 elif e.errno == errno.ENOLCK:
43 @@ -256,19 +261,19 @@
44 if hardlink_is_mine(myhardlock, lockfilename):
45 # We have the lock.
46 if reported_waiting:
47 - print
48 + writemsg("\n", noiselevel=-1)
49 return True
50
51 if reported_waiting:
52 - writemsg(".")
53 + writemsg(".", noiselevel=-1)
54 else:
55 reported_waiting = True
56 from portage.const import PORTAGE_BIN_PATH
57 - print
58 - print "Waiting on (hardlink) lockfile: (one '.' per 3 seconds)"
59 - print "This is a feature to prevent distfiles corruption."
60 - print "%s/clean_locks can fix stuck locks." % PORTAGE_BIN_PATH
61 - print "Lockfile: " + lockfilename
62 + msg = "\nWaiting on (hardlink) lockfile:" + \
63 + " (one '.' per 3 seconds)\n" + \
64 + "%s/clean_locks can fix stuck locks.\n" % PORTAGE_BIN_PATH + \
65 + "Lockfile: %s\n" % lockfilename
66 + writemsg(msg, noiselevel=-1)
67 time.sleep(3)
68
69 os.unlink(myhardlock)