Source: c-munipack
Severity: normal
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps locales
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

The build date is embedded in the cmunipack manpage:

  
https://tests.reproducible-builds.org/debian/rb-pkg/bookworm/amd64/diffoscope-results/c-munipack.html

  ./usr/share/man/man3/cmunipack.3.gz

  .TH·cmunipack·3·"June·22,·2023"·"version·2.1.32"·"C\-Munipack·2.0"
  vs.
  .TH·cmunipack·3·"July·26,·2024"·"version·2.1.32"·"C\-Munipack·2.0"

The attached patch adds support for deterministic timestamps using the
SOURCE_DATE_EPOCH environment variable, which is exported by
dpkg-buildpackage. It also uses a numeric date that is independent of
the build environment locale.

According to my local tests, with this patch applied c-munipack should
build reproducibly on tests.reproducible-builds.org once it migrates to
debian/trixie! There is another issue with build paths that I will
submit a patch for shortly that also affects the build in unstable.

Thanks for maintaining c-munipack!

live well,
  vagrant
From f68afc020268828ff52670e5bb50bd888a1b30f1 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@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

Attachment: signature.asc
Description: PGP signature

Reply via email to