mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-10-03 19:51:53 +02:00
binman: Use tools compression function for blob handling
Avoid duplicate code here by using the new compression function in the tools module. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
9382bb873b
commit
c444b1a54f
@ -49,18 +49,10 @@ class Entry_blob(Entry):
|
|||||||
# new Entry method which can read in chunks. Then we could copy
|
# new Entry method which can read in chunks. Then we could copy
|
||||||
# the data in chunks and avoid reading it all at once. For now
|
# the data in chunks and avoid reading it all at once. For now
|
||||||
# this seems like an unnecessary complication.
|
# this seems like an unnecessary complication.
|
||||||
data = tools.ReadFile(self._pathname)
|
indata = tools.ReadFile(self._pathname)
|
||||||
if self._compress == 'lz4':
|
if self._compress != 'none':
|
||||||
self._uncompressed_size = len(data)
|
self._uncompressed_size = len(indata)
|
||||||
'''
|
data = tools.Compress(indata, self._compress)
|
||||||
import lz4 # Import this only if needed (python-lz4 dependency)
|
|
||||||
|
|
||||||
try:
|
|
||||||
data = lz4.frame.compress(data)
|
|
||||||
except AttributeError:
|
|
||||||
data = lz4.compress(data)
|
|
||||||
'''
|
|
||||||
data = tools.Run('lz4', '-c', self._pathname, binary=True)
|
|
||||||
self.SetContents(data)
|
self.SetContents(data)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user