[Reproducible-builds] [PATCH 5/5] scripts/kernel-doc: Use $KBUILD_BUILD_TIMESTAMP as man page date

Ben Hutchings ben at decadent.org.uk
Wed Jul 8 19:07:16 UTC 2015


Together with the preceding changes, this allows man pages to be built
reproducibly.

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
 scripts/kernel-doc | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 71ada00..0ac1a07 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -253,11 +253,20 @@ my %highlights = %highlights_man;
 my $blankline = $blankline_man;
 my $modulename = "Kernel API";
 my $function_only = 0;
+my $show_not_found = 0;
+
+my @build_time;
+if (defined($ENV{'KBUILD_BUILD_TIMESTAMP'}) &&
+    (my $seconds = `date -d"${ENV{'KBUILD_BUILD_TIMESTAMP'}}" +%s`) ne '') {
+    @build_time = gmtime($seconds);
+} else {
+    @build_time = localtime;
+}
+
 my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',
 		'July', 'August', 'September', 'October',
-		'November', 'December')[(localtime)[4]] .
-  " " . ((localtime)[5]+1900);
-my $show_not_found = 0;
+		'November', 'December')[$build_time[4]] .
+  " " . ($build_time[5]+1900);
 
 # Essentially these are globals.
 # They probably want to be tidied up, made more localised or something.
-- 
Ben Hutchings
If the facts do not conform to your theory, they must be disposed of.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/reproducible-builds/attachments/20150708/a8e8a2b2/attachment.sig>


More information about the Reproducible-builds mailing list