From: Bernhard M. Wiedemann Date: Wed, 3 May 2017 13:15:15 +0000 (+0200) Subject: Allow to override the build date X-Git-Tag: odp_vpp~162 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=460ba3d85951a42551864f0240335914a62639be;p=odp4vpp.git 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 --- diff --git a/src/tools/vppapigen/node.c b/src/tools/vppapigen/node.c index 15868ee5..1f9905ba 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;