Tool bundle updates (#693)

* Pre-commit --cached vs. less-efficient iteration

 * During pre-commit, leverage the git cppcheck --cached
   form instead of iterating over the cached files and
   invoking git cppcheck on each to eliminate
   redundant static analysis

* Add support for Debian Linux on ARM

* Check prerequisite tool minimum versions

 * Bootstrapping will now confirm that each
   prerequisite tool satisfies the minimum version
   required
This commit is contained in:
Bruce Lacey
2016-12-18 11:57:59 +01:00
committed by Olivier
parent 3be2516ef8
commit 6a68510d57
3 changed files with 22 additions and 22 deletions
+4 -3
View File
@@ -6,12 +6,13 @@
# #
## ##
log() { IFS=" "; >&2 printf "%s\n" "$*"; } log() { IFS=" "; >&2 printf "%s\n" "$*"; }
warn() { IFS=" "; >&2 printf "\e[33m%s\e[m\n" "$*"; } info() { IFS=" "; >&2 printf "\e[92m%s\e[m\n" "$*"; }
err() { IFS=" "; >&2 printf '\e[31m%s\e[m\n' "$*"; exit 1; } warn() { IFS=" "; >&2 printf "\e[93m%s\e[m\n" "$*"; }
err() { IFS=" "; >&2 printf "\e[91m%s\e[m\n" "$*"; exit 1; }
is_supported_os() is_supported_os()
{ {
[[ ${1} == darwin* ]] || [[ ${1} == linux-gnu ]] || [[ ${1} == freebsd ]] || [[ ${1} == msys ]] || [[ ${1} == cygwin ]] [[ ${1} == darwin* ]] || [[ ${1} == linux-gnu* ]] || [[ ${1} == freebsd ]] || [[ ${1} == msys ]] || [[ ${1} == cygwin ]]
} }
is_installed() is_installed()
+17 -10
View File
@@ -13,16 +13,21 @@
# Import common utility functions and environment variables # Import common utility functions and environment variables
. "$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)/.bundle_runtime.sh" . "$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)/.bundle_runtime.sh"
check_tool_prerequisites() check_tool_prerequisite()
{ {
local err=0 function ver { printf "%03d%03d%03d%03d" $(echo "$1" | tr '.' ' '); }
for preReq in ${1}; do
if ! is_installed $preReq; then if is_installed ${1} ; then
warn "$preReq not installed or not in current path." #local version=$(${1} --version 2>&1 | sed -e 's/[[:alpha:]|(|[:space:]]//g')
err=1 local version=$(${1} --version 2>&1 | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p')
if [ $(ver ${version}) -lt $(ver ${2}) ]; then
warn "Found ${1} ${version} however, version ${2} or greater is required..."
return 1
fi fi
done else
return $err warn "${1} not installed or not in current path."
return 1
fi
} }
check_git_remote() check_git_remote()
@@ -68,7 +73,9 @@ check_git_remote "upstream" "${mysrepo}" || {
#3 #3
log "Checking tool/utility prerequisites..." log "Checking tool/utility prerequisites..."
check_tool_prerequisites "astyle cppcheck" || err "One or more required tools not found. Install required tools and re-run ${0}" check_tool_prerequisite "astyle" "2.0.5" || err "Install AStyle 2.0.5 or greater and re-run ${0}"
check_tool_prerequisite "cppcheck" "1.76" || err "Install Cppcheck 1.76 or greater and re-run ${0}"
check_tool_prerequisite "git" "2.0" || err "Install git 2.0 or greater and re-run ${0}"
#4 #4
log "Installing client-side git hooks..." log "Installing client-side git hooks..."
@@ -80,4 +87,4 @@ configure_git_tool_aliases || err "Failed to create git aliases due to error $?.
bootstrap_version "--set" bootstrap_version "--set"
log "Successfully configured your repo for MySensors development... Thanks for your support!" info "Successfully configured your repo for MySensors development... Thanks for your support!"
+1 -9
View File
@@ -20,14 +20,6 @@ done
### ###
# cppcheck # cppcheck
# #
errorsDetected=0 git cppcheck --cached || err "Correct the errors until cppcheck passes using 'git cppcheck --cached'."
for file in $(stagedSourceFiles); do
if ! git cppcheck $file >/dev/null; then
warn "$file failed static analysis."
errorsDetected=1
fi
done
[ $errorsDetected == 1 ] && err "Correct the errors until cppcheck passees using 'git cppcheck --cached'."
exit 0 exit 0