Make test/development related makefile vars lazy

They were trying to run `hostname` and `which`, which produced a bunch
of error messages in a hermetic build environment.

And performance of those `shell` calls is not very important, as they
are caled just a few times during script runtime anyway (there is a
hack to make these lazy, but evaluating only once - but it's hardly
worth it).
This commit is contained in:
Alexey Lebedeff 2021-08-06 17:32:04 +02:00
parent ad9b4aafb5
commit 87532c4af4
3 changed files with 9 additions and 9 deletions

View File

@ -67,12 +67,12 @@ node_enabled_plugins_file = $(call node_tmpdir,$(1))/enabled_plugins
# Broker startup variables for the test environment.
ifeq ($(PLATFORM),msys2)
HOSTNAME := $(COMPUTERNAME)
HOSTNAME = $(COMPUTERNAME)
else
ifeq ($(PLATFORM),solaris)
HOSTNAME := $(shell hostname | sed 's@\..*@@')
HOSTNAME = $(shell hostname | sed 's@\..*@@')
else
HOSTNAME := $(shell hostname -s)
HOSTNAME = $(shell hostname -s)
endif
endif
@ -265,8 +265,8 @@ endif
endif
run-broker run-tls-broker: RABBITMQ_CONFIG_FILE := $(basename $(TEST_CONFIG_FILE))
run-broker: config := $(test_rabbitmq_config)
run-tls-broker: config := $(test_rabbitmq_config_with_tls)
run-broker: config = $(test_rabbitmq_config)
run-tls-broker: config = $(test_rabbitmq_config_with_tls)
run-tls-broker: $(TEST_TLS_CERTS_DIR)
run-broker run-tls-broker: node-tmpdir $(DIST_TARGET) $(TEST_CONFIG_FILE)

View File

@ -1,10 +1,10 @@
ifeq ($(PLATFORM),msys2)
HOSTNAME := $(COMPUTERNAME)
HOSTNAME = $(COMPUTERNAME)
else
ifeq ($(PLATFORM),solaris)
HOSTNAME := $(shell hostname | sed 's@\..*@@')
HOSTNAME = $(shell hostname | sed 's@\..*@@')
else
HOSTNAME := $(shell hostname -s)
HOSTNAME = $(shell hostname -s)
endif
endif

View File

@ -28,7 +28,7 @@ build --flaky_test_attempts=1
build:buildbuddy --remote_header=x-buildbuddy-api-key=YOUR_API_KEY
endef
export USER_BAZELRC
user.bazelrc: export USER_BAZELRC
user.bazelrc:
echo "$$USER_BAZELRC" > $@