Skip to content

Commit 284b8fe

Browse files
adeaarmutzig
authored andcommitted
imgtool: Add filename to some common prints
Common prints such as the one that happens when an image is signed are clearer if the source of print is added (i.e. filename), especially for those build integration flows where imgtool is invoked as part of a set of operations. Signed-off-by: Antonio de Angelis <[email protected]>
1 parent a1de4e5 commit 284b8fe

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

scripts/imgtool/image.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def create(self, key, public_key_format, enckey, dependencies=None,
315315
pubbytes = sha.digest()
316316
elif pub_key is not None:
317317
if hasattr(pub_key, 'sign'):
318-
print("sign the payload")
318+
print(os.path.basename(__file__) + ": sign the payload")
319319
pub = pub_key.get_public_bytes()
320320
sha = hashlib.sha256()
321321
sha.update(pub)
@@ -443,22 +443,22 @@ def create(self, key, public_key_format, enckey, dependencies=None,
443443
if vector_to_sign == 'payload':
444444
# Stop amending data to the image
445445
# Just keep data vector which is expected to be sigend
446-
print('export payload')
446+
print(os.path.basename(__file__) + ': export payload')
447447
return
448448
elif vector_to_sign == 'digest':
449449
self.payload = digest
450-
print('export digest')
450+
print(os.path.basename(__file__) + ': export digest')
451451
return
452452

453453
if key is not None and fixed_sig is None:
454454
# `sign` expects the full image payload (sha256 done internally),
455455
# while `sign_digest` expects only the digest of the payload
456456

457457
if hasattr(key, 'sign'):
458-
print("sign the payload")
458+
print(os.path.basename(__file__) + ": sign the payload")
459459
sig = key.sign(bytes(self.payload))
460460
else:
461-
print("sign the digest")
461+
print(os.path.basename(__file__) + ": sign the digest")
462462
sig = key.sign_digest(digest)
463463
tlv.add(key.sig_tlv(), sig)
464464
self.signature = sig

0 commit comments

Comments
 (0)