summaryrefslogtreecommitdiffstats
path: root/pym/portage/dbapi
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-10-25 12:48:56 -0700
committerZac Medico <zmedico@gentoo.org>2012-10-25 12:48:56 -0700
commit690312722e111cf813b591dd4dccb4400f5f7f79 (patch)
treecd4a185cc8b88efed5197e3d6b2d71f8db11aeeb /pym/portage/dbapi
parent3f2451c0901ee75e3e4e0f11628a0a3a981eff88 (diff)
downloadportage-690312722e111cf813b591dd4dccb4400f5f7f79.tar.gz
portage-690312722e111cf813b591dd4dccb4400f5f7f79.tar.bz2
portage-690312722e111cf813b591dd4dccb4400f5f7f79.zip
merge-sync: handle unmerge corner cases
In dblink_merged_path we need to distinguish between existing and non-existing, since we need an existing path of syncfs.
Diffstat (limited to 'pym/portage/dbapi')
-rw-r--r--pym/portage/dbapi/vartree.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 5bcd07797..aae23e6ba 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -2156,7 +2156,7 @@ class dblink(object):
# here so that _unmerge_dirs can see that we've
# removed a file from this device, and will record
# the parent directory for a syncfs call.
- self._merged_path(file_name, lstatobj)
+ self._merged_path(file_name, lstatobj, exists=False)
finally:
if bsd_chflags and pflags != 0:
@@ -4706,10 +4706,17 @@ class dblink(object):
outfile.write("dev %s\n" % myrealdest)
showMessage(zing + " " + mydest + "\n")
- def _merged_path(self, path, lstatobj):
+ def _merged_path(self, path, lstatobj, exists=True):
previous_path = self._device_path_map.get(lstatobj.st_dev)
- if previous_path is None or len(path) < len(previous_path):
- self._device_path_map[lstatobj.st_dev] = path
+ if previous_path is None or previous_path is False or \
+ (exists and len(path) < len(previous_path)):
+ if exists:
+ self._device_path_map[lstatobj.st_dev] = path
+ else:
+ # This entry is used to indicate that we've unmerged
+ # a file from this device, and later, this entry is
+ # replaced by a parent directory.
+ self._device_path_map[lstatobj.st_dev] = False
def _post_merge_sync(self):
"""
@@ -4731,6 +4738,8 @@ class dblink(object):
proc.wait()
else:
for path in self._device_path_map.values():
+ if path is False:
+ continue
try:
fd = os.open(path, os.O_RDONLY)
except OSError: