1 |
Author: zmedico |
2 |
Date: 2008-03-27 04:33:23 +0000 (Thu, 27 Mar 2008) |
3 |
New Revision: 9515 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.2/bin/emerge |
7 |
main/branches/2.1.2/pym/portage_locks.py |
8 |
Log: |
9 |
Make --noreplace take precedence over --newuse, as suggested by wolf31o2. |
10 |
(trunk r9512:9514) |
11 |
|
12 |
|
13 |
Modified: main/branches/2.1.2/bin/emerge |
14 |
=================================================================== |
15 |
--- main/branches/2.1.2/bin/emerge 2008-03-27 04:28:08 UTC (rev 9514) |
16 |
+++ main/branches/2.1.2/bin/emerge 2008-03-27 04:33:23 UTC (rev 9515) |
17 |
@@ -1635,6 +1635,7 @@ |
18 |
return 0 |
19 |
del e |
20 |
|
21 |
+ noreplace = "--noreplace" in self.myopts |
22 |
reinstall_for_flags = None |
23 |
merging=1 |
24 |
if mytype == "installed": |
25 |
@@ -1648,7 +1649,7 @@ |
26 |
""" If we aren't merging, perform the --newuse check. |
27 |
If the package has new iuse flags or different use flags then if |
28 |
--newuse is specified, we need to merge the package. """ |
29 |
- if merging == 0 and \ |
30 |
+ if not noreplace and merging == 0 and \ |
31 |
myroot == self.target_root and \ |
32 |
("--newuse" in self.myopts or |
33 |
"--reinstall" in self.myopts) and \ |
34 |
|
35 |
Modified: main/branches/2.1.2/pym/portage_locks.py |
36 |
=================================================================== |
37 |
--- main/branches/2.1.2/pym/portage_locks.py 2008-03-27 04:28:08 UTC (rev 9514) |
38 |
+++ main/branches/2.1.2/pym/portage_locks.py 2008-03-27 04:33:23 UTC (rev 9515) |
39 |
@@ -79,7 +79,7 @@ |
40 |
except IOError, e: |
41 |
if "errno" not in dir(e): |
42 |
raise |
43 |
- if e.errno == errno.EAGAIN: |
44 |
+ if e.errno in (errno.EACCES, errno.EAGAIN): |
45 |
# resource temp unavailable; eg, someone beat us to the lock. |
46 |
if waiting_msg is None: |
47 |
if isinstance(mypath, int): |
48 |
@@ -111,7 +111,7 @@ |
49 |
|
50 |
|
51 |
if type(lockfilename) == types.StringType and \ |
52 |
- myfd != HARDLINK_FD and os.fstat(myfd).st_nlink == 0: |
53 |
+ myfd != HARDLINK_FD and _fstat_nlink(myfd) == 0: |
54 |
# The file was deleted on us... Keep trying to make one... |
55 |
os.close(myfd) |
56 |
portage_util.writemsg("lockfile recurse\n",1) |
57 |
@@ -122,6 +122,22 @@ |
58 |
portage_util.writemsg(str((lockfilename,myfd,unlinkfile))+"\n",1) |
59 |
return (lockfilename,myfd,unlinkfile,locking_method) |
60 |
|
61 |
+def _fstat_nlink(fd): |
62 |
+ """ |
63 |
+ @param fd: an open file descriptor |
64 |
+ @type fd: Integer |
65 |
+ @rtype: Integer |
66 |
+ @return: the current number of hardlinks to the file |
67 |
+ """ |
68 |
+ try: |
69 |
+ return os.fstat(fd).st_nlink |
70 |
+ except EnvironmentError, e: |
71 |
+ if e.errno == errno.ENOENT: |
72 |
+ # Some filesystems such as CIFS return |
73 |
+ # ENOENT which means st_nlink == 0. |
74 |
+ return 0 |
75 |
+ raise |
76 |
+ |
77 |
def unlockfile(mytuple): |
78 |
import fcntl |
79 |
|
80 |
@@ -167,7 +183,7 @@ |
81 |
# We won the lock, so there isn't competition for it. |
82 |
# We can safely delete the file. |
83 |
portage_util.writemsg("Got the lockfile...\n",1) |
84 |
- if os.fstat(myfd).st_nlink == 1: |
85 |
+ if _fstat_nlink(myfd) == 1: |
86 |
os.unlink(lockfilename) |
87 |
portage_util.writemsg("Unlinked lockfile...\n",1) |
88 |
locking_method(myfd,fcntl.LOCK_UN) |
89 |
|
90 |
-- |
91 |
gentoo-commits@l.g.o mailing list |