File: reproducible-build.patch

package info (click to toggle)
cvs2svn 2.4.0-4
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 3,720 kB
  • sloc: python: 22,383; sh: 512; perl: 121; makefile: 84
file content (50 lines) | stat: -rw-r--r-- 1,732 bytes parent folder | download
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
39
40
41
42
43
44
45
46
47
48
49
50
Index: svn/cvs2svn_lib/run_options.py
===================================================================
--- a/cvs2svn_lib/run_options.py	(revision 5464)
+++ b/cvs2svn_lib/run_options.py	(revision 5465)
@@ -16,6 +16,7 @@
 
 """This module contains classes to set common cvs2xxx run options."""
 
+import os
 import sys
 import re
 import optparse
@@ -880,11 +881,23 @@
     self.pass_manager.help_passes()
     sys.exit(0)
 
+  def _choose_build_date(self):
+    """Choose the data to embed in the man pages.
+
+    If environment variable SOURCE_DATE_EPOCH is set, use that.
+    Otherwise, use the current time."""
+
+    t = os.environ.get('SOURCE_DATE_EPOCH')
+    if t:
+      return datetime.datetime.utcfromtimestamp(int(t)).date()
+    else:
+      return datetime.date.today()
+
   def callback_manpage(self, option, opt_str, value, parser):
     f = codecs.getwriter('utf_8')(sys.stdout)
     writer = ManWriter(parser,
                        section='1',
-                       date=datetime.date.today(),
+                       date=self._choose_build_date(),
                        source='Version %s' % (VERSION,),
                        manual='User Commands',
                        short_desc=self.short_desc,
Index: svn/cvs2svn_lib/man_writer.py
===================================================================
--- a/cvs2svn_lib/man_writer.py	(revision 5464)
+++ b/cvs2svn_lib/man_writer.py	(revision 5465)
@@ -93,7 +93,7 @@
         '.TH %s "%s" "%s" "%s" "%s"\n' % (
             self.parser.get_prog_name().upper(),
             self.section,
-            self.date.strftime('%b %d, %Y'),
+            self.date.strftime('%Y-%m-%d'),
             self.source,
             self.manual,
             )