1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #17396 from fjmolinas/pr_docker_env_vars_allways

makefiles/docker.inc.mk: add DOCKER_ENV_VARS_ALWAYS
This commit is contained in:
Dylan Laduranty 2022-03-02 22:02:02 +01:00 committed by GitHub
commit bd49ea91db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View File

@ -344,6 +344,7 @@ check_no_riot_config() {
pathspec+=('**/Makefile*')
pathspec+=('**/*.mk')
pathspec+=(':!makefiles/kconfig.mk')
pathspec+=(':!makefiles/docker.inc.mk')
git -C "${RIOTBASE}" grep -n "${patterns[@]}" -- "${pathspec[@]}" \
| error_with_message "Don't push RIOT_CONFIG_* definitions upstream. Rather define configuration via Kconfig"
}

View File

@ -24,6 +24,7 @@ export DOCKER_MAKECMDGOALS ?= all
# List of all exported environment variables that shall be passed on to the
# Docker container, they will only be passed if they are set from the
# environment, not if they are only default Makefile values.
DOCKER_RIOT_CONFIG_VARIABLES := $(filter RIOT_CONFIG_%,$(.VARIABLES))
export DOCKER_ENV_VARS += \
APPDIR \
AR \
@ -44,6 +45,7 @@ export DOCKER_ENV_VARS += \
CXX \
CXXEXFLAGS \
CXXUWFLAGS \
$(DOCKER_RIOT_CONFIG_VARIABLES) \
ELFFILE \
HEXFILE \
FLASHFILE \
@ -71,6 +73,23 @@ export DOCKER_ENV_VARS += \
UNDEF \
#
# List of all exported environment variables that shall be passed on to the
# Docker container since they might have been set through the command line
# and environment.
# Their origin cannot be checked since they are often redefined or overriden
# in Makefile/Makefile.include, etc. and their origin is changed to file
export DOCKER_ENV_VARS_ALWAYS += \
CFLAGS \
DISABLE_MODULE \
DEFAULT_MODULE \
FEATURES_REQUIRED \
FEATURES_BLACKLIST \
FEATURES_OPTIONAL \
USEMODULE \
USEPKG \
KCONFIG_ADD_CONFIG \
#
# Find which variables were set using the command line or the environment and
# pass those to Docker.
# DOCKER_ENVIRONMENT_CMDLINE must be immediately assigned (:=) or otherwise some
@ -82,6 +101,14 @@ DOCKER_ENVIRONMENT_CMDLINE_AUTO := $(foreach varname,$(DOCKER_ENV_VARS), \
))
DOCKER_ENVIRONMENT_CMDLINE += $(strip $(DOCKER_ENVIRONMENT_CMDLINE_AUTO))
# Pass variables potentially set through command line or environment
# DOCKER_ENVIRONMENT_CMDLINE_ALWAYS is immediately assigned since this only wants
# to capture variables set via the environment or command line. This will still
# include variables set with '=' or '+=' in the application Makefile since these
# are included before evaluating DOCKER_ENVIRONMENT_CMDLINE_ALWAYS
DOCKER_ENVIRONMENT_CMDLINE_ALWAYS := $(foreach varname,$(DOCKER_ENV_VARS_ALWAYS), \
-e '$(varname)=$(subst ','\'',$(sort $($(varname))))')
DOCKER_ENVIRONMENT_CMDLINE += $(strip $(DOCKER_ENVIRONMENT_CMDLINE_ALWAYS))
# The variables set on the command line will also be passed on the command line
# in Docker