combo-layer: fix crashes on wrong tempfile usage
When calling tempfile.NamedTemporaryFile().write(str()), at least on Python 3.4.2 this fails with this error: TypeError: 'str' does not support the buffer interface Change the file-mode for all such files from binary to text mode. (From OE-Core rev: d08f3882a35eec8a042d2501715684444e353605) Signed-off-by: Olaf Mandel <o.mandel@menlosystems.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
7e5b59d7af
commit
050b8969ab
|
@ -329,7 +329,7 @@ def action_init(conf, args):
|
||||||
# one. The commit should be in both repos with
|
# one. The commit should be in both repos with
|
||||||
# the same tree, but better check here.
|
# the same tree, but better check here.
|
||||||
tree = runcmd('git show -s --pretty=format:%%T %s' % rev).strip()
|
tree = runcmd('git show -s --pretty=format:%%T %s' % rev).strip()
|
||||||
with tempfile.NamedTemporaryFile() as editor:
|
with tempfile.NamedTemporaryFile(mode='wt') as editor:
|
||||||
editor.write('''cat >$1 <<EOF
|
editor.write('''cat >$1 <<EOF
|
||||||
tree %s
|
tree %s
|
||||||
author %s
|
author %s
|
||||||
|
@ -353,7 +353,7 @@ EOF
|
||||||
# Optional: rewrite history to change commit messages or to move files.
|
# Optional: rewrite history to change commit messages or to move files.
|
||||||
if 'hook' in repo or dest_dir != ".":
|
if 'hook' in repo or dest_dir != ".":
|
||||||
filter_branch = ['git', 'filter-branch', '--force']
|
filter_branch = ['git', 'filter-branch', '--force']
|
||||||
with tempfile.NamedTemporaryFile() as hookwrapper:
|
with tempfile.NamedTemporaryFile(mode='wt') as hookwrapper:
|
||||||
if 'hook' in repo:
|
if 'hook' in repo:
|
||||||
# Create a shell script wrapper around the original hook that
|
# Create a shell script wrapper around the original hook that
|
||||||
# can be used by git filter-branch. Hook may or may not have
|
# can be used by git filter-branch. Hook may or may not have
|
||||||
|
@ -1137,7 +1137,7 @@ def update_with_history(conf, components, revisions, repos):
|
||||||
if hook:
|
if hook:
|
||||||
# Need to turn the verbatim commit message into something resembling a patch header
|
# Need to turn the verbatim commit message into something resembling a patch header
|
||||||
# for the hook.
|
# for the hook.
|
||||||
with tempfile.NamedTemporaryFile(delete=False) as patch:
|
with tempfile.NamedTemporaryFile(mode='wt', delete=False) as patch:
|
||||||
patch.write('Subject: [PATCH] ')
|
patch.write('Subject: [PATCH] ')
|
||||||
patch.write(body)
|
patch.write(body)
|
||||||
patch.write('\n---\n')
|
patch.write('\n---\n')
|
||||||
|
|
Loading…
Reference in New Issue