Skip to content

Commit 3124659

Browse files
committed
Make builds reproducible by using SOURCE_DATE_EPOCH for build date
Don't embed the current date which make the builds unreproducible. See: https://reproducible-builds.org/docs/source-date-epoch/ Bug-Debian: https://bugs.debian.org/1104546 Signed-off-by: Dylan Aïssi <[email protected]>
1 parent 2fc98bd commit 3124659

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

utils/version.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
#
66
# Generate version information for libcamera-apps
77

8+
import os
89
import subprocess
910
import sys
11+
import time
1012
from datetime import datetime
1113
from string import hexdigits
1214

@@ -53,7 +55,11 @@ def generate_version():
5355
commit = '0' * digits + '-invalid'
5456

5557
finally:
56-
print(f'{commit} {datetime.now().strftime("%d-%m-%Y (%H:%M:%S)")}', end="")
58+
date_str = time.strftime(
59+
"%d-%m-%Y (%H:%M:%S)",
60+
time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
61+
)
62+
print(f'{commit} {date_str}', end="")
5763

5864

5965
if __name__ == "__main__":

0 commit comments

Comments
 (0)