summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/filemap.py
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-06-13 14:21:50 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-14 10:18:28 +0100
commitce7895a61ca9c5b7b85d9cc3a0b05ae66a0d8570 (patch)
tree4fcab88db8c7bbde3fd47e4b4503bf10f0c60776 /scripts/lib/wic/filemap.py
parent0dbe1c78809208b2d6cb2e1901c03733c98f6c36 (diff)
downloadpoky-ce7895a61ca9c5b7b85d9cc3a0b05ae66a0d8570.tar.gz
filemap: fix skip logic
Fixed bug in processing 'skip' parameter: don't read input file if end of bmap block is less than skip Simplified logic of positioning to the start of data inside a partially skipped bmap block. (From OE-Core rev: c19f78a0713c8ac9d28b78f86c6d7b96157788f0) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/filemap.py')
-rw-r--r--scripts/lib/wic/filemap.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 1f1aacc522..585b7ea84e 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -545,11 +545,14 @@ def sparse_copy(src_fname, dst_fname, offset=0, skip=0, api=None):
545 start = first * fmap.block_size 545 start = first * fmap.block_size
546 end = (last + 1) * fmap.block_size 546 end = (last + 1) * fmap.block_size
547 547
548 if skip >= end:
549 continue
550
548 if start < skip < end: 551 if start < skip < end:
549 fmap._f_image.seek(skip, os.SEEK_SET) 552 start = skip
550 else: 553
551 fmap._f_image.seek(start, os.SEEK_SET) 554 fmap._f_image.seek(start, os.SEEK_SET)
552 dst_file.seek(offset + start, os.SEEK_SET) 555 dst_file.seek(offset + start - skip, os.SEEK_SET)
553 556
554 chunk_size = 1024 * 1024 557 chunk_size = 1024 * 1024
555 to_read = end - start 558 to_read = end - start