File: 0002-lib-doc-manpages-make_manpages.py-Use-consistent-tim.patch

package info (click to toggle)
c-munipack 2.1.38-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 55,888 kB
  • sloc: ansic: 200,762; cpp: 106,123; lex: 9,035; yacc: 4,916; sh: 4,074; fortran: 2,613; xml: 2,105; python: 1,182; makefile: 546; perl: 104
file content (35 lines) | stat: -rw-r--r-- 1,518 bytes parent folder | download | duplicates (2)
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
From f68afc020268828ff52670e5bb50bd888a1b30f1 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Fri, 23 Jun 2023 12:41:29 -0700
Subject: [PATCH 2/2] lib/doc/manpages/make_manpages.py: Use consistent
 timestamp when generating manpage.

Support SOURCE_DATE_EPOCH, falling back to current time.

Use numeric date, to avoid locale-specific date rendering.

https://reproducible-builds.org/docs/source-date-epoch/
---
 lib/doc/manpages/make_manpages.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/doc/manpages/make_manpages.py b/lib/doc/manpages/make_manpages.py
index 545a4a4..2a74189 100644
--- a/lib/doc/manpages/make_manpages.py
+++ b/lib/doc/manpages/make_manpages.py
@@ -253,7 +253,11 @@ def processRefEntry(refentry, info, preface, seealso, output_dir):
 		# File header
 		# .TH airmass 1  "June 7, 2008" "C-Munipack 1.2" "C-Munipack Toolkit"
 		f.write(".TH "+title+" "+manvol+" ")
-		f.write("\"" + time.strftime("%B %d, %Y", time.localtime()) + "\" ")
+		# Support deterministic timestamp for reproducible builds
+		# https://reproducible-builds.org/docs/source-date-epoch/
+		f.write("\"" + time.strftime("%Y-%m-%d",
+		                             time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH',
+		                                                            time.time())))) + "\" ")
 		f.write("\"version "+version+"\" \""+package+"\"\n")
 		# Command name
 		refnamediv = getElement(refentry, "refnamediv")
-- 
2.39.2