Patchwork license.bbclass: use shutil instead of bb.utils.copyfile

login
register
mail settings
Submitter Ross Burton
Date Oct. 2, 2013, 4:30 p.m.
Message ID <1380731421-948-1-git-send-email-ross.burton@intel.com>
Download mbox | patch
Permalink /patch/59199/
State Accepted
Commit dc81df215cc94c279991df35125d94770a1bc3d2
Headers show

Comments

Ross Burton - Oct. 2, 2013, 4:30 p.m.
bb.utils.copyfile is for a specific purpose and more complicated than needed
here, so just use shutil.copyfile.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/classes/license.bbclass |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Patch

diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 0160313..6abdae4 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -128,12 +128,14 @@  def add_package_and_files(d):
             d.setVar('RRECOMMENDS_' + pn, "%s" % (pn_lic))
 
 def copy_license_files(lic_files_paths, destdir):
+    import shutil
+
     bb.utils.mkdirhier(destdir)
     for (basename, path) in lic_files_paths:
-        ret = bb.utils.copyfile(path, os.path.join(destdir, basename))
-        # If the copy didn't occur, something horrible went wrong and we fail out
-        if not ret:
-            bb.warn("%s could not be copied for some reason. It may not exist. WARN for now." % path)
+        try:
+            ret = shutil.copyfile(path, os.path.join(destdir, basename))
+        except Exception as e:
+            bb.warn("Could not copy license file %s: %s" % (basename, e))
 
 def find_license_files(d):
     """