diff --git a/pisi/atomicoperations.py b/pisi/atomicoperations.py index 5fe99692..790f0dac 100644 --- a/pisi/atomicoperations.py +++ b/pisi/atomicoperations.py @@ -293,13 +293,17 @@ class Install(AtomicOperation): # of these files may be relocated to some other directory in the new package. # We handle these cases here. def relocate_files(): - for old_file, new_file in find_relocations(self.old_files, self.files): - destdir = "/" + os.path.dirname(new_file.path) + old_path, new_path = ("/" + old_file.path, "/" + new_file.path) + + destdir = os.path.dirname(new_path) if not os.path.exists(destdir): os.makedirs(destdir) - shutil.copy("/" + old_file.path, "/" + new_file.path) + if os.path.islink(old_path): + os.symlink(os.readlink(old_path), new_path) + else: + shutil.copy(old_path, new_path) # remove left over files from the old package. def clean_leftovers(): diff --git a/pisi/delta.py b/pisi/delta.py index 1996d7c7..1cf33b5e 100644 --- a/pisi/delta.py +++ b/pisi/delta.py @@ -44,10 +44,6 @@ def create_delta_package(old_package, new_package): tar = archive.ArchiveTar(util.join_path(newpkg_path, ctx.const.install_tar_lzma), 'tarlzma', False, False) tar.unpack_dir(newpkg_path) - # symlinks should be in delta package - symlinks = filter(lambda x:os.path.islink(util.join_path(newpkg_path, x.path)), newfiles.list) - files_delta = set(files_delta + symlinks) - # Create delta package deltaname = "%s-%s-%s%s" % (oldmd.package.name, oldmd.package.release, newmd.package.release, ".delta.pisi") @@ -121,10 +117,9 @@ def find_relocations(oldfiles, newfiles): relocations = [] for hash in files_new.keys(): - if hash in files_old and files_new[hash][0].path != files_old[hash][0].path: - # symlinks are not relocated, they already come with the delta package - if not os.path.islink("/" + files_old[hash][0].path): - for i in range(len(files_new[hash])): + if hash in files_old: + for i in range(len(files_new[hash])): + if files_old[hash][0].path != files_new[hash][i].path: relocations.append((files_old[hash][0], files_new[hash][i])) return relocations