Package: src:verilator
Version: 5.006-2
Severity: normal
Tags: patch
User: [email protected]
Usertags: timestamps
X-Debbugs-Cc: [email protected]

Dear Maintainer,

The Reproducible Builds effort noticed that verilator does not build 
reproducibly.
  
https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/verilator.html
This is because the verilator.pdf file's cover-page date stamp depends on the 
timezone.

When this situation was brought to the attention of upstream developers,
their preference was to shift to using an internal release date, rather
than fix the SOURCE_DATE_EPOCH override to be timezone-independent.
The attached patch is an upstream git commit (bc6a778, Feb 12 2023)
to their primary development sources.

With this patch applied (note it needs to be listed _after_ the existing
"Add SOURCE_DATE_EPOCH for docs guide conf.py 3918.patch" in patches/series)
verilator should build reproducibly on tests.reproducible-builds.org!

Thanks for maintaining Verilator!

  - Larry
>From bc6a7787ed271a8f52ed5b8f8a9e0e8cbba1ab38 Mon Sep 17 00:00:00 2001
From: Larry Doolittle <[email protected]>
Date: Sun, 12 Feb 2023 20:21:03 -0800
Subject: [PATCH] Fix date on the front page of verilator.pdf (#3956) (#3957)

---
 docs/guide/conf.py | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/docs/guide/conf.py b/docs/guide/conf.py
index 04759c6de..9f69245dd 100644
--- a/docs/guide/conf.py
+++ b/docs/guide/conf.py
@@ -10,7 +10,6 @@
 # ----------------------------------------------------------------------
 # -- Path setup
 
-from datetime import datetime
 import os
 import re
 import sys
@@ -24,10 +23,17 @@ def get_vlt_version():
     filename = "../../Makefile"
     with open(filename, "r", encoding="utf8") as fh:
         for line in fh:
-            match = re.search(r"PACKAGE_VERSION_NUMBER *= *([a-z0-9.]+)", line)
+            match = re.search(r"PACKAGE_VERSION *= *([a-z0-9.]+) +([-0-9]+)", line)
             if match:
-                return match.group(1)
-    return "unknown"
+                return match.group(1), match.group(2)
+            match = re.search(r"PACKAGE_VERSION *= *([a-z0-9.]+) +devel", line)
+            if match:
+                try:
+                    data = os.popen('git log -n 1 --pretty=%cs').read()
+                except Exception:
+                    data = ""  # fallback, and Sphinx will fill in today's date
+                return "Devel " + match.group(1), data
+    return "unknown", "unknown"
 
 
 def setup(app):
@@ -44,8 +50,8 @@ author = 'Wilson Snyder'
 # The master toctree document.
 master_doc = "index"
 
-version = get_vlt_version()
-release = get_vlt_version()
+version, today_fmt = get_vlt_version()
+release = version
 
 rst_prolog = """
 .. role:: vlopt(option)
@@ -89,15 +95,6 @@ source_suffix = [".rst"]
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
 
-try:
-    # https://reproducible-builds.org/specs/source-date-epoch/
-    doc_now = datetime.fromtimestamp(int(os.environ["SOURCE_DATE_EPOCH"]))
-    print("Using SOURCE_DATE_EPOCH")
-except Exception:
-    doc_now = datetime.now()
-# Date format to ISO
-today_fmt = doc_now.strftime("%F")
-
 # If true, `todo` and `todoList` produce output, else they produce nothing.
 todo_include_todos = True
 
-- 
2.30.2

Reply via email to