summaryrefslogtreecommitdiff
path: root/tools/buildman/builderthread.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-04-11 07:27:28 +0300
committerSimon Glass <sjg@chromium.org>2021-04-29 13:23:39 +0300
commitf1a83abe60b4ef8b2652e4c8e1d11a9afc909b71 (patch)
tree8662ba525e762bee6b1a6e13b490c733387d37f9 /tools/buildman/builderthread.py
parent8116c78ffddc71dec8f793339648a5239a5d9643 (diff)
downloadu-boot-f1a83abe60b4ef8b2652e4c8e1d11a9afc909b71.tar.xz
buildman: Use bytes for the environment
At present we sometimes see problems in gitlab where the environment has 0x80 characters or sequences which are not valid UTF-8. Avoid this by using bytes for the environment, both internal to buildman and when writing out the 'env' file. Add a test to make sure this works as expected. Reported-by: Marek Vasut <marex@denx.de> Fixes: e5fc79ea718 ("buildman: Write the environment out to an 'env' file") Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/buildman/builderthread.py')
-rw-r--r--tools/buildman/builderthread.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index ddb3eab8c0..48128cf673 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -351,10 +351,9 @@ 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',
- encoding='utf-8') as fd:
+ with open(os.path.join(build_dir, 'out-env'), 'wb') as fd:
for var in sorted(env.keys()):
- print('%s="%s"' % (var, env[var]), file=fd)
+ fd.write(b'%s="%s"' % (var, env[var]))
lines = []
for fname in BASE_ELF_FILENAMES:
cmd = ['%snm' % self.toolchain.cross, '--size-sort', fname]