Skip to content

Commit 225dc62

Browse files
committed
More cleanup
1 parent 0323fd9 commit 225dc62

File tree

4 files changed

+6
-138
lines changed

4 files changed

+6
-138
lines changed

Makefile

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ XREF_IGNORE = [ \
4545
xref: ERL_LIBS := $(ERL_LIBS):$(CURDIR)/apps:$(CURDIR)/deps:$(dir $(shell elixir --eval ':io.format "~s~n", [:code.lib_dir :elixir ]'))
4646
endif
4747

48-
ifneq ($(wildcard deps/.hex/cache.erl),)
49-
deps:: restore-hex-cache-ets-file
50-
endif
51-
5248
include rabbitmq-components.mk
5349

5450
# Set PROJECT_VERSION, calculated in rabbitmq-components.mk,
@@ -81,54 +77,6 @@ ifdef PLUGINS
8177
RABBITMQ_ENABLED_PLUGINS ?= $(call comma_list,$(PLUGINS))
8278
endif
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):
340279
clean:: clean-$(1)
341280
endef
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
# --------------------------------------------------------------------

deps/rabbit_common/mk/rabbitmq-dist.mk

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
DIST_DIR ?= $(CURDIR)/plugins
44
CLI_SCRIPTS_DIR ?= $(CURDIR)/sbin
55
CLI_ESCRIPTS_DIR ?= $(CURDIR)/escript
6-
MIX = echo y | mix
76

87
# Set $(DIST_AS_EZS) to a non-empty value to enable the packaging of
98
# plugins as .ez archives.
@@ -81,17 +80,13 @@ endef
8180

8281
# Real entry point: it tests the existence of an .app file to determine
8382
# if it is an Erlang application (and therefore if it should be provided
84-
# as an .ez plugin archive) and calls do_ez_target_erlangmk. If instead
85-
# it finds a Mix configuration file, it is skipped, as the only elixir
86-
# applications in the directory are used by rabbitmq_cli and compiled
87-
# with it.
83+
# as an .ez plugin archive) and calls do_ez_target_erlangmk.
8884
#
8985
# $(call ez_target,path_to_app)
9086

9187
define ez_target
9288
dist_$(1)_appdir = $(2)
9389
dist_$(1)_appfile = $$(dist_$(1)_appdir)/ebin/$(1).app
94-
dist_$(1)_mixfile = $$(dist_$(1)_appdir)/mix.exs
9590

9691
$$(if $$(shell test -f $$(dist_$(1)_appfile) && echo OK), \
9792
$$(eval $$(call do_ez_target_erlangmk,$(1),$$(call get_app_version,$$(dist_$(1)_appfile)),$$(dist_$(1)_appdir))))
@@ -117,9 +112,8 @@ endif
117112
endif
118113

119114
# The actual recipe to create the .ez plugin archive. Some variables
120-
# are defined in the do_ez_target_erlangmk and do_ez_target_mix macros
121-
# above. All .ez archives are also listed in this do_ez_target_erlangmk
122-
# and do_ez_target_mix macros.
115+
# are defined in the do_ez_target_erlangmk macro
116+
# above. All .ez archives are also listed in this macro.
123117

124118
RSYNC ?= rsync
125119
RSYNC_V_0 =
@@ -200,7 +194,7 @@ test-dist:: $(ERLANG_MK_RECURSIVE_TEST_DEPS_LIST) test-build
200194
$(MAYBE_APPS_LIST)"; \
201195
fi
202196

203-
DIST_EZS = $(ERLANGMK_DIST_EZS) $(MIX_DIST_EZS)
197+
DIST_EZS = $(ERLANGMK_DIST_EZS)
204198

205199
do-dist:: $(DIST_EZS)
206200
$(verbose) unwanted='$(filter-out $(DIST_EZS) $(EXTRA_DIST_EZS), \

mk/rabbitmq-mix.mk

Lines changed: 0 additions & 21 deletions
This file was deleted.

packaging/generic-unix/Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,8 @@ dist:
4444
# Umbrella. Those manpages are copied to www.rabbitmq.com
4545
#
4646
# We explicitely set $HOME as a Make variable below because some package
47-
# builders do that, as part of cleaning the build environment. It
48-
# exercises our hack to convince mix(1) to work offline because that
49-
# hack depends on `$HOME`. A Make variable on the command line takes
50-
# precedence over variables declared in Makefiles, so our hack needs
51-
# to consider this. We do the same with the Freedesktop.org-specified
47+
# builders do that, as part of cleaning the build environment.
48+
# We do the same with the Freedesktop.org-specified
5249
# variables ($XDG_*_HOME).
5350
$(MAKE) -C $(SOURCE_DIR) \
5451
HOME="$(HOME)" \

0 commit comments

Comments
 (0)