aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/license.bbclass
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2017-03-08 14:30:13 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-10 10:15:45 +0000
commitb606e1430c36f1ad528fbfbbf9b8b6243390b879 (patch)
treed7d35bc34b165cbd98cb02d279bbeaea34907446 /meta/classes/license.bbclass
parent5111bd5e666408dbca7db0e6d664fe0103744253 (diff)
downloadopenembedded-core-contrib-b606e1430c36f1ad528fbfbbf9b8b6243390b879.tar.gz
license: don't assume source files are UTF-8
We can't assume that source files are entirely UTF-8, so when copying the license blocks open the file as binary instead of text. [ YOCTO #11135 ] Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/classes/license.bbclass')
-rw-r--r--meta/classes/license.bbclass6
1 files changed, 3 insertions, 3 deletions
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 0ff6560a13..81458e797b 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -386,9 +386,9 @@ def copy_license_files(lic_files_paths, destdir):
if begin_idx is None and end_idx is None:
shutil.copyfile(src, dst)
else:
- with open(src, 'r') as src_f:
- with open(dst, 'w') as dst_f:
- dst_f.write(''.join(src_f.readlines()[begin_idx:end_idx]))
+ with open(src, 'rb') as src_f:
+ with open(dst, 'wb') as dst_f:
+ dst_f.write(b''.join(src_f.readlines()[begin_idx:end_idx]))
except Exception as e:
bb.warn("Could not copy license file %s to %s: %s" % (src, dst, e))