From 0acf08fd586811678a8be84c945039dbbd826dd3 Mon Sep 17 00:00:00 2001 From: Wolfgang Merkt Date: Thu, 6 Jan 2022 22:22:31 +0000 Subject: [PATCH 1/2] Run clang_format_check in deterministic location Implements #767 --- industrial_ci/src/tests/clang_format_check.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/industrial_ci/src/tests/clang_format_check.sh b/industrial_ci/src/tests/clang_format_check.sh index ec2074860..72a4c1ac2 100644 --- a/industrial_ci/src/tests/clang_format_check.sh +++ b/industrial_ci/src/tests/clang_format_check.sh @@ -19,10 +19,10 @@ function prepare_clang_format_check() { true } -function run_clang_format_check() { - local err=0 - local path - ici_make_temp_dir path +function install_clang_format_check() { + local path=/tmp/clang_format_check + mkdir -p "$path" + ici_cleanup_later "$path" # Check whether a specific version of clang-format is desired local clang_format_executable="clang-format${CLANG_FORMAT_VERSION:+-$CLANG_FORMAT_VERSION}" @@ -34,6 +34,11 @@ function run_clang_format_check() { local sources=() ici_parse_env_array sources TARGET_WORKSPACE ici_step "prepare_sourcespace" ici_prepare_sourcespace "$path" "${sources[@]}" +} + +function run_clang_format_check() { + local err=0 + local path=/tmp/clang_format_check ici_time_start run_clang_format_check while read -r file; do From 0fe2bd91be718700dfcc91b984be7b770239ffea Mon Sep 17 00:00:00 2001 From: Wolfgang Merkt Date: Sun, 9 Jan 2022 01:28:49 +0000 Subject: [PATCH 2/2] Fix logic to run clang-format in deterministic location To download a custom config file, use BEFORE_RUN_CLANG_FORMAT_CHECK="wget [my_config] -O /tmp/clang_format_check/[project-name]/.clang-format". You also need to set ADDITIONAL_DEBS=wget --- industrial_ci/src/tests/clang_format_check.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/industrial_ci/src/tests/clang_format_check.sh b/industrial_ci/src/tests/clang_format_check.sh index 72a4c1ac2..b8743f9e1 100644 --- a/industrial_ci/src/tests/clang_format_check.sh +++ b/industrial_ci/src/tests/clang_format_check.sh @@ -19,7 +19,8 @@ function prepare_clang_format_check() { true } -function install_clang_format_check() { +function run_clang_format_check() { + local err=0 local path=/tmp/clang_format_check mkdir -p "$path" ici_cleanup_later "$path" @@ -34,11 +35,6 @@ function install_clang_format_check() { local sources=() ici_parse_env_array sources TARGET_WORKSPACE ici_step "prepare_sourcespace" ici_prepare_sourcespace "$path" "${sources[@]}" -} - -function run_clang_format_check() { - local err=0 - local path=/tmp/clang_format_check ici_time_start run_clang_format_check while read -r file; do