Subject: [PATCH v2] gnu: erlang-lfe: Make LFE compiler deterministic.

From: Igor Goryachev <[email-masked]>
Date: Tue, 2 Jul 2024 15:46:15 +0300

* gnu/packages/erlang.scm (erlang-lfe): Make LFE compiler deterministic.

Change-Id: I0cf00eeda8502384b746795802f1b2291d0e8a3b
---
 gnu/packages/erlang.scm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index dd07c1a617..a236722474 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -792,6 +792,13 @@ (define-public erlang-lfe
       #:phases
       #~(modify-phases %standard-phases
           (delete 'configure)
+          ;; By default LFE compiler itself is not deterministic. We fix it
+          ;; here. For more details see: https://github.com/lfe/lfe/issues/492.
+          (add-after 'unpack 'make-deterministic
+           (lambda _
+             (substitute* "src/lfe_env.erl"
+                 (("maps:fold\\(F, A, D\\)")
+                  "lists:sort(maps:fold(F, A, D))"))))
           ;; The following is inspired by rebar-build-system.scm
           (add-before 'check 'erlang-depends
             (lambda* (#:key inputs #:allow-other-keys)

base-commit: 4b3a553ca5ba5ac190739309eb5f7aa8170cf2a8
-- 
2.45.2