File: Make-the-build-reproducible.patch

package info (click to toggle)
sphinxcontrib-mermaid 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,760 kB
  • sloc: python: 691; javascript: 275; makefile: 24; sh: 17
file content (31 lines) | stat: -rw-r--r-- 1,008 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
From: Chris Lamb <lamby@debian.org>
Date: Tue, 26 Sep 2023 13:24:47 +0100
Subject: Make the build reproducible

---
 sphinxcontrib/mermaid/__init__.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sphinxcontrib/mermaid/__init__.py b/sphinxcontrib/mermaid/__init__.py
index 08beb01..55bf9c2 100644
--- a/sphinxcontrib/mermaid/__init__.py
+++ b/sphinxcontrib/mermaid/__init__.py
@@ -88,6 +88,9 @@ const load = async () => {{
 window.addEventListener("load", load);
 """
 
+import random
+rnd = random.Random()
+rnd.seed(os.environ.get("SOURCE_DATE_EPOCH"))
 
 class mermaid(nodes.General, nodes.Inline, nodes.Element):
     pass
@@ -191,7 +194,7 @@ class Mermaid(Directive):
             node["inline"] = True
         if "zoom" in self.options:
             node["zoom"] = True
-            node["zoom_id"] = f"id-{uuid.uuid4()}"
+            node["zoom_id"] = "id-{}".format(uuid.UUID(version=4, int=rnd.getrandbits(128)))
 
         # Mermaid directives
         mm_config = "---"