summaryrefslogtreecommitdiffstats
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)
downloadpoky-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):
482 sys.exit(1) 482 sys.exit(1)
483 483
484def check_patch(patchfile): 484def check_patch(patchfile):
485 f = open(patchfile) 485 f = open(patchfile, 'rb')
486 ln = f.readline() 486 ln = f.readline()
487 of = None 487 of = None
488 in_patch = False 488 in_patch = False
489 beyond_msg = False 489 beyond_msg = False
490 pre_buf = '' 490 pre_buf = b''
491 while ln: 491 while ln:
492 if not beyond_msg: 492 if not beyond_msg:
493 if ln == '---\n': 493 if ln == b'---\n':
494 if not of: 494 if not of:
495 break 495 break
496 in_patch = False 496 in_patch = False
497 beyond_msg = True 497 beyond_msg = True
498 elif ln.startswith('--- '): 498 elif ln.startswith(b'--- '):
499 # We have a diff in the commit message 499 # We have a diff in the commit message
500 in_patch = True 500 in_patch = True
501 if not of: 501 if not of:
502 print('WARNING: %s contains a diff in its commit message, indenting to avoid failure during apply' % patchfile) 502 print('WARNING: %s contains a diff in its commit message, indenting to avoid failure during apply' % patchfile)
503 of = open(patchfile + '.tmp', 'w') 503 of = open(patchfile + '.tmp', 'wb')
504 of.write(pre_buf) 504 of.write(pre_buf)
505 pre_buf = '' 505 pre_buf = b''
506 elif in_patch and not ln[0] in '+-@ \n\r': 506 elif in_patch and not ln[0] in b'+-@ \n\r':
507 in_patch = False 507 in_patch = False
508 if of: 508 if of:
509 if in_patch: 509 if in_patch:
510 of.write(' ' + ln) 510 of.write(b' ' + ln)
511 else: 511 else:
512 of.write(ln) 512 of.write(ln)
513 else: 513 else: