Fix a bug in rsync
authorNikos Skalkotos <skalkoto@grnet.gr>
Mon, 24 Dec 2012 12:23:32 +0000 (14:23 +0200)
committerNikos Skalkotos <skalkoto@grnet.gr>
Mon, 24 Dec 2012 12:23:32 +0000 (14:23 +0200)
The exclude patterns should contain relative to the source paths

image_creator/bundle_volume.py
image_creator/rsync.py

index fde1e00..5b94c1c 100644 (file)
@@ -349,7 +349,8 @@ class BundleVolume():
                     [(mapped[i], filesystems[i].mpoint) for i in mapped.keys()]
                 )
                 exclude = self._to_exclude() + [image]
                     [(mapped[i], filesystems[i].mpoint) for i in mapped.keys()]
                 )
                 exclude = self._to_exclude() + [image]
-                rsync = Rsync('/', target, exclude)
+                rsync = Rsync('/', target,
+                              map(lambda p: os.path.relpath(p, '/'), exclude))
                 msg = "Copying host files into the image"
                 rsync.archive().run(self.out, msg)
 
                 msg = "Copying host files into the image"
                 rsync.archive().run(self.out, msg)
 
index 22d3ad7..7c869c2 100644 (file)
@@ -55,7 +55,6 @@ class Rsync:
         dry_run = subprocess.Popen(cmd + ['-n', self.src, self.dest],
                                    shell=False, stdout=subprocess.PIPE,
                                    bufsize=0)
         dry_run = subprocess.Popen(cmd + ['-n', self.src, self.dest],
                                    shell=False, stdout=subprocess.PIPE,
                                    bufsize=0)
-        print "%r" % (cmd + ['-n', self.src, self.dest])
         total = 0
         for line in iter(dry_run.stdout.readline, b''):
             total += 1
         total = 0
         for line in iter(dry_run.stdout.readline, b''):
             total += 1