]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic/rawcopy: Support files in sub-directories
authorEugene Smirnov <eu.smirnoff@gmail.com>
Fri, 18 Oct 2019 11:16:14 +0000 (13:16 +0200)
committerArmin Kuster <akuster808@gmail.com>
Sat, 26 Oct 2019 06:44:34 +0000 (23:44 -0700)
If the source file is located in a subdirectory of DEPLOY_DIR
rawcopy will currently fail in sparse_copy function on
open(dst_fname, 'wb'), as the parent directory for destination
file does not exist.

This patch helps to avoid that by recursively creating
parent directories.

Signed-off-by: Eugene Smirnov <evgenii.smirnov@here.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 073c435644091c2801e45c6d02afa917de575082)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
scripts/lib/wic/plugins/source/rawcopy.py

index df86d6729c68603ee7e357cf9131bbd183a9a2c9..82970ce51bc1912702754ad9ff32e9d03cea3b38 100644 (file)
@@ -59,6 +59,9 @@ class RawCopyPlugin(SourcePlugin):
         src = os.path.join(kernel_dir, source_params['file'])
         dst = os.path.join(cr_workdir, "%s.%s" % (source_params['file'], part.lineno))
 
+        if not os.path.exists(os.path.dirname(dst)):
+            os.makedirs(os.path.dirname(dst))
+
         if 'skip' in source_params:
             sparse_copy(src, dst, skip=int(source_params['skip']))
         else: