summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-06-13 14:22:05 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-14 10:18:29 +0100
commitd5e3c917032a59bbe93969ed0bbb4659089dfec4 (patch)
treeca24add94f97ba60bc8fbd5ca7ce1812620e5364 /scripts
parentb67fd459d2d11c1f09c1c66f6ea0898266439f67 (diff)
downloadpoky-d5e3c917032a59bbe93969ed0bbb4659089dfec4.tar.gz
filemap: calculate dst size correctly
Fixed calculation of the dst file size using skip, seek and length parameters. Current code does it incorrectly which causes sparse_copy API to create unnecessary big output files. (From OE-Core rev: e6d709a6382e4b913612f597e66ad07b0e351d5f) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/filemap.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 764dbbe588..6d11355a18 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -549,7 +549,11 @@ def sparse_copy(src_fname, dst_fname, skip=0, seek=0,
549 dst_file = open(dst_fname, 'r+b') 549 dst_file = open(dst_fname, 'r+b')
550 except IOError: 550 except IOError:
551 dst_file = open(dst_fname, 'wb') 551 dst_file = open(dst_fname, 'wb')
552 dst_file.truncate(os.path.getsize(src_fname)) 552 if length:
553 dst_size = length + seek
554 else:
555 dst_size = os.path.getsize(src_fname) + seek - skip
556 dst_file.truncate(dst_size)
553 557
554 written = 0 558 written = 0
555 for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt): 559 for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt):