Skip to content

Commit 7380de3

Browse files
committed
More cleanup
1 parent c22a46b commit 7380de3

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.
13482
# --------------------------------------------------------------------
@@ -250,14 +198,6 @@ $(SOURCE_DIST): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
250198
sed -E -i.bak "s|^[[:blank:]]*include[[:blank:]]+\.\./.*erlang.mk$$|include ../../erlang.mk|" \
251199
$@/deps/$$(basename $$dep)/Makefile && \
252200
rm $@/deps/$$(basename $$dep)/Makefile.bak; \
253-
mix_exs=$@/deps/$$(basename $$dep)/mix.exs; \
254-
if test -f $$mix_exs; then \
255-
(cd $$(dirname "$$mix_exs") && \
256-
(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) && \
257-
env DEPS_DIR=$@/deps MIX_HOME=$@/deps/.mix HEX_HOME=$@/deps/.hex MIX_ENV=prod FILL_HEX_CACHE=yes mix deps.get --only prod && \
258-
cp $(CURDIR)/mk/rabbitmq-mix.mk . && \
259-
rm -rf _build deps); \
260-
fi; \
261201
if test -f "$$dep/license_info"; then \
262202
cp "$$dep/license_info" "$@/deps/licensing/license_info_$$(basename "$$dep")"; \
263203
cat "$$dep/license_info" >> $@/LICENSE; \
@@ -283,52 +223,10 @@ $(SOURCE_DIST): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
283223
$(verbose) echo "PLUGINS := $(PLUGINS)" > $@/plugins.mk
284224
# Remember the latest Git timestamp.
285225
$(verbose) sort -r < "[email protected]" | head -n 1 > "[email protected]"
286-
# Mix Hex component requires a cache file, otherwise it refuses to build
287-
# offline... That cache is an ETS table with all the applications we
288-
# depend on, plus some versioning informations and checksums. There
289-
# are two problems with that: the table contains a date (`last_update`
290-
# field) and `ets:tab2file()` produces a different file each time it's
291-
# called.
292-
#
293-
# To make our source archive reproducible, we fix the time of the
294-
# `last_update` field to the last Git commit and dump the content of the
295-
# table as an Erlang term to a text file.
296-
#
297-
# The ETS file must be recreated before compiling RabbitMQ. See the
298-
# `restore-hex-cache-ets-file` Make target.
299-
$(verbose) $(call erlang,$(call dump_hex_cache_to_erl_term,$(call core_native_path,$@),$(call core_native_path,[email protected])))
300226
# Fix file timestamps to have reproducible source archives.
301227
$(verbose) find $@ -print0 | xargs -0 touch -t "$$(cat "[email protected]")"
302228
303229

304-
define dump_hex_cache_to_erl_term
305-
In = "$(1)/deps/.hex/cache.ets",
306-
Out = "$(1)/deps/.hex/cache.erl",
307-
{ok, DateStr} = file:read_file("$(2)"),
308-
{match, Date} = re:run(DateStr,
309-
"^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})\.([0-9]{2})",
310-
[{capture, all_but_first, list}]),
311-
[Year, Month, Day, Hour, Min, Sec] = [erlang:list_to_integer(V) || V <- Date],
312-
{ok, Tab} = ets:file2tab(In),
313-
true = ets:insert(Tab, {last_update, {{Year, Month, Day}, {Hour, Min, Sec}}}),
314-
Props = [
315-
Prop
316-
|| {Key, _} = Prop <- ets:info(Tab),
317-
Key =:= name orelse
318-
Key =:= type orelse
319-
Key =:= protection orelse
320-
Key =:= named_table orelse
321-
Key =:= keypos orelse
322-
Key =:= heir orelse
323-
Key =:= read_concurrency orelse
324-
Key =:= write_concurrency orelse
325-
Key =:= compressed],
326-
Entries = ets:tab2list(Tab),
327-
ok = file:write_file(Out, io_lib:format("~w.~n~w.~n", [Props, Entries])),
328-
ok = file:delete(In),
329-
init:stop().
330-
endef
331-
332230
$(SOURCE_DIST).manifest: $(SOURCE_DIST)
333231
$(gen_verbose) cd $(dir $(SOURCE_DIST)) && \
334232
find $(notdir $(SOURCE_DIST)) | LC_COLLATE=C sort > $@

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)