From 460ba3d85951a42551864f0240335914a62639be Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Wed, 3 May 2017 15:15:15 +0200 Subject: Allow to override the build date using the SOURCE_DATE_EPOCH env var to make vpp package 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. Change-Id: Iae0935c9bb4ccdfdb65600be543945a88f2e137f Signed-off-by: Bernhard M. Wiedemann --- src/tools/vppapigen/node.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tools/vppapigen/node.c b/src/tools/vppapigen/node.c index 15868ee5aaa..1f9905baca1 100644 --- a/src/tools/vppapigen/node.c +++ b/src/tools/vppapigen/node.c @@ -1114,7 +1114,12 @@ char *fixup_input_filename(void) void generate_top_boilerplate(FILE *fp) { - char *datestring = ctime(&starttime); + time_t curtime; + char *datestring; + char *source_date_epoch; + if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")) == NULL || (curtime = (time_t)strtol(source_date_epoch, NULL, 10)) <= 0) + curtime = starttime; + datestring = asctime(gmtime(&curtime)); fixed_name = fixup_input_filename(); datestring[24] = 0; -- cgit 1.2.3-korg