Source: 3dldf
Version: 2.0.3+dfsg-7
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed
that 3dldf could not be built reproducibly as it needlessly
includes timestamps in the generated (eg.) dodec_03.mp files.

Patch attached. An alternative would be to parse SOURCE_DATE_EPOCH
[1].

 [0] https://reproducible-builds.org/
 [1] https://reproducible-builds.org/specs/source-date-epoch/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
--- a/debian/patches/reproducible-build.patch   1970-01-01 01:00:00.000000000 
+0100
--- b/debian/patches/reproducible-build.patch   2018-02-23 09:19:05.116436650 
+0000
@@ -0,0 +1,111 @@
+Description: Make the build reproducible
+Author: Chris Lamb <la...@debian.org>
+Last-Update: 2018-02-23
+
+--- 3dldf-2.0.3+dfsg.orig/src/io.web
++++ 3dldf-2.0.3+dfsg/src/io.web
+@@ -771,13 +771,6 @@ void
+ initialize_io(string in_stream_name, string out_stream_name,
+               string tex_stream_name, char* program_name)
+ {
+-  time_t tt;
+-  tm *lt;
+-  tt = time(0);
+-  lt =localtime(&tt);
+-
+-  string datestamp(asctime(lt));
+-  datestamp.erase(datestamp.size() - 1); // Remove terminal line-feed.
+ 
+ @ Open |out_stream| and |tex_stream|.  
+ |in_stream| is currently not opened.  \initials{LDF 2003.08.29.}  
+@@ -800,14 +793,14 @@ initialize_io(string in_stream_name, str
+ 
+   tex_stream.open(tex_stream_name.c_str());
+ 
+-  /* Write datestamp to |out_stream|. */
++  /* Write program_name to |out_stream|. */
+   out_stream << "%%%% This is " << out_stream_name << "." << endl
+-    << "%%%% Generated on " << datestamp << " from " << program_name
++    << "%%%% Generated from " << program_name
+       << ".\n\n";
+ 
+-  /* Write datestamp to |tex_stream|. */
++  /* Write program_name to |tex_stream|. */
+   tex_stream << "%%%% This is " << tex_stream_name << "." << endl
+-    << "%%%% Generated on " << datestamp << " from " << program_name
++    << "%%%% Generated from " << program_name
+       << ".\n\n";
+ }    
+ 
+--- 3dldf-2.0.3+dfsg.orig/src/main.web
++++ 3dldf-2.0.3+dfsg/src/main.web
+@@ -1266,20 +1266,10 @@ Added |do|---|while| loop that wraps the
+ #endif 
+ #endif 
+ 
+-      time_t tt;
+-      tm *lt;
+-      tt = time(0);
+-      lt =localtime(&tt);
+-
+-      string datestamp(asctime(lt));
+-      datestamp.erase(datestamp.size() - 1); /*  Remove terminal line-feed.  
*/
+-
+-
+       *(scanner_node_stdin->out[Run_State::METAPOST]->stream_ptr) 
+                          << "%%%% " << default_out_filename_metapost 
+                          << "." << endl
+-                         << "%%%% Generated on " << datestamp << endl 
+-                         << "%%%% from standard input by GNU 3DLDF "
++                         << "%%%% Generated from standard input by GNU 3DLDF "
+                          << VERSION_3DLDF << "."
+                          << endl << endl << flush; 
+ 
+--- 3dldf-2.0.3+dfsg.orig/src/pspglb.web
++++ 3dldf-2.0.3+dfsg/src/pspglb.web
+@@ -1861,17 +1861,8 @@ Thread_Info_Type::get_thread_info(bool c
+ 
+    thread_info->log_stream.open(s.str().c_str());
+ 
+-   time_t tt;
+-   tm *lt;
+-   tt = time(0);
+-   lt =localtime(&tt);
+-
+-   string datestamp(asctime(lt));
+-   datestamp.erase(datestamp.size() - 1); /*  Remove terminal line-feed.  */
+-
+    thread_info->log_stream << "%%%% " << s.str() << endl
+-                           << "%%%% Generated on " 
+-                           << datestamp << " from GNU 3DLDF " 
++                           << "%%%% Generated from GNU 3DLDF " 
+                            << VERSION_3DLDF << "." 
+                            << endl << endl << flush;
+    thread_ctr++;
+--- 3dldf-2.0.3+dfsg.orig/src/sctpcrt.web
++++ 3dldf-2.0.3+dfsg/src/sctpcrt.web
+@@ -632,14 +632,6 @@ needed, because this function predefines
+ 
+ @<Define |Scanner_Type::create|@>=
+ 
+-  time_t tt;
+-  tm *lt;
+-  tt = time(0);
+-  lt =localtime(&tt);
+-
+-  string datestamp(asctime(lt));
+-  datestamp.erase(datestamp.size() - 1); // Remove terminal line-feed.
+-
+   if (      scanner_node->in->type 
+          == Io_Struct::FILE_TYPE 
+       && r.do_output[Run_State::METAPOST])
+@@ -662,8 +654,7 @@ needed, because this function predefines
+ #endif 
+   
+       *out_file_metapost << "%%%% " << out_filename_metapost << "." << endl
+-                         << "%%%% Generated on " << datestamp << endl 
+-                         << "%%%% from " << in_filename << " by "
++                         << "%%%% Generated from " << in_filename << " by "
+                          << "GNU 3DLDF " << VERSION_3DLDF << "."
+                          << endl << endl << flush; 
+ 
--- a/debian/patches/series     2018-02-23 08:44:45.856096353 +0000
--- b/debian/patches/series     2018-02-23 09:19:04.060442545 +0000
@@ -10,3 +10,4 @@
 debianization-dfsg.patch
 debianization.patch
 debianization-manpages.patch
+reproducible-build.patch

Reply via email to