Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
rabbitmq-components.mk: Improve top-level DEPS_DIR detection
Browse files Browse the repository at this point in the history
In addition to the `rabbitmq-components.mk` existence check, we now
verfy that the directory is named `deps`.

This is to increase the chance that, if we find a
`rabbitmq-componentS.mk` file in the upper directories, this project is
indeed inside a DEPS_DIR.

For instance, in our GitHub Actions workflows, when we prepared the
secondary umbrellas for mixed-version testing, it happened that the
secondary umbrellas were under a clone of rabbitmq-server. Therefore
the first (and only) condition was met and the Makefile erroneously
considered it was inside a DEPS_DIR. As a consequence, dependencies of
the umbrellas were fetched in the wrong place.

(cherry picked from commit 9740d03)
  • Loading branch information
dumbbell committed Jul 31, 2020
1 parent 0a460ed commit 34c580b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions mk/rabbitmq-components.mk
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,22 @@ prepare-dist::
# disable `make distclean` so $(DEPS_DIR) is not accidentally removed.

ifneq ($(wildcard ../../rabbitmq-components.mk),)
DISABLE_DISTCLEAN = 1
DEPS_DIR ?= $(abspath ..)
supposed_deps_dir = $(abspath ..)
else ifneq ($(wildcard ../../../../rabbitmq-components.mk),)
DISABLE_DISTCLEAN = 1
DEPS_DIR ?= $(abspath ../../..)
supposed_deps_dir = $(abspath ../../..)
else ifneq ($(wildcard UMBRELLA.md),)
DISABLE_DISTCLEAN = 1
endif

# We also verify that the guessed DEPS_DIR is actually named `deps`, to rule
# out any situation where it is a coincidence that we found a
# `rabbitmq-components.mk` up upper directories.

ifeq ($(notdir $(supposed_deps_dir)),deps)
DISABLE_DISTCLEAN = 1
DEPS_DIR ?= $(supposed_deps_dir)
endif

ifeq ($(DISABLE_DISTCLEAN),1)
ifneq ($(filter distclean distclean-deps,$(MAKECMDGOALS)),)
SKIP_DEPS = 1
Expand Down

0 comments on commit 34c580b

Please sign in to comment.