diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2021-10-05 08:51:08 -0400 |
---|---|---|
committer | Jordan Petridis <jordan@centricular.com> | 2021-10-05 23:44:03 +0300 |
commit | cf912f6d15f62fc93e8c0d1ad5e64ba5c8870ccd (patch) | |
tree | 90dceadaa609b8d8d6d6d45969379723dc7a73eb /scripts | |
parent | bc40073836a43edc9a0151cd528b0676b69b1fb8 (diff) | |
download | gstreamer-cf912f6d15f62fc93e8c0d1ad5e64ba5c8870ccd.tar.gz |
ci: Fix gst-indent path
It used to be downloaded into PATH, but we can now instead run it from
git. Also move it to top source dir instead of gstreamer subproject.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/931>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/gst-indent | 45 | ||||
-rwxr-xr-x | scripts/gst-indent-all | 5 |
2 files changed, 49 insertions, 1 deletions
diff --git a/scripts/gst-indent b/scripts/gst-indent new file mode 100755 index 0000000000..a9b8bfe430 --- /dev/null +++ b/scripts/gst-indent @@ -0,0 +1,45 @@ +#!/bin/sh + +for execname in gnuindent gindent indent; do + version=`$execname --version 2>/dev/null` + if test "x$version" != "x"; then + INDENT=$execname + break + fi +done + +if test -z $INDENT; then + echo "GStreamer git pre-commit hook:" + echo "Did not find GNU indent, please install it before continuing." + exit 1 +fi + +case `$INDENT --version` in + GNU*) + ;; + default) + echo "Did not find GNU indent, please install it before continuing." + echo "(Found $INDENT, but it doesn't seem to be GNU indent)" + exit 1 + ;; +esac + +# Run twice. GNU indent isn't idempotent +# when run once +for i in 1 2; do +$INDENT \ + --braces-on-if-line \ + --case-brace-indentation0 \ + --case-indentation2 \ + --braces-after-struct-decl-line \ + --line-length80 \ + --no-tabs \ + --cuddle-else \ + --dont-line-up-parentheses \ + --continuation-indentation4 \ + --honour-newlines \ + --tab-size8 \ + --indent-level2 \ + --leave-preprocessor-space \ + $* || exit $? +done diff --git a/scripts/gst-indent-all b/scripts/gst-indent-all index c0580b1aed..ee878d838b 100755 --- a/scripts/gst-indent-all +++ b/scripts/gst-indent-all @@ -1,5 +1,8 @@ #!/bin/bash +BASEDIR=$(dirname $0) + + filter_cmd=("cat") if test -f ".indentignore"; then filter_args=() @@ -12,4 +15,4 @@ if test -f ".indentignore"; then filter_cmd=("grep" "-v" "${filter_args[@]}") fi fi -git ls-files "*.c" | "${filter_cmd[@]}" | xargs -d '\n' gst-indent +git ls-files "*.c" | "${filter_cmd[@]}" | xargs -d '\n' $BASEDIR/gst-indent |