]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
elf2efi: Deal properly with empty $SOURCE_DATE_EPOCH
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 9 Apr 2025 13:00:28 +0000 (15:00 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 9 Apr 2025 14:21:13 +0000 (16:21 +0200)
tools/elf2efi.py

index cb1a284a601020373dd74a8d66ab99543d8ebf3f..a63d3fc98da56a6d90acd67fdf6d5141f4bd2c14 100755 (executable)
@@ -611,7 +611,7 @@ def elf2efi(args: argparse.Namespace):
 
     coff.Machine = pe_arch
     coff.NumberOfSections = len(sections)
-    coff.TimeDateStamp = int(os.environ.get("SOURCE_DATE_EPOCH", time.time()))
+    coff.TimeDateStamp = int(sde if (sde := os.environ.get("SOURCE_DATE_EPOCH")) else time.time())
     coff.SizeOfOptionalHeader = sizeof(opt)
     # EXECUTABLE_IMAGE|LINE_NUMS_STRIPPED|LOCAL_SYMS_STRIPPED|DEBUG_STRIPPED
     # and (32BIT_MACHINE or LARGE_ADDRESS_AWARE)