mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
recipetool: create: avoid decoding errors with Python 3
We're opening source files with the default encoding (utf-8) but we can't necessarily be sure that they are UTF-8 clean - for example, recipetool create ftp://mama.indstate.edu/linux/tree/tree-1.7.0.tgz prior to this patch resulted in a UnicodeDecodeError. Use the "surrogateescape" mode to avoid this. Fixes [YOCTO #9822]. (From OE-Core rev: 50fcd9d1b9a20d49bc873467a82a071f2f2f8b5a) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
74c5cd0c2c
commit
75f1a0ed42
@@ -390,7 +390,7 @@ def create_recipe(args):
|
||||
srcsubdir = dirlist[0]
|
||||
srctree = os.path.join(srctree, srcsubdir)
|
||||
else:
|
||||
with open(singleitem, 'r') as f:
|
||||
with open(singleitem, 'r', errors='surrogateescape') as f:
|
||||
if '<html' in f.read(100).lower():
|
||||
logger.error('Fetching "%s" returned a single HTML page - check the URL is correct and functional' % fetchuri)
|
||||
sys.exit(1)
|
||||
@@ -840,7 +840,7 @@ def crunch_license(licfile):
|
||||
# https://github.com/FFmpeg/FFmpeg/blob/master/COPYING.LGPLv3
|
||||
crunched_md5sums['2ebfb3bb49b9a48a075cc1425e7f4129'] = 'LGPLv3'
|
||||
lictext = []
|
||||
with open(licfile, 'r') as f:
|
||||
with open(licfile, 'r', errors='surrogateescape') as f:
|
||||
for line in f:
|
||||
# Drop opening statements
|
||||
if copyright_re.match(line):
|
||||
@@ -978,7 +978,7 @@ def convert_debian(debpath):
|
||||
|
||||
values = {}
|
||||
depends = []
|
||||
with open(os.path.join(debpath, 'control')) as f:
|
||||
with open(os.path.join(debpath, 'control'), 'r', errors='surrogateescape') as f:
|
||||
indesc = False
|
||||
for line in f:
|
||||
if indesc:
|
||||
|
||||
Reference in New Issue
Block a user