diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2021-09-24 14:11:13 -0400 |
---|---|---|
committer | Thibault Saunier <tsaunier@igalia.com> | 2021-09-24 17:47:01 -0300 |
commit | 3037fde5ebddf3d755d29b4f06f21e6ca122d484 (patch) | |
tree | fa88032ccbf34d03c5cbd56b52073cfa6ef9cb8b /subprojects/gst-omx | |
parent | 776d8a661720b05861ab797cca01ef37fdaf6b78 (diff) | |
download | gstreamer-3037fde5ebddf3d755d29b4f06f21e6ca122d484.tar.gz |
Move commit gst-indent hook to the rootmonorepo-start
This renable at meson setup time the installation of the gst-indent
commit hook. The hooks were kept from gst-devtools as this set supports
both C checks and Python checks.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/904>
Diffstat (limited to 'subprojects/gst-omx')
-rwxr-xr-x | subprojects/gst-omx/hooks/pre-commit.hook | 83 | ||||
-rw-r--r-- | subprojects/gst-omx/meson.build | 3 |
2 files changed, 0 insertions, 86 deletions
diff --git a/subprojects/gst-omx/hooks/pre-commit.hook b/subprojects/gst-omx/hooks/pre-commit.hook deleted file mode 100755 index 3c1062b9e0..0000000000 --- a/subprojects/gst-omx/hooks/pre-commit.hook +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh -# -# Check that the code follows a consistant code style -# - -# Check for existence of indent, and error out if not present. -# On some *bsd systems the binary seems to be called gnunindent, -# so check for that first. - -version=`gnuindent --version 2>/dev/null` -if test "x$version" = "x"; then - version=`gindent --version 2>/dev/null` - if test "x$version" = "x"; then - version=`indent --version 2>/dev/null` - if test "x$version" = "x"; then - echo "GStreamer git pre-commit hook:" - echo "Did not find GNU indent, please install it before continuing." - exit 1 - else - INDENT=indent - fi - else - INDENT=gindent - fi -else - INDENT=gnuindent -fi - -case `$INDENT --version` in - GNU*) - ;; - default) - echo "GStreamer git pre-commit hook:" - 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 - -INDENT_PARAMETERS="--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" - -echo "--Checking style--" -for file in `git diff-index --cached --name-only HEAD --diff-filter=ACMR| grep "\.c$"` ; do - # nf is the temporary checkout. This makes sure we check against the - # revision in the index (and not the checked out version). - nf=`git checkout-index --temp ${file} | cut -f 1` - newfile=`mktemp /tmp/${nf}.XXXXXX` || exit 1 - $INDENT ${INDENT_PARAMETERS} \ - $nf -o $newfile 2>> /dev/null - # FIXME: Call indent twice as it tends to do line-breaks - # different for every second call. - $INDENT ${INDENT_PARAMETERS} \ - $newfile 2>> /dev/null - diff -u -p "${nf}" "${newfile}" - r=$? - rm "${newfile}" - rm "${nf}" - if [ $r != 0 ] ; then -echo "=================================================================================================" -echo " Code style error in: $file " -echo " " -echo " Please fix before committing. Don't forget to run git add before trying to commit again. " -echo " If the whole file is to be committed, this should work (run from the top-level directory): " -echo " " -echo " gst-indent $file; git add $file; git commit" -echo " " -echo "=================================================================================================" - exit 1 - fi -done -echo "--Checking style pass--" diff --git a/subprojects/gst-omx/meson.build b/subprojects/gst-omx/meson.build index d37fc7bd77..37cdecb63f 100644 --- a/subprojects/gst-omx/meson.build +++ b/subprojects/gst-omx/meson.build @@ -427,6 +427,3 @@ if gst_version_nano == 0 endif configure_file(output: 'config.h', configuration: cdata) - -python3 = find_program('python3') -run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")') |