Lines 3418-3423
class dblink(object):
Link Here
|
3418 |
|
3418 |
|
3419 |
os = _os_merge |
3419 |
os = _os_merge |
3420 |
|
3420 |
|
|
|
3421 |
real_relative_paths = {} |
3422 |
|
3421 |
collision_ignore = [] |
3423 |
collision_ignore = [] |
3422 |
for x in portage.util.shlex_split( |
3424 |
for x in portage.util.shlex_split( |
3423 |
self.settings.get("COLLISION_IGNORE", "")): |
3425 |
self.settings.get("COLLISION_IGNORE", "")): |
Lines 3469-3476
class dblink(object):
Link Here
|
3469 |
previous = current |
3471 |
previous = current |
3470 |
progress_shown = True |
3472 |
progress_shown = True |
3471 |
|
3473 |
|
3472 |
dest_path = normalize_path( |
3474 |
src_path = normalize_path(os.path.join(srcroot, f.lstrip(os.path.sep))) |
3473 |
os.path.join(destroot, f.lstrip(os.path.sep))) |
3475 |
dest_path = normalize_path(os.path.join(destroot, f.lstrip(os.path.sep))) |
|
|
3476 |
|
3477 |
# Relative path with symbolic links resolved only in parent directories |
3478 |
real_relative_path = os.path.join(os.path.realpath(os.path.dirname(dest_path)), os.path.basename(dest_path))[len(destroot):] |
3479 |
|
3480 |
# Automatic resolution of selected types of internal collisions |
3481 |
src_file_deleted = False |
3482 |
for other_colliding_file in real_relative_paths.get(real_relative_path, []): |
3483 |
if src_file_deleted: |
3484 |
break |
3485 |
if f_type == "sym": |
3486 |
# When symbolic link collides with its target, then |
3487 |
# this symbolic link is dropped. |
3488 |
symlink_target = _unicode_decode(_os.readlink(_unicode_encode(src_path, |
3489 |
encoding=_encodings["merge"], errors="strict")), |
3490 |
encoding=_encodings["merge"], errors="replace") |
3491 |
if os.path.isabs(symlink_target): |
3492 |
if normalize_path(symlink_target.lstrip(os.path.sep)) == other_colliding_file: |
3493 |
os.unlink(src_path) |
3494 |
src_file_deleted = True |
3495 |
else: |
3496 |
if normalize_path(os.path.join(parent, symlink_target).lstrip(os.path.sep)) == other_colliding_file: |
3497 |
os.unlink(src_path) |
3498 |
src_file_deleted = True |
3499 |
if src_file_deleted: |
3500 |
continue |
3501 |
|
3502 |
real_relative_paths.setdefault(real_relative_path, []).append(f.lstrip(os.path.sep)) |
3474 |
|
3503 |
|
3475 |
parent = os.path.dirname(dest_path) |
3504 |
parent = os.path.dirname(dest_path) |
3476 |
if parent not in dirs: |
3505 |
if parent not in dirs: |
Lines 3556-3564
class dblink(object):
Link Here
|
3556 |
break |
3585 |
break |
3557 |
if stopmerge: |
3586 |
if stopmerge: |
3558 |
collisions.append(f) |
3587 |
collisions.append(f) |
|
|
3588 |
|
3589 |
internal_collisions = {} |
3590 |
for k, v in real_relative_paths.items(): |
3591 |
if len(v) >= 2: |
3592 |
internal_collisions[k] = v |
3593 |
|
3559 |
if progress_shown: |
3594 |
if progress_shown: |
3560 |
showMessage(_("100% done\n")) |
3595 |
showMessage(_("100% done\n")) |
3561 |
return collisions, dirs_ro, symlink_collisions, plib_collisions |
3596 |
|
|
|
3597 |
return collisions, internal_collisions, dirs_ro, symlink_collisions, plib_collisions |
3562 |
|
3598 |
|
3563 |
def _lstat_inode_map(self, path_iter): |
3599 |
def _lstat_inode_map(self, path_iter): |
3564 |
""" |
3600 |
""" |
Lines 4081-4087
class dblink(object):
Link Here
|
4081 |
if blocker.exists(): |
4117 |
if blocker.exists(): |
4082 |
blockers.append(blocker) |
4118 |
blockers.append(blocker) |
4083 |
|
4119 |
|
4084 |
collisions, dirs_ro, symlink_collisions, plib_collisions = \ |
4120 |
collisions, internal_collisions, dirs_ro, symlink_collisions, plib_collisions = \ |
4085 |
self._collision_protect(srcroot, destroot, |
4121 |
self._collision_protect(srcroot, destroot, |
4086 |
others_in_slot + blockers, filelist, linklist) |
4122 |
others_in_slot + blockers, filelist, linklist) |
4087 |
|
4123 |
|
Lines 4109-4114
class dblink(object):
Link Here
|
4109 |
eerror(msg) |
4145 |
eerror(msg) |
4110 |
return 1 |
4146 |
return 1 |
4111 |
|
4147 |
|
|
|
4148 |
if internal_collisions: |
4149 |
msg = _("Package '%s' has internal collisions (between files " |
4150 |
"in separate directories in the installation image (${D}) " |
4151 |
"corresponding to merged directories in the target " |
4152 |
"filesystem (${ROOT})):") % self.settings.mycpv |
4153 |
msg = textwrap.wrap(msg, 70) |
4154 |
msg.append("") |
4155 |
for k, v in sorted(internal_collisions.items()): |
4156 |
msg.append("\t%s" % os.path.join(destroot, k.lstrip(os.path.sep))) |
4157 |
for f in sorted(v): |
4158 |
msg.append("\t\t%s" % os.path.join(destroot, f.lstrip(os.path.sep))) |
4159 |
msg.append("") |
4160 |
self._elog("eerror", "preinst", msg) |
4161 |
|
4162 |
msg = _("Package '%s' NOT merged due to internal collisions.") % \ |
4163 |
self.settings.mycpv |
4164 |
msg += _(" If necessary, refer to your elog messages for the whole " |
4165 |
"content of the above message.") |
4166 |
eerror(textwrap.wrap(msg, 70)) |
4167 |
return 1 |
4168 |
|
4112 |
if symlink_collisions: |
4169 |
if symlink_collisions: |
4113 |
# Symlink collisions need to be distinguished from other types |
4170 |
# Symlink collisions need to be distinguished from other types |
4114 |
# of collisions, in order to avoid confusion (see bug #409359). |
4171 |
# of collisions, in order to avoid confusion (see bug #409359). |
4115 |
- |
|
|