soc/intel/xeon_sp: Drop uncore_fill_ssdt
[coreboot2.git] / util / lint / helper_functions.sh
blob7abdab86116d57c123b8431c791b26e127157eea
1 #!/usr/bin/env sh
3 # SPDX-License-Identifier: GPL-2.0-only
5 # This file is sourced by the linters so that each one doesn't have to
6 # specify these routines individually
8 LC_ALL=C export LC_ALL
10 if [ -z "$GIT" ]; then
11 GIT="$(command -v git)"
12 else
13 # If git is specified, Do a basic check that it runs and seems like
14 # it's actually git
15 if ! "${GIT}" --version | grep -q git; then
16 echo "Error: ${GIT} does not seem to be valid."
17 exit 1;
21 if [ "$(${GIT} rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then
22 IN_GIT_TREE=1
23 else
24 IN_GIT_TREE=0
27 if [ "${IN_GIT_TREE}" -eq 1 ] && [ -z "${GIT}" ]; then
28 echo "This test needs git to run. Please install it, then run this test again."
29 exit 1
32 # Use git ls-files if the code is in a git repo, otherwise use find.
33 if [ "${IN_GIT_TREE}" -eq 1 ]; then
34 FIND_FILES="${GIT} ls-files"
35 else
36 FIND_FILES="find "
37 FINDOPTS="-type f"
40 # Use git grep if the code is in a git repo, otherwise use grep.
41 if [ "${IN_GIT_TREE}" -eq 1 ]; then
42 GREP_FILES="${GIT} grep"
43 else
44 GREP_FILES="grep -r"