@@ -45,10 +45,6 @@ XREF_IGNORE = [ \
4545xref : ERL_LIBS := $(ERL_LIBS ) :$(CURDIR ) /apps:$(CURDIR ) /deps:$(dir $(shell elixir --eval ':io.format "~s~n", [:code.lib_dir :elixir ]') )
4646endif
4747
48- ifneq ($(wildcard deps/.hex/cache.erl) ,)
49- deps :: restore-hex-cache-ets-file
50- endif
51-
5248include rabbitmq-components.mk
5349
5450# Set PROJECT_VERSION, calculated in rabbitmq-components.mk,
@@ -81,54 +77,6 @@ ifdef PLUGINS
8177RABBITMQ_ENABLED_PLUGINS ?= $(call comma_list,$(PLUGINS ) )
8278endif
8379
84- # --------------------------------------------------------------------
85- # Mix Hex cache management.
86- # --------------------------------------------------------------------
87-
88- # We restore the initial Hex cache.ets file from an Erlang term created
89- # at the time the source archive was prepared.
90- #
91- # See the `$(SOURCE_DIST)` recipe for the reason behind this step.
92-
93- restore-hex-cache-ets-file : deps/.hex/cache.ets
94-
95- deps/.hex/cache.ets : deps/.hex/cache.erl
96- $(gen_verbose ) $(call erlang,$(call restore_hex_cache_from_erl_term,$< ,$@ ) )
97-
98- define restore_hex_cache_from_erl_term
99- In = "$(1 ) ",
100- Out = "$(2 ) ",
101- {ok, [Props, Entries]} = file:consult(In),
102- Name = proplists:get_value(name, Props),
103- Type = proplists:get_value(type, Props),
104- Access = proplists:get_value(protection, Props),
105- NamedTable = proplists:get_bool(named_table, Props),
106- Keypos = proplists:get_value(keypos, Props),
107- Heir = proplists:get_value(heir, Props),
108- ReadConc = proplists:get_bool(read_concurrency, Props),
109- WriteConc = proplists:get_bool(write_concurrency, Props),
110- Compressed = proplists:get_bool(compressed, Props),
111- Options0 = [
112- Type,
113- Access,
114- {keypos, Keypos},
115- {heir, Heir},
116- {read_concurrency, ReadConc},
117- {write_concurrency, WriteConc}],
118- Options1 = case NamedTable of
119- true -> [named_table | Options0];
120- false -> Options0
121- end,
122- Options2 = case Compressed of
123- true -> [compressed | Options0];
124- false -> Options0
125- end,
126- Tab = ets:new(Name, Options2),
127- [true = ets:insert(Tab, Entry) || Entry <- Entries],
128- ok = ets:tab2file(Tab, Out),
129- init:stop().
130- endef
131-
13280# --------------------------------------------------------------------
13381# Distribution - common variables and generic functions.
13482# --------------------------------------------------------------------
@@ -266,14 +214,6 @@ $(1): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
266214 sed -E -i.bak "s|^[[:blank:]]*include[[:blank:]]+\.\./.*erlang.mk$$$$|include ../../erlang.mk|" \
267215 $$@ /deps/$$$$(basename $$$$dep) /Makefile && \
268216 rm $$@ /deps/$$$$(basename $$$$dep) /Makefile.bak; \
269- mix_exs=$$@ /deps/$$$$(basename $$$$dep) /mix.exs; \
270- if test -f $$$$mix_exs; then \
271- (cd $$$$(dirname "$$$$mix_exs" ) && \
272- (test -d $$@ /deps/.hex || env DEPS_DIR=$$@ /deps MIX_HOME=$$@ /deps/.mix HEX_HOME=$$@ /deps/.hex MIX_ENV=prod FILL_HEX_CACHE=yes mix local.hex --force) && \
273- env DEPS_DIR=$$@ /deps MIX_HOME=$$@ /deps/.mix HEX_HOME=$$@ /deps/.hex MIX_ENV=prod FILL_HEX_CACHE=yes mix deps.get --only prod && \
274- cp $(CURDIR ) /mk/rabbitmq-mix.mk . && \
275- rm -rf _build deps); \
276- fi; \
277217 if test -f "$$$$dep/license_info"; then \
278218 cp "$$$$dep/license_info" "$$@ /deps/licensing/license_info_$$$$(basename $$$$dep) "; \
279219 cat "$$$$dep/license_info" >> $$@ /LICENSE; \
@@ -298,7 +238,6 @@ $(1): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
298238 done
299239 $${verbose} echo "PLUGINS := $(PLUGINS ) " > $$@ /plugins.mk
300240 $${verbose} sort -r < "$$@ .git-times.txt" | head -n 1 > "$$@ .git-time.txt"
301- $${verbose} $$(call erlang,$$(call dump_hex_cache_to_erl_term,$$(call core_native_path,$$@ ) ,$$(call core_native_path,$$@ .git-time.txt) ) )
302241 $${verbose} find $$@ -print0 | xargs -0 touch -t "$$$$(cat $$@ .git-time.txt ) "
303242 $${verbose} rm "$$@ .git-times.txt" "$$@ .git-time.txt"
304243
@@ -340,47 +279,6 @@ clean-$(1):
340279clean:: clean-$(1 )
341280endef
342281
343- # Mix Hex component requires a cache file, otherwise it refuses to build
344- # offline... That cache is an ETS table with all the applications we
345- # depend on, plus some versioning informations and checksums. There
346- # are two problems with that: the table contains a date (`last_update`
347- # field) and `ets:tab2file()` produces a different file each time it's
348- # called.
349- #
350- # To make our source archive reproducible, we fix the time of the
351- # `last_update` field to the last Git commit and dump the content of the
352- # table as an Erlang term to a text file.
353- #
354- # The ETS file must be recreated before compiling RabbitMQ. See the
355- # `restore-hex-cache-ets-file` Make target.
356- define dump_hex_cache_to_erl_term
357- In = "$(1 ) /deps/.hex/cache.ets",
358- Out = "$(1 ) /deps/.hex/cache.erl",
359- {ok, DateStr} = file:read_file("$(2 ) "),
360- {match, Date} = re:run(DateStr,
361- "^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})\.([0-9]{2})",
362- [{capture, all_but_first, list}]),
363- [Year, Month, Day, Hour, Min, Sec] = [erlang:list_to_integer(V) || V <- Date],
364- {ok, Tab} = ets:file2tab(In),
365- true = ets:insert(Tab, {last_update, {{Year, Month, Day}, {Hour, Min, Sec}}}),
366- Props = [
367- Prop
368- || {Key, _} = Prop <- ets:info(Tab),
369- Key =:= name orelse
370- Key =:= type orelse
371- Key =:= protection orelse
372- Key =:= named_table orelse
373- Key =:= keypos orelse
374- Key =:= heir orelse
375- Key =:= read_concurrency orelse
376- Key =:= write_concurrency orelse
377- Key =:= compressed],
378- Entries = ets:tab2list(Tab),
379- ok = file:write_file(Out, io_lib:format("~w.~n~w.~n", [Props, Entries])),
380- ok = file:delete(In),
381- init:stop().
382- endef
383-
384282# --------------------------------------------------------------------
385283# Distribution - public targets
386284# --------------------------------------------------------------------
0 commit comments