aboutsummaryrefslogtreecommitdiff
path: root/tools/patman/tools.py
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-07-22 11:15:52 -0400
committerTom Rini <trini@konsulko.com>2021-07-22 11:15:52 -0400
commita15fa1ba67d7b3c8061b515e7713f733fa328018 (patch)
treef7746e2e7a3410043e9ea3f3f7c0a97e2c5e6dbb /tools/patman/tools.py
parent806734f41b25931798fdf667b5a2ae830229c13f (diff)
parent1b098b3e655451572054ce933a87231ee16f7133 (diff)
Merge tag 'dm-pull-21jul21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
dtoc improvements to show better warnings minor test build fixes sandbox fixes for SDL2 and running TPL bloblist resize feature binman multithreading
Diffstat (limited to 'tools/patman/tools.py')
-rw-r--r--tools/patman/tools.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index ec95a543bd..877e37cd8d 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -466,6 +466,9 @@ def Compress(indata, algo, with_header=True):
This requires 'lz4' and 'lzma_alone' tools. It also requires an output
directory to be previously set up, by calling PrepareOutputDir().
+ Care is taken to use unique temporary files so that this function can be
+ called from multiple threads.
+
Args:
indata: Input data to compress
algo: Algorithm to use ('none', 'gzip', 'lz4' or 'lzma')
@@ -475,14 +478,16 @@ def Compress(indata, algo, with_header=True):
"""
if algo == 'none':
return indata
- fname = GetOutputFilename('%s.comp.tmp' % algo)
+ fname = tempfile.NamedTemporaryFile(prefix='%s.comp.tmp' % algo,
+ dir=outdir).name
WriteFile(fname, indata)
if algo == 'lz4':
data = Run('lz4', '--no-frame-crc', '-B4', '-5', '-c', fname,
binary=True)
# cbfstool uses a very old version of lzma
elif algo == 'lzma':
- outfname = GetOutputFilename('%s.comp.otmp' % algo)
+ outfname = tempfile.NamedTemporaryFile(prefix='%s.comp.otmp' % algo,
+ dir=outdir).name
Run('lzma_alone', 'e', fname, outfname, '-lc1', '-lp0', '-pb0', '-d8')
data = ReadFile(outfname)
elif algo == 'gzip':