binman: Change how faked blobs are created
At present fake blobs are created but internally an empty blob is used. Change it to use the contents of the faked file. Also return whether the blob was faked, in case the caller needs to know that. Add a TODO to put fake blobs in their own directory. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
This commit is contained in:
@@ -999,15 +999,18 @@ features to produce new behaviours.
|
||||
fname (str): Filename to check
|
||||
|
||||
Returns:
|
||||
fname (str): Filename of faked file
|
||||
tuple:
|
||||
fname (str): Filename of faked file
|
||||
bool: True if the blob was faked, False if not
|
||||
"""
|
||||
if self.allow_fake and not pathlib.Path(fname).is_file():
|
||||
outfname = tools.get_output_filename(os.path.basename(fname))
|
||||
with open(outfname, "wb") as out:
|
||||
out.truncate(1024)
|
||||
self.faked = True
|
||||
return outfname
|
||||
return fname
|
||||
tout.info(f"Entry '{self._node.path}': Faked file '{outfname}'")
|
||||
return outfname, True
|
||||
return fname, False
|
||||
|
||||
def CheckFakedBlobs(self, faked_blobs_list):
|
||||
"""Check if any entries in this section have faked external blobs
|
||||
|
Reference in New Issue
Block a user