All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] wic: plugins: rawcopy: Fixed wrong variable type
@ 2017-03-07 13:41 Daniel Schultz
  2017-03-07 13:41 ` [PATCH 2/2] wic: filemap: Fixed spared_copy skip Daniel Schultz
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Schultz @ 2017-03-07 13:41 UTC (permalink / raw)
  To: openembedded-core

Without the int() function this variable will be a string. This will led
to a error in Filemap on line 545 due wrong types.

> [...]
>   File
> ".../poky/scripts/lib/wic/filemap.py", line 545, in sparse_copy
>     if start < skip < end:
> TypeError: unorderable types: int() < str()

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
 scripts/lib/wic/plugins/source/rawcopy.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py
index 5bd22fd..618dd44 100644
--- a/scripts/lib/wic/plugins/source/rawcopy.py
+++ b/scripts/lib/wic/plugins/source/rawcopy.py
@@ -71,7 +71,7 @@ class RawCopyPlugin(SourcePlugin):
         dst = os.path.join(cr_workdir, "%s.%s" % (source_params['file'], part.lineno))
 
         if 'skip' in source_params:
-            sparse_copy(src, dst, skip=source_params['skip'])
+            sparse_copy(src, dst, skip=int(source_params['skip']))
         else:
             sparse_copy(src, dst)
 
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] wic: filemap: Fixed spared_copy skip
  2017-03-07 13:41 [PATCH 1/2] wic: plugins: rawcopy: Fixed wrong variable type Daniel Schultz
@ 2017-03-07 13:41 ` Daniel Schultz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Schultz @ 2017-03-07 13:41 UTC (permalink / raw)
  To: openembedded-core

This patches removes the empty space in front of the copied file which
was skipped. Without this reduction it's not possible to place a
partition with rawcopy and skip parameter on a desired alignment.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
 scripts/lib/wic/filemap.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index f3240ba..162603e 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -543,9 +543,9 @@ def sparse_copy(src_fname, dst_fname, offset=0, skip=0):
         end = (last + 1) * fmap.block_size
 
         if start < skip < end:
-            start = skip
-
-        fmap._f_image.seek(start, os.SEEK_SET)
+            fmap._f_image.seek(skip, os.SEEK_SET)
+        else:
+            fmap._f_image.seek(start, os.SEEK_SET)
         dst_file.seek(offset + start, os.SEEK_SET)
 
         chunk_size = 1024 * 1024
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-07 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-07 13:41 [PATCH 1/2] wic: plugins: rawcopy: Fixed wrong variable type Daniel Schultz
2017-03-07 13:41 ` [PATCH 2/2] wic: filemap: Fixed spared_copy skip Daniel Schultz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.