diff options
author | Paul Duffin <paulduffin@google.com> | 2019-05-22 10:54:52 +0100 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2019-05-22 11:02:00 +0100 |
commit | 5b5de803c84ea7927c1df85706004c7930d3a27b (patch) | |
tree | c84d9cefe4fdcbe20e4eeba9131839bcb1ed5f4e /tools | |
parent | d26241542a05bd0825b39ec679e170292c5d5ea4 (diff) |
Use prebuilt bpfmt in upload hook
The bpfmt tool will not always be on the path, e.g. if it has not been
compiled. This switches to use the version that is available in
prebuilts/build-tools/... The path to the bpfmt executable is passed in
to the check-bpfmt.sh script because it depends on the ${BUILD_OS}
placeholder. See tools/repohooks/README.md for more information about
placeholders.
Test: attempted to upload change with badly formatted .bp file.
Change-Id: I4d0d12ed9ef533dae7e47d4ea9d840585d831a3b
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/check-bpfmt.sh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/check-bpfmt.sh b/tools/check-bpfmt.sh index 8ca1df51fa..91dae79f9a 100755 --- a/tools/check-bpfmt.sh +++ b/tools/check-bpfmt.sh @@ -14,11 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -SHA=$1 +BPFMT=$1 +SHA=$2 FIX= for file in $(git show --name-only --pretty=format: $SHA | grep -E "\.bp$"); do - if [[ -n "$(bpfmt -d <(git show $SHA:$file))" ]]; then + if [[ -n "$(${BPFMT} -d <(git show $SHA:$file))" ]]; then FIX="$FIX $file" fi done @@ -27,6 +28,6 @@ if [[ -n "$FIX" ]]; then # Remove leading space. FIX=$(echo $FIX) echo -e "\e[1m\e[31mSome .bp files are incorrectly formatted, run the following commands to fix them:\e[0m" - echo -e "\e[1m\e[31m bpfmt -w $FIX\e[0m" + echo -e "\e[1m\e[31m ${BPFMT} -w $FIX\e[0m" exit 1 fi |