Skip to content

Commit

Permalink
Allow to override build date with SOURCE_DATE_EPOCH
Browse files Browse the repository at this point in the history
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 consistently use ISO 8601 date format
to be understood everywhere.
Also use gmtime to be independent of timezone.
  • Loading branch information
bmwiedemann committed Oct 15, 2018
1 parent 0c20ae2 commit a61f52d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ zip = whereis('zip')
#
date = ARGUMENTS.get('DATE')
if not date:
date = time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(time.time()))
date = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))))

developer = ARGUMENTS.get('DEVELOPER')
if not developer:
Expand Down
5 changes: 3 additions & 2 deletions doc/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ if skip_doc:
if not os.path.isdir(scdir):
os.makedirs(scdir)

import datetime
today = datetime.date.today().strftime("%m/%d/%Y")
import time
today = time.strftime("%Y-%m-%d",
time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))))
version = env.subst('$VERSION')
for m in man_page_list:
man, _ = os.path.splitext(m)
Expand Down
5 changes: 5 additions & 0 deletions src/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
Three uses of variables not defined are changed.
- Some script changes in trying to find scons engine

From Bernhard M. Wiedemann:
- Allow to override build date with SOURCE_DATE_EPOCH for SCons itself,
but not for software built with SCons.
- Datestamps in docs and embedded in code use ISO 8601 format and UTC

From Hao Wu
- typo in customized decider example in user guide

Expand Down

0 comments on commit a61f52d

Please sign in to comment.