Source: sphinxcontrib-mermaid Version: 0.9.2-1 Severity: wishlist Tags: patch User: [email protected] Usertags: randomness X-Debbugs-Cc: [email protected]
Hi, Whilst working on the Reproducible Builds effort [0], we noticed that sphinxcontrib-mermaid could not be built reproducibly. This is because it used Python's uuid.uuid4() method. Patch attached that seeds this value from SOURCE_DATE_EPOCH if it exists. [0] https://reproducible-builds.org/ Regards, -- ,''`. : :' : Chris Lamb `. `'` [email protected] / chris-lamb.co.uk `-
--- a/debian/patches/docs-Reproducible-build.patch 1970-01-01 01:00:00.000000000 +0100 --- b/debian/patches/docs-Reproducible-build.patch 2023-09-26 13:24:47.132348582 +0100 @@ -0,0 +1,25 @@ +Description: Make the build reproducible +Author: Chris Lamb <[email protected]> +Last-Update: 2023-09-26 + +--- sphinxcontrib-mermaid-0.9.2.orig/sphinxcontrib/mermaid.py ++++ sphinxcontrib-mermaid-0.9.2/sphinxcontrib/mermaid.py +@@ -37,6 +37,9 @@ logger = logging.getLogger(__name__) + + mapname_re = re.compile(r'<map id="(.*?)"') + ++import random ++rnd = random.Random() ++rnd.seed(os.environ.get("SOURCE_DATE_EPOCH")) + + class mermaid(nodes.General, nodes.Inline, nodes.Element): + pass +@@ -138,7 +141,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))) + + caption = self.options.get("caption") + if caption: --- a/debian/patches/series 2023-09-26 12:47:21.140521439 +0100 --- b/debian/patches/series 2023-09-26 13:23:54.004130039 +0100 @@ -3,3 +3,4 @@ docs-Correct-section-for-generated-manpages.patch Privacy-Remove-linking-to-graphics-for-badges.patch docs-Don-t-sideload-an-animated-GIF-file.patch +docs-Reproducible-build.patch

