1 |
commit: 9f65889534279731f4b00af243c1edc885eece09 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Dec 27 03:10:16 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Dec 27 03:10:16 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9f658895 |
7 |
|
8 |
merge-sync: handle PyPy syncfs fail, bug #446610 |
9 |
|
10 |
--- |
11 |
pym/portage/dbapi/vartree.py | 23 ++++++++++++++--------- |
12 |
1 files changed, 14 insertions(+), 9 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py |
15 |
index 25128bf..840e796 100644 |
16 |
--- a/pym/portage/dbapi/vartree.py |
17 |
+++ b/pym/portage/dbapi/vartree.py |
18 |
@@ -4731,15 +4731,10 @@ class dblink(object): |
19 |
"merge-sync" not in self.settings.features: |
20 |
return |
21 |
|
22 |
+ syncfs_failed = False |
23 |
syncfs = _get_syncfs() |
24 |
- if syncfs is None: |
25 |
- try: |
26 |
- proc = subprocess.Popen(["sync"]) |
27 |
- except EnvironmentError: |
28 |
- pass |
29 |
- else: |
30 |
- proc.wait() |
31 |
- else: |
32 |
+ |
33 |
+ if syncfs is not None: |
34 |
for path in self._device_path_map.values(): |
35 |
if path is False: |
36 |
continue |
37 |
@@ -4749,12 +4744,22 @@ class dblink(object): |
38 |
pass |
39 |
else: |
40 |
try: |
41 |
- syncfs(fd) |
42 |
+ if syncfs(fd) != 0: |
43 |
+ # Happens with PyPy (bug #446610) |
44 |
+ syncfs_failed = True |
45 |
except OSError: |
46 |
pass |
47 |
finally: |
48 |
os.close(fd) |
49 |
|
50 |
+ if syncfs is None or syncfs_failed: |
51 |
+ try: |
52 |
+ proc = subprocess.Popen(["sync"]) |
53 |
+ except EnvironmentError: |
54 |
+ pass |
55 |
+ else: |
56 |
+ proc.wait() |
57 |
+ |
58 |
def merge(self, mergeroot, inforoot, myroot=None, myebuild=None, cleanup=0, |
59 |
mydbapi=None, prev_mtimes=None, counter=None): |
60 |
""" |