diff options
author | Ross Burton <ross.burton@intel.com> | 2017-03-08 14:30:13 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-10 14:50:11 +0000 |
commit | 0ed537f95b4675ea47a2d51d073f4836c9cea809 (patch) | |
tree | 54739b83020b4c032e0641e76f99d0af0ea4f853 /meta/classes | |
parent | 519255fd73ff0b70e56d44b9f7017cde62f939cc (diff) | |
download | poky-0ed537f95b4675ea47a2d51d073f4836c9cea809.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 ]
(From OE-Core rev: b606e1430c36f1ad528fbfbbf9b8b6243390b879)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/license.bbclass | 6 |
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): | |||
386 | if begin_idx is None and end_idx is None: | 386 | if begin_idx is None and end_idx is None: |
387 | shutil.copyfile(src, dst) | 387 | shutil.copyfile(src, dst) |
388 | else: | 388 | else: |
389 | with open(src, 'r') as src_f: | 389 | with open(src, 'rb') as src_f: |
390 | with open(dst, 'w') as dst_f: | 390 | with open(dst, 'wb') as dst_f: |
391 | dst_f.write(''.join(src_f.readlines()[begin_idx:end_idx])) | 391 | dst_f.write(b''.join(src_f.readlines()[begin_idx:end_idx])) |
392 | 392 | ||
393 | except Exception as e: | 393 | except Exception as e: |
394 | bb.warn("Could not copy license file %s to %s: %s" % (src, dst, e)) | 394 | bb.warn("Could not copy license file %s to %s: %s" % (src, dst, e)) |