diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-06-13 14:22:05 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-14 10:18:21 +0100 |
commit | e6d709a6382e4b913612f597e66ad07b0e351d5f (patch) | |
tree | b457a1dffc2476da113187112f020c2d32be705e /scripts/lib | |
parent | 289b1767182982dfb6912e64481150697ba93e4d (diff) | |
download | openembedded-core-e6d709a6382e4b913612f597e66ad07b0e351d5f.tar.gz openembedded-core-e6d709a6382e4b913612f597e66ad07b0e351d5f.tar.bz2 openembedded-core-e6d709a6382e4b913612f597e66ad07b0e351d5f.zip |
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.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/wic/filemap.py | 6 |
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, dst_file = open(dst_fname, 'r+b') except IOError: dst_file = open(dst_fname, 'wb') - dst_file.truncate(os.path.getsize(src_fname)) + if length: + dst_size = length + seek + else: + dst_size = os.path.getsize(src_fname) + seek - skip + dst_file.truncate(dst_size) written = 0 for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt): |