Source: naturaldocs
Version: 1.51-1.1
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: timestamps toolchain
X-Debbugs-Cc: [email protected]
Hi,
Whilst working on the "reproducible builds" effort [0], we noticed
that naturaldocs generates output with non-reproducible contents.
Patch attached that uses SOURCE_DATE_EPOCH. It should probably be
sent upstream.
[0] https://wiki.debian.org/ReproducibleBuilds
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
diff --git a/Modules/NaturalDocs/Menu.pm b/Modules/NaturalDocs/Menu.pm
index f0502d9..3a9ff49 100644
--- a/Modules/NaturalDocs/Menu.pm
+++ b/Modules/NaturalDocs/Menu.pm
@@ -393,9 +393,9 @@ sub LoadAndUpdate
# menu changing.
if (defined $timestampCode)
{
- my (undef, undef, undef, $currentDay, $currentMonth, $currentYear) =
localtime();
+ my (undef, undef, undef, $currentDay, $currentMonth, $currentYear) =
gmtime($ENV{SOURCE_DATE_EPOCH} || time);
my (undef, undef, undef, $lastDay, $lastMonth, $lastYear) =
- localtime( (stat(
NaturalDocs::Project->DataFile('PreviousMenuState.nd') ))[9] );
+ gmtime( (stat(
NaturalDocs::Project->DataFile('PreviousMenuState.nd') ))[9] );
# This should be okay if the previous menu state file doesn't
exist.
if ($currentDay != $lastDay || $currentMonth != $lastMonth ||
$currentYear != $lastYear)
@@ -1547,7 +1547,7 @@ sub GenerateTimestampText
'July', 'August', 'September', 'October',
'November', 'December' );
my @shortMonths = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
'Aug', 'Sept', 'Oct', 'Nov', 'Dec' );
- my (undef, undef, undef, $day, $month, $year) = localtime();
+ my (undef, undef, undef, $day, $month, $year) =
gmtime($ENV{SOURCE_DATE_EPOCH} || time);
$year += 1900;
my $longDay;