From 3037fde5ebddf3d755d29b4f06f21e6ca122d484 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 24 Sep 2021 14:11:13 -0400 Subject: [PATCH] Move commit gst-indent hook to the root 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: --- meson.build | 3 + .../git-hooks}/multi-pre-commit.hook | 2 +- .../git-hooks}/pre-commit-python.hook | 0 .../hooks => scripts/git-hooks}/pre-commit.hook | 0 subprojects/gst-devtools/hooks/pre-commit.hook | 83 --------------- .../gst-editing-services/hooks/pre-commit.hook | 83 --------------- subprojects/gst-editing-services/meson.build | 2 - subprojects/gst-libav/hooks/pre-commit.hook | 83 --------------- subprojects/gst-libav/meson.build | 3 - subprojects/gst-omx/hooks/pre-commit.hook | 83 --------------- subprojects/gst-omx/meson.build | 3 - subprojects/gst-plugins-bad/hooks/pre-commit.hook | 83 --------------- subprojects/gst-plugins-bad/meson.build | 2 - subprojects/gst-plugins-base/hooks/pre-commit.hook | 83 --------------- subprojects/gst-plugins-base/meson.build | 2 - subprojects/gst-plugins-good/hooks/pre-commit.hook | 83 --------------- subprojects/gst-plugins-good/meson.build | 2 - subprojects/gst-plugins-ugly/hooks/pre-commit.hook | 83 --------------- subprojects/gst-plugins-ugly/meson.build | 2 - subprojects/gst-python/meson.build | 2 - subprojects/gst-rtsp-server/hooks/pre-commit.hook | 83 --------------- subprojects/gst-rtsp-server/meson.build | 3 - subprojects/gstreamer-vaapi/hooks/pre-commit.hook | 83 --------------- subprojects/gstreamer-vaapi/meson.build | 3 - subprojects/gstreamer/hooks/pre-commit.hook | 115 --------------------- subprojects/gstreamer/meson.build | 1 - 26 files changed, 4 insertions(+), 971 deletions(-) rename {subprojects/gst-devtools/hooks => scripts/git-hooks}/multi-pre-commit.hook (94%) rename {subprojects/gst-devtools/hooks => scripts/git-hooks}/pre-commit-python.hook (100%) rename {subprojects/gst-python/hooks => scripts/git-hooks}/pre-commit.hook (100%) delete mode 100755 subprojects/gst-devtools/hooks/pre-commit.hook delete mode 100755 subprojects/gst-editing-services/hooks/pre-commit.hook delete mode 100755 subprojects/gst-libav/hooks/pre-commit.hook delete mode 100755 subprojects/gst-omx/hooks/pre-commit.hook delete mode 100755 subprojects/gst-plugins-bad/hooks/pre-commit.hook delete mode 100755 subprojects/gst-plugins-base/hooks/pre-commit.hook delete mode 100755 subprojects/gst-plugins-good/hooks/pre-commit.hook delete mode 100755 subprojects/gst-plugins-ugly/hooks/pre-commit.hook delete mode 100755 subprojects/gst-rtsp-server/hooks/pre-commit.hook delete mode 100755 subprojects/gstreamer-vaapi/hooks/pre-commit.hook delete mode 100755 subprojects/gstreamer/hooks/pre-commit.hook diff --git a/meson.build b/meson.build index b2709bd..dcc1fba 100644 --- a/meson.build +++ b/meson.build @@ -24,6 +24,9 @@ if cmdres.returncode() != 0 error('Do not run `ninja` or `meson` for gst-build inside the uninstalled environment, you will run into problems') endif +# Install gst-indent pre-commit hook +run_command(python3, '-c', 'import shutil; shutil.copy("scripts/git-hooks/multi-pre-commit.hook", ".git/hooks/pre-commit")') + # Ensure that the user does not have Strawberry Perl in PATH, since it ships # with a pkg-config.bat and broken pkgconfig files for libffi and zlib. Will # cause a build error, such as in diff --git a/subprojects/gst-devtools/hooks/multi-pre-commit.hook b/scripts/git-hooks/multi-pre-commit.hook similarity index 94% rename from subprojects/gst-devtools/hooks/multi-pre-commit.hook rename to scripts/git-hooks/multi-pre-commit.hook index 98ae380..a77d0da 100755 --- a/subprojects/gst-devtools/hooks/multi-pre-commit.hook +++ b/scripts/git-hooks/multi-pre-commit.hook @@ -15,7 +15,7 @@ # commit. They are executed in the order in which they are listed. ########################################################### -HOOKS="hooks/pre-commit.hook hooks/pre-commit-python.hook" +HOOKS="scripts/git-hooks/pre-commit.hook scripts/git-hooks/pre-commit-python.hook" # exit on error set -e diff --git a/subprojects/gst-devtools/hooks/pre-commit-python.hook b/scripts/git-hooks/pre-commit-python.hook similarity index 100% rename from subprojects/gst-devtools/hooks/pre-commit-python.hook rename to scripts/git-hooks/pre-commit-python.hook diff --git a/subprojects/gst-python/hooks/pre-commit.hook b/scripts/git-hooks/pre-commit.hook similarity index 100% rename from subprojects/gst-python/hooks/pre-commit.hook rename to scripts/git-hooks/pre-commit.hook diff --git a/subprojects/gst-devtools/hooks/pre-commit.hook b/subprojects/gst-devtools/hooks/pre-commit.hook deleted file mode 100755 index 3c1062b..0000000 --- a/subprojects/gst-devtools/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-editing-services/hooks/pre-commit.hook b/subprojects/gst-editing-services/hooks/pre-commit.hook deleted file mode 100755 index 3c1062b..0000000 --- a/subprojects/gst-editing-services/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-editing-services/meson.build b/subprojects/gst-editing-services/meson.build index 81fc109..199e8e4 100644 --- a/subprojects/gst-editing-services/meson.build +++ b/subprojects/gst-editing-services/meson.build @@ -327,5 +327,3 @@ if gio_dep.version().version_compare('< 2.67.4') endif configure_file(output: 'config.h', configuration: cdata) - -run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")') diff --git a/subprojects/gst-libav/hooks/pre-commit.hook b/subprojects/gst-libav/hooks/pre-commit.hook deleted file mode 100755 index 3c1062b..0000000 --- a/subprojects/gst-libav/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-libav/meson.build b/subprojects/gst-libav/meson.build index 0abc528..2ef892b 100644 --- a/subprojects/gst-libav/meson.build +++ b/subprojects/gst-libav/meson.build @@ -212,6 +212,3 @@ if gst_version_nano == 0 endif configure_file(output: 'config.h', configuration: cdata) - -python3 = import('python').find_installation() -run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")') diff --git a/subprojects/gst-omx/hooks/pre-commit.hook b/subprojects/gst-omx/hooks/pre-commit.hook deleted file mode 100755 index 3c1062b..0000000 --- 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 d37fc7b..37cdecb 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")') diff --git a/subprojects/gst-plugins-bad/hooks/pre-commit.hook b/subprojects/gst-plugins-bad/hooks/pre-commit.hook deleted file mode 100755 index 6f17740..0000000 --- a/subprojects/gst-plugins-bad/hooks/pre-commit.hook +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh -# -# Check that the code follows a consistent 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-plugins-bad/meson.build b/subprojects/gst-plugins-bad/meson.build index 7cab556..c693ee7 100644 --- a/subprojects/gst-plugins-bad/meson.build +++ b/subprojects/gst-plugins-bad/meson.build @@ -543,8 +543,6 @@ endif configure_file(output : 'config.h', configuration : cdata) -run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")') - subdir('docs') if meson.version().version_compare('>= 0.54') diff --git a/subprojects/gst-plugins-base/hooks/pre-commit.hook b/subprojects/gst-plugins-base/hooks/pre-commit.hook deleted file mode 100755 index 6f17740..0000000 --- a/subprojects/gst-plugins-base/hooks/pre-commit.hook +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh -# -# Check that the code follows a consistent 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-plugins-base/meson.build b/subprojects/gst-plugins-base/meson.build index 9b00253..a87b24b 100644 --- a/subprojects/gst-plugins-base/meson.build +++ b/subprojects/gst-plugins-base/meson.build @@ -534,8 +534,6 @@ endif # Use core_conf after all subdirs have set values configure_file(output : 'config.h', configuration : core_conf) -run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")') - if meson.version().version_compare('>= 0.54') plugin_names = [] foreach plugin: plugins diff --git a/subprojects/gst-plugins-good/hooks/pre-commit.hook b/subprojects/gst-plugins-good/hooks/pre-commit.hook deleted file mode 100755 index 6f17740..0000000 --- a/subprojects/gst-plugins-good/hooks/pre-commit.hook +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh -# -# Check that the code follows a consistent 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-plugins-good/meson.build b/subprojects/gst-plugins-good/meson.build index f8e1299..bc9e53b 100644 --- a/subprojects/gst-plugins-good/meson.build +++ b/subprojects/gst-plugins-good/meson.build @@ -497,8 +497,6 @@ endif configure_file(output : 'config.h', configuration : cdata) -run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")') - if meson.version().version_compare('>= 0.54') plugin_names = [] foreach plugin: plugins diff --git a/subprojects/gst-plugins-ugly/hooks/pre-commit.hook b/subprojects/gst-plugins-ugly/hooks/pre-commit.hook deleted file mode 100755 index 6f17740..0000000 --- a/subprojects/gst-plugins-ugly/hooks/pre-commit.hook +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh -# -# Check that the code follows a consistent 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-plugins-ugly/meson.build b/subprojects/gst-plugins-ugly/meson.build index c5c78fc..f9fff1d 100644 --- a/subprojects/gst-plugins-ugly/meson.build +++ b/subprojects/gst-plugins-ugly/meson.build @@ -300,8 +300,6 @@ endif configure_file(output : 'config.h', configuration : cdata) -run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")') - if meson.version().version_compare('>= 0.54') plugin_names = [] foreach plugin: plugins diff --git a/subprojects/gst-python/meson.build b/subprojects/gst-python/meson.build index 483ff6c..a1e4c39 100644 --- a/subprojects/gst-python/meson.build +++ b/subprojects/gst-python/meson.build @@ -99,5 +99,3 @@ endif subdir('gi') subdir('plugin') subdir('testsuite') - -run_command(python, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")') diff --git a/subprojects/gst-rtsp-server/hooks/pre-commit.hook b/subprojects/gst-rtsp-server/hooks/pre-commit.hook deleted file mode 100755 index 6f17740..0000000 --- a/subprojects/gst-rtsp-server/hooks/pre-commit.hook +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh -# -# Check that the code follows a consistent 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-rtsp-server/meson.build b/subprojects/gst-rtsp-server/meson.build index 0e55878..465011d 100644 --- a/subprojects/gst-rtsp-server/meson.build +++ b/subprojects/gst-rtsp-server/meson.build @@ -212,6 +212,3 @@ if gst_version_nano == 0 endif configure_file(output: 'config.h', configuration: cdata) - -python3 = import('python').find_installation() -run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")') diff --git a/subprojects/gstreamer-vaapi/hooks/pre-commit.hook b/subprojects/gstreamer-vaapi/hooks/pre-commit.hook deleted file mode 100755 index 6f17740..0000000 --- a/subprojects/gstreamer-vaapi/hooks/pre-commit.hook +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh -# -# Check that the code follows a consistent 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/gstreamer-vaapi/meson.build b/subprojects/gstreamer-vaapi/meson.build index d069f40..73fe950 100644 --- a/subprojects/gstreamer-vaapi/meson.build +++ b/subprojects/gstreamer-vaapi/meson.build @@ -213,6 +213,3 @@ if gmodule_dep.version().version_compare('< 2.67.4') endif configure_file(output: 'config.h', configuration: cdata) - -python3 = import('python').find_installation() -run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")') diff --git a/subprojects/gstreamer/hooks/pre-commit.hook b/subprojects/gstreamer/hooks/pre-commit.hook deleted file mode 100755 index a295d2b..0000000 --- a/subprojects/gstreamer/hooks/pre-commit.hook +++ /dev/null @@ -1,115 +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--" - -# This is an opt-in check, and can only be run from gst-build's devenv, -# as outside of it MESON_BUILD_ROOT will not be set. -# -# The idea is to build the cache, and check if it has unstaged changes. -# To accomodate for the git add -p case, where the developer will break -# down a large change set into multiple commits, this hook will only -# fail when there are no unstaged changes left to commit, in other -# cases it will only print a reminder that the cache needs committing. -if [ -v MESON_BUILD_ROOT ] && [ "$GST_CACHE_HOOK" == "enabled" ]; then - echo "--Checking plugin cache--" - toplevel=`git rev-parse --show-toplevel` - repo_name=`basename $toplevel` - target_name=`ninja -C $MESON_BUILD_ROOT -t targets all | grep "\/\<$repo_name\>\/.*\/gst_plugins_cache.json" | cut -d ":" -f 1` - ninja -C $MESON_BUILD_ROOT $target_name - cache_path=`git ls-files $toplevel/**gst_plugins_cache.json` - git diff --quiet --exit-code -- $cache_path - has_unstaged_cache_changes=$? - git diff --quiet --exit-code -- ':!'$cache_path - has_unstaged_non_cache_changes=$? - - if [ $has_unstaged_non_cache_changes != 0 ] ; then - if [ $has_unstaged_cache_changes != 0 ]; then - echo -e "\033[1;33mUnstaged cache changes, but working directory isn't clean, don't forget to commit the cache when you're done\033[0m" - fi - elif [ $has_unstaged_cache_changes != 0 ]; then - echo -e "\033[1;31mUnstaged cache changes, but the working directory is clean, you must commit the cache\033[0m" - exit 1 - else - echo "--Checking plugin cache pass--" - fi -fi diff --git a/subprojects/gstreamer/meson.build b/subprojects/gstreamer/meson.build index bed8c4e..e4252b6 100644 --- a/subprojects/gstreamer/meson.build +++ b/subprojects/gstreamer/meson.build @@ -618,7 +618,6 @@ if gst_version_nano == 0 endif configure_file(output : 'config.h', configuration : cdata) -run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")') install_data('gst-element-check-1.0.m4', install_dir : join_paths(get_option('datadir'), 'aclocal')) if meson.version().version_compare('>= 0.54') -- 2.7.4