Use SOURCE_DATE_EPOCH for timestamp if present

The Debian reproducible builds effort suggests using
this environment variable for timestamps.
This commit is contained in:
Matthew Barr
2016-08-10 11:14:54 +10:00
parent ead869992c
commit f06f5d0702
2 changed files with 30 additions and 2 deletions

18
cmake/formatdate.py Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import datetime
def usage():
print("Usage:", os.path.basename(sys.argv[0]), "<seconds from epoch>")
if len(sys.argv) != 2:
usage()
sys.exit(1)
ts = sys.argv[1]
build_date = datetime.datetime.utcfromtimestamp(int(ts))
print(build_date.strftime("%Y-%m-%d"))