From ec45d93e3de772b89da665cfb9382a12f258734d Mon Sep 17 00:00:00 2001 From: Kartik Ganesh Date: Thu, 20 Feb 2025 15:38:25 -0800 Subject: [PATCH 1/2] Adding a "build-dist" target to the Makefile This target is identical to the existing "source-dist" target, except that it allows for packaging and testing of the source archive. This is done by including the packaging/ and tests/ directories in the output tarball, along with specific subdirectories that are required by tests. Signed-off-by: Kartik Ganesh (cherry picked from commit aa9e0a5a280b5d8f4c1e03c4f8d6c522ab509ee3) --- Makefile | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index f0a62971d91c..8a26a2400421 100644 --- a/Makefile +++ b/Makefile @@ -138,6 +138,7 @@ endef # -------------------------------------------------------------------- .PHONY: source-dist clean-source-dist +.PHONY: build-dist clean-build-dist SOURCE_DIST_BASE ?= rabbitmq-server SOURCE_DIST_SUFFIXES ?= tar.xz @@ -149,6 +150,13 @@ SOURCE_DIST_FILES = $(addprefix $(SOURCE_DIST).,$(SOURCE_DIST_SUFFIXES)) .PHONY: $(SOURCE_DIST_FILES) +# Override rsync flags as a pre-requisite +build-dist: RSYNC_FLAGS = $(BUILD_DIST_RSYNC_FLAGS) +build-dist: $(SOURCE_DIST_FILES) + @: + +# Override rsync flags as a pre-requisite +source-dist: RSYNC_FLAGS = $(SOURCE_DIST_RSYNC_FLAGS) source-dist: $(SOURCE_DIST_FILES) @: @@ -157,7 +165,9 @@ RSYNC_V_0 = RSYNC_V_1 = -v RSYNC_V_2 = -v RSYNC_V = $(RSYNC_V_$(V)) -RSYNC_FLAGS += -a $(RSYNC_V) \ +BASE_RSYNC_FLAGS += -a $(RSYNC_V) \ + --delete \ + --delete-excluded \ --exclude '.sw?' --exclude '.*.sw?' \ --exclude '*.beam' \ --exclude '*.d' \ @@ -188,12 +198,10 @@ RSYNC_FLAGS += -a $(RSYNC_V) \ --exclude '$(notdir $(DEPS_DIR))/' \ --exclude 'hexer*' \ --exclude 'logs/' \ - --exclude 'packaging' \ --exclude 'PKG_*.md' \ --exclude '/plugins/' \ --include 'cli/plugins' \ --exclude '$(notdir $(DIST_DIR))/' \ - --exclude 'test' \ --exclude '/$(notdir $(PACKAGES_DIR))/' \ --exclude '/PACKAGES/' \ --exclude '/amqp_client/doc/' \ @@ -208,9 +216,21 @@ RSYNC_FLAGS += -a $(RSYNC_V) \ --exclude '/ranch/doc/' \ --exclude '/ranch/examples/' \ --exclude '/sockjs/examples/' \ - --exclude '/workflow_sources/' \ - --delete \ - --delete-excluded + --exclude '/workflow_sources/' + +SOURCE_DIST_RSYNC_FLAGS += $(BASE_RSYNC_FLAGS) \ + --exclude 'packaging' \ + --exclude 'test' + +# For build-dist, explicitly include folders that are needed +# for tests to execute. These are added before excludes from +# the base flags so rsync honors the first match. +BUILD_DIST_RSYNC_FLAGS += \ + --include 'rabbit_shovel_test/ebin' \ + --include 'rabbit_shovel_test/ebin/*' \ + --include 'rabbitmq_ct_helpers/tools' \ + --include 'rabbitmq_ct_helpers/tools/*' \ + $(BASE_RSYNC_FLAGS) TAR ?= tar TAR_V_0 = @@ -375,6 +395,8 @@ $(SOURCE_DIST).zip: $(SOURCE_DIST).manifest clean:: clean-source-dist +clean-build-dist:: clean-source-dist + clean-source-dist: $(gen_verbose) rm -rf -- $(SOURCE_DIST_BASE)-* From 3415fa828d72052d4cf6a74775a320200cec1e98 Mon Sep 17 00:00:00 2001 From: Kartik Ganesh Date: Fri, 21 Feb 2025 13:17:48 -0800 Subject: [PATCH 2/2] Rename "build-dist" target to "source-bundle" This incorporates PR feedback from @michaelklishin Signed-off-by: Kartik Ganesh (cherry picked from commit 741e04b58d3fbc9a9fe625359ae65abc1799286b) --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 8a26a2400421..99d16b3b9648 100644 --- a/Makefile +++ b/Makefile @@ -138,7 +138,7 @@ endef # -------------------------------------------------------------------- .PHONY: source-dist clean-source-dist -.PHONY: build-dist clean-build-dist +.PHONY: source-bundle clean-source-bundle SOURCE_DIST_BASE ?= rabbitmq-server SOURCE_DIST_SUFFIXES ?= tar.xz @@ -151,8 +151,8 @@ SOURCE_DIST_FILES = $(addprefix $(SOURCE_DIST).,$(SOURCE_DIST_SUFFIXES)) .PHONY: $(SOURCE_DIST_FILES) # Override rsync flags as a pre-requisite -build-dist: RSYNC_FLAGS = $(BUILD_DIST_RSYNC_FLAGS) -build-dist: $(SOURCE_DIST_FILES) +source-bundle: RSYNC_FLAGS = $(SOURCE_BUNDLE_RSYNC_FLAGS) +source-bundle: $(SOURCE_DIST_FILES) @: # Override rsync flags as a pre-requisite @@ -222,10 +222,10 @@ SOURCE_DIST_RSYNC_FLAGS += $(BASE_RSYNC_FLAGS) \ --exclude 'packaging' \ --exclude 'test' -# For build-dist, explicitly include folders that are needed +# For source-bundle, explicitly include folders that are needed # for tests to execute. These are added before excludes from # the base flags so rsync honors the first match. -BUILD_DIST_RSYNC_FLAGS += \ +SOURCE_BUNDLE_RSYNC_FLAGS += \ --include 'rabbit_shovel_test/ebin' \ --include 'rabbit_shovel_test/ebin/*' \ --include 'rabbitmq_ct_helpers/tools' \ @@ -395,7 +395,7 @@ $(SOURCE_DIST).zip: $(SOURCE_DIST).manifest clean:: clean-source-dist -clean-build-dist:: clean-source-dist +clean-source-bundle:: clean-source-dist clean-source-dist: $(gen_verbose) rm -rf -- $(SOURCE_DIST_BASE)-*