diff options
author | Simon Glass <sjg@chromium.org> | 2021-03-26 14:39:39 +1300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-04-06 16:33:19 +1200 |
commit | 5f86454b3da54586513ab83941a021cb79c383c7 (patch) | |
tree | 3dbfb32f72ba835bc88abe4e6c2185020afb4fe5 | |
parent | bddac45d0422acbba5bf01406d27eedb429a1f42 (diff) | |
download | u-boot-5f86454b3da54586513ab83941a021cb79c383c7.zip u-boot-5f86454b3da54586513ab83941a021cb79c383c7.tar.gz u-boot-5f86454b3da54586513ab83941a021cb79c383c7.tar.bz2 |
buildman: Add an encoding to the out-env file
The environment may contain some unicode characters. At least that is what
seemed to happen on one commit:
Building current source for 1 boards (0 threads, 64 jobs per thread)
0 0 0 /1 -1 (starting)
Traceback (most recent call last):
File ".../tools/buildman/buildman", line 64, in <module>
ret_code = control.DoBuildman(options, args)
File "tools/buildman/control.py", line 372, in DoBuildman
options.keep_outputs, options.verbose)
File ".../tools/buildman/builder.py", line 1704, in BuildBoards
results = self._single_builder.RunJob(job)
File ".../tools/buildman/builderthread.py", line 526, in RunJob
self._WriteResult(result, job.keep_outputs, job.work_in_output)
File ".../tools//buildman/builderthread.py", line 349, in _WriteResult
print('%s="%s"' % (var, env[var]), file=fd)
UnicodeEncodeError: 'ascii' codec can't encode characters in position
311-312: ordinal not in range(128)
The problem defies repetition with any change at all to buildman. But
let's set an encoding in any case.
Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | tools/buildman/builderthread.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index 6c6dbd7..06ed272 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -344,7 +344,8 @@ class BuilderThread(threading.Thread): # Write out the image and function size information and an objdump env = result.toolchain.MakeEnvironment(self.builder.full_path) - with open(os.path.join(build_dir, 'out-env'), 'w') as fd: + with open(os.path.join(build_dir, 'out-env'), 'w', + encoding='utf-8') as fd: for var in sorted(env.keys()): print('%s="%s"' % (var, env[var]), file=fd) lines = [] |