From 17914b9cf9be83c7ff962fff2ac6a2a07731621b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 21 Sep 2020 16:15:09 +0200 Subject: [PATCH] CI: adjust to clang-format-10 automatically - leave clang-format file alone, but dynamically modify it when clang-format 10 or later is present - ignore the resulting .bak file --- .gitignore | 1 + ci/calamaresstyle | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5bf3c57ca..4023c2c49 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,7 @@ CMakeLists.txt.user # Backup files *~ +*.bak # Kate *.kate-swp diff --git a/ci/calamaresstyle b/ci/calamaresstyle index d2ce360bb..bd715eee1 100755 --- a/ci/calamaresstyle +++ b/ci/calamaresstyle @@ -35,7 +35,13 @@ test -n "$CF" || { echo "! No clang-format ($CF_VERSIONS) found in PATH"; exit 1 test -x "$AS" || { echo "! $AS is not executable."; exit 1 ; } test -x "$CF" || { echo "! $CF is not executable."; exit 1 ; } -expr `"$CF" --version | tr -dc '[^.0-9]' | cut -d . -f 1` '<' 10 > /dev/null || { echo "! $CF is version 10 or later, needs different .clang-format" ; exit 1 ; } +unmangle_clang_format="" +if expr `"$CF" --version | tr -dc '[^.0-9]' | cut -d . -f 1` '<' 10 > /dev/null ; then + : +else + unmangle_clang_format=$( dirname $0 )/../.clang-format + echo "SpaceInEmptyBlock: false" >> "$unmangle_clang_format" +fi set -e @@ -65,3 +71,7 @@ if test "x$any_dirs" = "xyes" ; then else style_some "$@" fi + +if test -n "$unmangle_clang_format" ; then + sed -i.bak '/^SpaceInEmptyBlock/d' "$unmangle_clang_format" +fi