diff options
authorBernhard M. Wiedemann <bwiedemann@suse.de>2018-05-30 13:20:29 +0200
committerBernhard M. Wiedemann <bwiedemann@suse.de>2018-05-30 13:21:57 +0200
commit7a97fcafedead40b311eef65467480bd72fdd18b (patch)
parentba941e553d60a06a45ad96f0ad4161383d4c0d30 (diff)
asn1tostruct: allow to override build date
in order to make builds reproducible. See https://reproducible-builds.org/ for why this is good and https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable. Also do not record build user name to not have it vary. Change-Id: I5cfa465cc82f009f28dd7f12ced0e72a05fda842
1 files changed, 3 insertions, 2 deletions
diff --git a/asn1/utils/asn1tostruct.py b/asn1/utils/asn1tostruct.py
index 0bba9dd..3c33980 100755
--- a/asn1/utils/asn1tostruct.py
+++ b/asn1/utils/asn1tostruct.py
@@ -4,6 +4,7 @@ import re, os, sys, string
import datetime
import getopt
import getpass
+import time
version = "0.5osmo1"
@@ -33,11 +34,11 @@ def printDebug(string):
print string
def outputHeaderToFile(f, filename):
- now = datetime.datetime.now()
+ now = datetime.datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
f.write(" * This file had been created by asn1tostruct.py script v%s\n" % (version))
f.write(" * Please do not modify this file but regenerate it via script.\n")
- f.write(" * Created on: %s by %s\n * from %s\n" % (str(now), getpass.getuser(), filenames))
+ f.write(" * Created on: %s\n * from %s\n" % (str(now), filenames))
f.write(" ******************************************************************************/\n")
def lowerFirstCamelWord(word):