Explorar el Código

devtool: use cp instead of shutil.copytree

Copied layers with 'cp -a' instead of calling shutil.copytree as
copytree fails to copy broken symlinks.

More pythonic fix would be to use copytree with 'ignore' parameter,
but this could slow down copying complex directory structures.

[YOCTO #8825]

(From OE-Core rev: e5b841420b9fdd33829f7665a62cd06a3017f7e6)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Ed Bartosh hace 9 años
padre
commit
23302ee03a
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      scripts/lib/devtool/sdk.py

+ 4 - 1
scripts/lib/devtool/sdk.py

@@ -128,7 +128,10 @@ def sdk_update(args, config, basepath, workspace):
         new_layers_dir = os.path.join(args.updateserver, 'layers')
         old_layers_dir = os.path.join(basepath, 'layers')
         shutil.rmtree(old_layers_dir)
-        shutil.copytree(new_layers_dir, old_layers_dir)
+        ret = subprocess.call("cp -a %s %s" % (new_layers_dir, old_layers_dir), shell=True)
+        if ret != 0:
+            logger.error("Copying %s to %s failed" % (new_layers_dir, old_layers_dir))
+            return ret
     else:
         # devtool sdk-update http://myhost/sdk
         tmpsdk_dir = '/tmp/sdk-ext'