unsquashfs: Do not ignore rsync failures

This commit is contained in:
Aurélien Gâteau 2014-08-06 15:10:51 +02:00
parent b246a95606
commit b5c3928609

View File

@ -80,6 +80,10 @@ def file_copy(source, dest, progress_cb):
# I guess we're updating every 100 files... # I guess we're updating every 100 files...
if num_files_copied % 100 == 0: if num_files_copied % 100 == 0:
progress_cb(num_files_copied) progress_cb(num_files_copied)
process.wait()
if process.returncode != 0:
return "rsync failed with error code {}.".format(process.returncode)
return None
class UnsquashOperation: class UnsquashOperation:
@ -116,7 +120,11 @@ class UnsquashOperation:
imgmountdir = os.path.join(source_mount_path, imgbasename) imgmountdir = os.path.join(source_mount_path, imgbasename)
os.mkdir(imgmountdir) os.mkdir(imgmountdir)
self.report_progress() self.report_progress()
self.unsquash_image(entry, imgmountdir) error_msg = self.unsquash_image(entry, imgmountdir)
if error_msg:
return ("Failed to unsquash {}".format(entry.source),
error_msg)
return None
finally: finally:
shutil.rmtree(source_mount_path) shutil.rmtree(source_mount_path)
@ -130,7 +138,7 @@ class UnsquashOperation:
imgmountdir, imgmountdir,
"-t", "squashfs", "-o", "loop"]) "-t", "squashfs", "-o", "loop"])
try: try:
file_copy(imgmountdir, return file_copy(imgmountdir,
entry.destination, entry.destination,
progress_cb) progress_cb)
finally: finally: