aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Goryachev via Guix-patches via <guix-patches@gnu.org>2024-06-13 09:17:38 +0300
committerAndrew Tropin <andrew@trop.in>2024-06-20 14:22:42 +0400
commit7b512b2106bcd605964f3cc8e40ac6ae0b3c3363 (patch)
tree926461069accea60c706d46c6222f064546c85ad
parentb0a087e1b038d7bda5025e9c859e1f4471aa6b13 (diff)
downloadguix-7b512b2106bcd605964f3cc8e40ac6ae0b3c3363.tar.gz
guix-7b512b2106bcd605964f3cc8e40ac6ae0b3c3363.zip
gnu: rebar3: Make rebar3 escriptize reproducible.
* gnu/packages/erlang.scm (rebar3): Make rebar3 escriptize reproducible. Change-Id: Id5897566f870afe62a97154becc752025a1b323e Signed-off-by: Andrew Tropin <andrew@trop.in>
-rw-r--r--gnu/packages/erlang.scm24
1 files changed, 24 insertions, 0 deletions
diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm
index c53cb72c2e..975e989055 100644
--- a/gnu/packages/erlang.scm
+++ b/gnu/packages/erlang.scm
@@ -10,6 +10,7 @@
;;; Copyright © 2022 jgart <jgart@dismail.de>
;;; Copyright © 2023 wrobell <wrobell@riseup.net>
;;; Copyright © 2023 Tim Johann <t1m@phrogstar.de>
+;;; Copyright © 2024 Igor Goryachev <igor@goryachev.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -638,6 +639,29 @@ Erlang.")
"eunit_formatters" "getopt" "hex_core" "erlware_commons"
"parse_trans" "relx" "ssl_verify_fun" "providers"))))
(delete 'configure)
+ ;; By default rebar3 produces escripts with embedded ZIP archives
+ ;; with files with current timestamps which is not suitable for
+ ;; reproducible builds. We fix it by setting predefined timestamps.
+ (add-before 'build 'make-escriptize-reproducible
+ (lambda _
+ (let ((escriptize "src/rebar_prv_escriptize.erl"))
+ (substitute* escriptize
+ (("\\[dir_entries\\(filename:dirname\\(Filename1\\)\\),")
+ (string-append "FilePath = filename:join(Dir, Filename),"
+ "{ok, FileInfo0} = file:read_file_info(FilePath),"
+ "DateTime = {{1970, 1, 1}, {0, 0, 1}},"
+ "FileInfo = FileInfo0#file_info{mtime = DateTime},"
+ "[dir_entries(filename:dirname(Filename1)),")))
+ (substitute* escriptize
+ (((string-append
+ "\\{Filename1, file_contents\\(filename:join\\(Dir, "
+ "Filename\\)\\)\\}\\]."))
+ "{Filename1, file_contents(FilePath), FileInfo}]."))
+ (substitute* escriptize
+ (((string-append "\\[\\{FName,FBin\\} \\|\\| \\{FName,FBin\\} <- "
+ "Files, FBin =/= <<>>\\]\\."))
+ (string-append "[{FName,FBin,FInfo} || {FName,FBin,FInfo} <- "
+ "Files, FBin =/= <<>>]."))))))
(replace 'build
(lambda _
(setenv "HOME" (getcwd))