aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-08-24 13:16:15 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-24 13:58:28 +0100
commita81b326933d15f08e06780f92d8dc0d4efb3cd23 (patch)
tree751a68c69325fc5e64bbc4aad819eac700984de1
parent94646f4828c2aa11a89996763edaa2e9d57106a9 (diff)
downloadopenembedded-core-contrib-a81b326933d15f08e06780f92d8dc0d4efb3cd23.tar.gz
combo-layer: python3: fix UnicodeDecodeError
check_patch function opens patch file in text mode. This causes python3 to throw exception when calling readline(): UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa7 in position NNNN: invalid start byte Opening file in binary mode and using binary type instead of strings should fix this. (From OE-Core rev: a7f1435c4c26237cdb55066c9f5408b4fdf016aa) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xscripts/combo-layer16
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 8f57ba58cf..b90bfc8800 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -482,32 +482,32 @@ def check_repo_clean(repodir):
sys.exit(1)
def check_patch(patchfile):
- f = open(patchfile)
+ f = open(patchfile, 'rb')
ln = f.readline()
of = None
in_patch = False
beyond_msg = False
- pre_buf = ''
+ pre_buf = b''
while ln:
if not beyond_msg:
- if ln == '---\n':
+ if ln == b'---\n':
if not of:
break
in_patch = False
beyond_msg = True
- elif ln.startswith('--- '):
+ elif ln.startswith(b'--- '):
# We have a diff in the commit message
in_patch = True
if not of:
print('WARNING: %s contains a diff in its commit message, indenting to avoid failure during apply' % patchfile)
- of = open(patchfile + '.tmp', 'w')
+ of = open(patchfile + '.tmp', 'wb')
of.write(pre_buf)
- pre_buf = ''
- elif in_patch and not ln[0] in '+-@ \n\r':
+ pre_buf = b''
+ elif in_patch and not ln[0] in b'+-@ \n\r':
in_patch = False
if of:
if in_patch:
- of.write(' ' + ln)
+ of.write(b' ' + ln)
else:
of.write(ln)
else: