1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
From d532ebe90243f9390b0b1e49f1d4918f173238a6 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Tue, 22 Feb 2022 03:25:25 +0000
Subject: [PATCH] lib/cmdline.c: Use deterministic timestamp when generating
manpages.
Use the SOURCE_DATE_EPOCH environment variable if available, and use
numeric date to avoid embedding locale-dependent month names.
https://reproducible-builds.org/docs/source-date-epoch/
---
lib/cmdline.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/cmdline.c b/lib/cmdline.c
index 4b4d2f6..049e905 100644
--- a/lib/cmdline.c
+++ b/lib/cmdline.c
@@ -441,9 +441,13 @@ void bg_cmdline_print_help(char * argv0, bg_help_format_t format)
char ** args;
char * string_uc;
- time(&t);
- localtime_r(&t, &brokentime);
- strftime(date_str, 511, "%B %Y", &brokentime);
+ char *source_date_epoch;
+ /* This assumes that the SOURCE_DATE_EPOCH environment variable will contain
+ a correct, positive integer in the time_t range */
+ if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")) == NULL ||
+ (t = (time_t)strtoll(source_date_epoch, NULL, 10)) <= 0)
+ time(&t);
+ strftime(date_str, 511, "%F", gmtime(&t));
string_uc = bg_toupper(bg_app_get_name());
--
2.35.1
|