aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard M. Wiedemann <bwiedemann@suse.de>2017-05-03 15:15:15 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2017-05-10 22:08:53 +0000
commit460ba3d85951a42551864f0240335914a62639be (patch)
tree7f5df90b98073bfc3203a1c678c2eb168762f6e8
parentabce509affe1f25bbb4905670371ad202529d5e0 (diff)
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 <bwiedemann@suse.de>
-rw-r--r--src/tools/vppapigen/node.c7
1 files changed, 6 insertions, 1 deletions
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;