~aleteoryx/muditaos

ca4836b64af982a0116d034310020da866e7d880 — Bartosz Cichocki 4 years ago e433e8d
[EGD-7355] Fix clang checking script

Fixed version check
2 files changed, 11 insertions(+), 7 deletions(-)

M config/clang/clang-common.sh
M in_docker.sh
M config/clang/clang-common.sh => config/clang/clang-common.sh +10 -6
@@ 7,19 7,22 @@ set -eo pipefail
verify_clang_format_version()
{
    # check if clang-format in path is in proper version, version is 3rd column in `clang-format --version`
    local clang_format
    clang_format=$( find  /usr/bin/ -regextype egrep -regex ".*/clang-format(-[0-9][0-9])?")
    local version
    version=$( [[ $(which clang-format) ]] && (clang-format --version | cut -d ' ' -f 3 | cut -d '.' -f 1) || echo "0")
    # check for either clang-format or clang-format-9
    if [[ $version -lt 10 && ! $(which clang-format-10) ]]; then
    version=$( [[ $(which $clang_format) ]] && ($clang_format --version | sed "s/.*version \([^ ]*\).*$/\1/" |  cut -d'.' -f1) || echo "0")
    echo $version
    # check for either clang-format or clang-format-11
    if [[ $version -lt 11 ]]; then
        cat << EOF >&1
Either install:
    clang-format in at least version 10 and set as default"
    clang-format in at least version 11 and set as default"
    or
    clang-format-10
    clang-format-11

    Your clang format version in path used:
        $(clang-format --version):
        $(clang-format-10 --version)
        $(clang-format-11 --version)
    git commit aborted"
EOF
        exit 1


@@ 61,6 64,7 @@ get_clang_tidy()
    local searchpaths=(
        "$(which "clang-tidy-diff.py" 2>/dev/null 1>/dev/null)"  # clang-format-diff in path
        "/usr/bin/clang-tidy-diff-10.py"                         # clang-format-diff location on Ubuntu
        "/usr/bin/clang-tidy-diff-12.py"
        "/usr/share/clang/clang-tidy-*/clang-tidy-diff.py"       # clang-format-diff location on Debian
        "/usr/share/clang/clang-tidy-diff.py"                    # clang-format_diff location on Arch last resort
    )

M in_docker.sh => in_docker.sh +1 -1
@@ 3,7 3,7 @@
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

CONTAINER_NAME="wearemudita/mudita_os_builder"
CONTAINER_TAG="1.11"
CONTAINER_TAG="latest"
CONTAINER=${CONTAINER_NAME}:${CONTAINER_TAG}
PURE_HOME=`pwd`
STANDARD_OPTIONS="-v `pwd`:${PURE_HOME} --user \"$(id -u):$(id -g)\" --env HOME=${PURE_HOME} -t"