diff options
author | Simon Glass <sjg@chromium.org> | 2021-04-11 16:27:28 +1200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-04-29 03:23:39 -0700 |
commit | f1a83abe60b4ef8b2652e4c8e1d11a9afc909b71 (patch) | |
tree | 8662ba525e762bee6b1a6e13b490c733387d37f9 /tools/buildman/builderthread.py | |
parent | 8116c78ffddc71dec8f793339648a5239a5d9643 (diff) | |
download | u-boot-f1a83abe60b4ef8b2652e4c8e1d11a9afc909b71.tar.gz u-boot-f1a83abe60b4ef8b2652e4c8e1d11a9afc909b71.tar.xz u-boot-f1a83abe60b4ef8b2652e4c8e1d11a9afc909b71.zip |
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.py | 5 |
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] |