[Reproducible-builds] Bug#831377: naturaldocs: please make the output reproducible

Chris Lamb lamby at debian.org
Fri Jul 15 08:54:45 UTC 2016


Source: naturaldocs
Version: 1.51-1.1
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: timestamps toolchain
X-Debbugs-Cc: reproducible-builds at lists.alioth.debian.org

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
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
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;


More information about the Reproducible-builds mailing list