Skip to content

Commit

Permalink
Merge pull request #2900 from delitrem/make-escriptize-reproducible
Browse files Browse the repository at this point in the history
make escriptize reproducible by setting timestamps for files in zip to unix epoch
  • Loading branch information
ferd authored Jun 13, 2024
2 parents b562583 + 4c4809f commit d456815
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/rebar/src/rebar_prv_escriptize.erl
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,12 @@ read_file(Prefix, Filename, Dir) ->
_ ->
filename:join([Prefix, Filename])
end,
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)),
{Filename1, file_contents(filename:join(Dir, Filename))}].
{Filename1, file_contents(FilePath), FileInfo}].

file_contents(Filename) ->
{ok, Bin} = file:read_file(Filename),
Expand Down Expand Up @@ -272,7 +276,7 @@ usort(List) ->
lists:ukeysort(1, lists:flatten(List)).

get_nonempty(Files) ->
[{FName,FBin} || {FName,FBin} <- Files, FBin =/= <<>>].
[{FName,FBin,FInfo} || {FName,FBin,FInfo} <- Files, FBin =/= <<>>].

find_deps(AppNames, AllApps, State) ->
BinAppNames = [rebar_utils:to_binary(Name) || Name <- AppNames],
Expand Down

0 comments on commit d456815

Please sign in to comment.