[Uludag-commits] r12286 - trunk/pisi/pisi

svn-uludag at uludag.org.tr svn-uludag at uludag.org.tr
7 Şub 2007 Çar 12:23:45 EET


Author: faik
Date: Wed Feb  7 12:23:45 2007
New Revision: 12286

Modified:
   trunk/pisi/pisi/atomicoperations.py
   trunk/pisi/pisi/delta.py
Log:
* alright, dont add symlinks to delta package, we can handle them.

* also some code cleanups



Modified: trunk/pisi/pisi/atomicoperations.py
=================================================================
--- trunk/pisi/pisi/atomicoperations.py	(original)
+++ trunk/pisi/pisi/atomicoperations.py	Wed Feb  7 12:23:45 2007
@@ -293,13 +293,17 @@
         # 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():

Modified: trunk/pisi/pisi/delta.py
=================================================================
--- trunk/pisi/pisi/delta.py	(original)
+++ trunk/pisi/pisi/delta.py	Wed Feb  7 12:23:45 2007
@@ -44,10 +44,6 @@
     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 @@
 
     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


Uludag-commits mesaj listesiyle ilgili daha fazla bilgi