@@ -137,6 +137,7 @@ endef
137
137
# Distribution.
138
138
# --------------------------------------------------------------------
139
139
140
+
140
141
.PHONY : source-dist clean-source-dist
141
142
142
143
SOURCE_DIST_BASE ?= rabbitmq-server
@@ -152,12 +153,26 @@ SOURCE_DIST_FILES = $(addprefix $(SOURCE_DIST).,$(SOURCE_DIST_SUFFIXES))
152
153
source-dist : $(SOURCE_DIST_FILES )
153
154
@:
154
155
156
+ .PHONY : source-bundle clean-source-bundle
157
+
158
+ SOURCE_BUNDLE_BASE ?= rabbitmq-server-bundle
159
+ BUNDLE_DIST ?= $(PACKAGES_DIR ) /$(SOURCE_BUNDLE_BASE ) -$(PROJECT_VERSION )
160
+
161
+ BUNDLE_DIST_FILES = $(addprefix $(BUNDLE_DIST ) .,$(SOURCE_DIST_SUFFIXES ) )
162
+
163
+ .PHONY : $(BUNDLE_DIST_FILES )
164
+
165
+ source-bundle : $(BUNDLE_DIST_FILES )
166
+ @:
167
+
155
168
RSYNC ?= rsync
156
169
RSYNC_V_0 =
157
170
RSYNC_V_1 = -v
158
171
RSYNC_V_2 = -v
159
172
RSYNC_V = $(RSYNC_V_$(V ) )
160
- RSYNC_FLAGS += -a $(RSYNC_V ) \
173
+ BASE_RSYNC_FLAGS += -a $(RSYNC_V ) \
174
+ --delete \
175
+ --delete-excluded \
161
176
--exclude '.sw?' --exclude '.*.sw?' \
162
177
--exclude '*.beam' \
163
178
--exclude '*.d' \
@@ -188,12 +203,10 @@ RSYNC_FLAGS += -a $(RSYNC_V) \
188
203
--exclude '$(notdir $(DEPS_DIR ) ) /' \
189
204
--exclude 'hexer*' \
190
205
--exclude 'logs/' \
191
- --exclude 'packaging' \
192
206
--exclude 'PKG_*.md' \
193
207
--exclude '/plugins/' \
194
208
--include 'cli/plugins' \
195
209
--exclude '$(notdir $(DIST_DIR ) ) /' \
196
- --exclude 'test' \
197
210
--exclude '/$(notdir $(PACKAGES_DIR ) ) /' \
198
211
--exclude '/PACKAGES/' \
199
212
--exclude '/amqp_client/doc/' \
@@ -208,9 +221,21 @@ RSYNC_FLAGS += -a $(RSYNC_V) \
208
221
--exclude '/ranch/doc/' \
209
222
--exclude '/ranch/examples/' \
210
223
--exclude '/sockjs/examples/' \
211
- --exclude '/workflow_sources/' \
212
- --delete \
213
- --delete-excluded
224
+ --exclude '/workflow_sources/'
225
+
226
+ SOURCE_DIST_RSYNC_FLAGS += $(BASE_RSYNC_FLAGS ) \
227
+ --exclude 'packaging' \
228
+ --exclude 'test'
229
+
230
+ # For source-bundle, explicitly include folders that are needed
231
+ # for tests to execute. These are added before excludes from
232
+ # the base flags so rsync honors the first match.
233
+ SOURCE_BUNDLE_RSYNC_FLAGS += \
234
+ --include 'rabbit_shovel_test/ebin' \
235
+ --include 'rabbit_shovel_test/ebin/*' \
236
+ --include 'rabbitmq_ct_helpers/tools' \
237
+ --include 'rabbitmq_ct_helpers/tools/*' \
238
+ $(BASE_RSYNC_FLAGS )
214
239
215
240
TAR ?= tar
216
241
TAR_V_0 =
@@ -233,14 +258,14 @@ ZIP_V = $(ZIP_V_$(V))
233
258
234
259
$(SOURCE_DIST ) : $(ERLANG_MK_RECURSIVE_DEPS_LIST )
235
260
$(verbose ) mkdir -p $(dir $@ )
236
- $(gen_verbose ) $(RSYNC ) $(RSYNC_FLAGS ) ./ $@ /
261
+ $(gen_verbose ) $(RSYNC ) $(SOURCE_DIST_RSYNC_FLAGS ) ./ $@ /
237
262
$(verbose ) echo " $( PROJECT_DESCRIPTION) $( PROJECT_VERSION) " > " $@ /git-revisions.txt"
238
263
$(verbose ) echo " $( PROJECT) $$ (git rev-parse HEAD) $$ (git describe --tags --exact-match 2>/dev/null || git symbolic-ref -q --short HEAD)" >> " $@ /git-revisions.txt"
239
264
$(verbose ) echo " $$ (TZ= git --no-pager log -n 1 --format='%cd' --date='format-local:%Y%m%d%H%M.%S')" > " $@ .git-times.txt"
240
265
$(verbose ) cat packaging/common/LICENSE.head > $@ /LICENSE
241
266
$(verbose ) mkdir -p $@ /deps/licensing
242
267
$(verbose ) set -e; for dep in $$ (cat $( ERLANG_MK_RECURSIVE_DEPS_LIST) | LC_COLLATE=C sort); do \
243
- $(RSYNC ) $(RSYNC_FLAGS ) \
268
+ $(RSYNC ) $(SOURCE_DIST_RSYNC_FLAGS ) \
244
269
$$ dep \
245
270
$@ /deps; \
246
271
rm -f \
@@ -287,6 +312,11 @@ $(SOURCE_DIST): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
287
312
$(verbose ) echo " PLUGINS := $( PLUGINS) " > $@ /plugins.mk
288
313
# Remember the latest Git timestamp.
289
314
$(verbose) sort -r < "
[email protected] " | head -n 1 > "
[email protected] "
315
+ $(verbose) $(call erlang,$(call dump_hex_cache_to_erl_term,$(call core_native_path,$@),$(call core_native_path,
[email protected] )))
316
+ # Fix file timestamps to have reproducible source archives.
317
+ $(verbose) find $@ -print0 | xargs -0 touch -t "$$(cat "
[email protected] ")"
318
+
319
+
290
320
# Mix Hex component requires a cache file, otherwise it refuses to build
291
321
# offline... That cache is an ETS table with all the applications we
292
322
# depend on, plus some versioning informations and checksums. There
@@ -300,11 +330,6 @@ $(SOURCE_DIST): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
300
330
#
301
331
# The ETS file must be recreated before compiling RabbitMQ. See the
302
332
# `restore-hex-cache-ets-file` Make target.
303
- $(verbose) $(call erlang,$(call dump_hex_cache_to_erl_term,$(call core_native_path,$@),$(call core_native_path,
[email protected] )))
304
- # Fix file timestamps to have reproducible source archives.
305
- $(verbose) find $@ -print0 | xargs -0 touch -t "$$(cat "
[email protected] ")"
306
-
307
-
308
333
define dump_hex_cache_to_erl_term
309
334
In = "$(1 ) /deps/.hex/cache.ets",
310
335
Out = "$(1 ) /deps/.hex/cache.erl",
@@ -333,10 +358,77 @@ define dump_hex_cache_to_erl_term
333
358
init:stop().
334
359
endef
335
360
361
+ .PHONY : $(BUNDLE_DIST )
362
+
363
+ $(BUNDLE_DIST ) : $(ERLANG_MK_RECURSIVE_DEPS_LIST )
364
+ $(verbose ) mkdir -p $(dir $@ )
365
+ $(gen_verbose ) $(RSYNC ) $(SOURCE_BUNDLE_RSYNC_FLAGS ) ./ $@ /
366
+ $(verbose ) echo " $( PROJECT_DESCRIPTION) $( PROJECT_VERSION) " > " $@ /git-revisions.txt"
367
+ $(verbose ) echo " $( PROJECT) $$ (git rev-parse HEAD) $$ (git describe --tags --exact-match 2>/dev/null || git symbolic-ref -q --short HEAD)" >> " $@ /git-revisions.txt"
368
+ $(verbose ) echo " $$ (TZ= git --no-pager log -n 1 --format='%cd' --date='format-local:%Y%m%d%H%M.%S')" > " $@ .git-times.txt"
369
+ $(verbose ) cat packaging/common/LICENSE.head > $@ /LICENSE
370
+ $(verbose ) mkdir -p $@ /deps/licensing
371
+ $(verbose ) set -e; for dep in $$ (cat $( ERLANG_MK_RECURSIVE_DEPS_LIST) | LC_COLLATE=C sort); do \
372
+ $(RSYNC ) $(SOURCE_BUNDLE_RSYNC_FLAGS ) \
373
+ $$ dep \
374
+ $@ /deps; \
375
+ rm -f \
376
+ $@ /deps/rabbit_common/rebar.config \
377
+ $@ /deps/rabbit_common/rebar.lock; \
378
+ if test -f $@ /deps/$$ (basename $$ dep)/erlang.mk && \
379
+ test " $$ (wc -l $@ /deps/$$ (basename $$ dep)/erlang.mk | awk '{print $$ 1;}')" = " 1" && \
380
+ grep -qs -E " ^[[:blank:]]*include[[:blank:]]+(erlang\.mk|.*/erlang\.mk)$$ " $@ /deps/$$(basename $$dep) /erlang.mk; then \
381
+ echo " include ../../erlang.mk" > $@ /deps/$$(basename $$dep) /erlang.mk; \
382
+ fi ; \
383
+ sed -E -i.bak " s|^[[:blank:]]*include[[:blank:]]+\.\./.*erlang.mk$$ |include ../../erlang.mk|" \
384
+ $@ /deps/$$(basename $$dep) /Makefile && \
385
+ rm $@ /deps/$$(basename $$dep) /Makefile.bak; \
386
+ mix_exs=$@ /deps/$$(basename $$dep) /mix.exs; \
387
+ if test -f $$ mix_exs; then \
388
+ (cd $$ (dirname " $$ mix_exs" ) && \
389
+ (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) && \
390
+ env DEPS_DIR=$@ /deps MIX_HOME=$@ /deps/.mix HEX_HOME=$@ /deps/.hex MIX_ENV=prod FILL_HEX_CACHE=yes mix deps.get --only prod && \
391
+ cp $(CURDIR ) /mk/rabbitmq-mix.mk . && \
392
+ rm -rf _build deps); \
393
+ fi ; \
394
+ if test -f " $$ dep/license_info" ; then \
395
+ cp " $$ dep/license_info" " $@ /deps/licensing/license_info_$$ (basename " $$ dep" )" ; \
396
+ cat " $$ dep/license_info" >> $@ /LICENSE; \
397
+ fi ; \
398
+ find " $$ dep" -maxdepth 1 -name ' LICENSE-*' -exec cp ' {}' $@ /deps/licensing \; ; \
399
+ (cd $$ dep; \
400
+ echo " $$ (basename " $$ dep" ) $$ (git rev-parse HEAD) $$ (git describe --tags --exact-match 2>/dev/null || git symbolic-ref -q --short HEAD)" ) \
401
+ >> " $@ /git-revisions.txt" ; \
402
+ ! test -d $$ dep/.git || (cd $$ dep; \
403
+ echo " $$ (env TZ= git --no-pager log -n 1 --format='%cd' --date='format-local:%Y%m%d%H%M.%S')" ) \
404
+ >> " $@ .git-times.txt" ; \
405
+ done
406
+ $(verbose ) cat packaging/common/LICENSE.tail >> $@ /LICENSE
407
+ $(verbose ) find $@ /deps/licensing -name ' LICENSE-*' -exec cp ' {}' $@ \;
408
+ $(verbose ) rm -rf $@ /deps/licensing
409
+ $(verbose ) for file in $$ (find $@ -name ' *.app.src' ); do \
410
+ sed -E -i.bak \
411
+ -e ' s/[{]vsn[[:blank:]]*,[[:blank:]]*(""|"0.0.0")[[:blank:]]*}/{vsn, "$(PROJECT_VERSION)"}/' \
412
+ -e ' s/[{]broker_version_requirements[[:blank:]]*,[[:blank:]]*\[\][[:blank:]]*}/{broker_version_requirements, ["$(PROJECT_VERSION)"]}/' \
413
+ $$ file; \
414
+ rm $$ file.bak; \
415
+ done
416
+ $(verbose ) echo " PLUGINS := $( PLUGINS) " > $@ /plugins.mk
417
+ # Remember the latest Git timestamp.
418
+ $(verbose) sort -r < "
[email protected] " | head -n 1 > "
[email protected] "
419
+ $(verbose) $(call erlang,$(call dump_hex_cache_to_erl_term,$(call core_native_path,$@),$(call core_native_path,
[email protected] )))
420
+ # Fix file timestamps to have reproducible source archives.
421
+ $(verbose) find $@ -print0 | xargs -0 touch -t "$$(cat "
[email protected] ")"
422
+
423
+
336
424
$(SOURCE_DIST ) .manifest : $(SOURCE_DIST )
337
425
$(gen_verbose ) cd $(dir $(SOURCE_DIST ) ) && \
338
426
find $(notdir $(SOURCE_DIST ) ) | LC_COLLATE=C sort > $@
339
427
428
+ $(BUNDLE_DIST ) .manifest : $(BUNDLE_DIST )
429
+ $(gen_verbose ) cd $(dir $(BUNDLE_DIST ) ) && \
430
+ find $(notdir $(BUNDLE_DIST ) ) | LC_COLLATE=C sort > $@
431
+
340
432
ifeq ($(shell tar --version | grep -c "GNU tar") ,0)
341
433
# Skip all flags if this is Darwin (a.k.a. macOS, a.k.a. OS X)
342
434
ifeq ($(shell uname | grep -c "Darwin") ,0)
@@ -373,11 +465,34 @@ $(SOURCE_DIST).zip: $(SOURCE_DIST).manifest
373
465
$(gen_verbose ) cd $(dir $(SOURCE_DIST ) ) && \
374
466
$(ZIP ) $(ZIP_V ) --names-stdin $@ < $(SOURCE_DIST ) .manifest
375
467
468
+ $(BUNDLE_DIST ) .tar.gz : $(BUNDLE_DIST ) .manifest
469
+ $(gen_verbose ) cd $(dir $(BUNDLE_DIST ) ) && \
470
+ $(TAR ) $(TAR_V ) $(TAR_FLAGS_FOR_REPRODUCIBLE_BUILDS ) --no-recursion -T $(BUNDLE_DIST ) .manifest -cf - | \
471
+ $(GZIP ) --best > $@
472
+
473
+ $(BUNDLE_DIST ) .tar.bz2 : $(BUNDLE_DIST ) .manifest
474
+ $(gen_verbose ) cd $(dir $(BUNDLE_DIST ) ) && \
475
+ $(TAR ) $(TAR_V ) $(TAR_FLAGS_FOR_REPRODUCIBLE_BUILDS ) --no-recursion -T $(BUNDLE_DIST ) .manifest -cf - | \
476
+ $(BZIP2 ) > $@
477
+
478
+ $(BUNDLE_DIST ) .tar.xz : $(BUNDLE_DIST ) .manifest
479
+ $(gen_verbose ) cd $(dir $(BUNDLE_DIST ) ) && \
480
+ $(TAR ) $(TAR_V ) $(TAR_FLAGS_FOR_REPRODUCIBLE_BUILDS ) --no-recursion -T $(BUNDLE_DIST ) .manifest -cf - | \
481
+ $(XZ ) > $@
482
+
483
+ $(BUNDLE_DIST ) .zip : $(BUNDLE_DIST ) .manifest
484
+ $(verbose ) rm -f $@
485
+ $(gen_verbose ) cd $(dir $(BUNDLE_DIST ) ) && \
486
+ $(ZIP ) $(ZIP_V ) --names-stdin $@ < $(BUNDLE_DIST ) .manifest
487
+
376
488
clean :: clean-source-dist
377
489
378
490
clean-source-dist :
379
491
$(gen_verbose ) rm -rf -- $(SOURCE_DIST_BASE ) -*
380
492
493
+ clean-source-bundle :
494
+ $(gen_verbose ) rm -rf -- $(SOURCE_BUNDLE_BASE ) -*
495
+
381
496
distclean :: distclean-packages
382
497
383
498
distclean-packages :
0 commit comments