Move commit gst-indent hook to the root
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Fri, 24 Sep 2021 18:11:13 +0000 (14:11 -0400)
committerThibault Saunier <tsaunier@igalia.com>
Fri, 24 Sep 2021 20:47:01 +0000 (17:47 -0300)
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>

26 files changed:
meson.build
scripts/git-hooks/multi-pre-commit.hook [moved from subprojects/gst-devtools/hooks/multi-pre-commit.hook with 94% similarity]
scripts/git-hooks/pre-commit-python.hook [moved from subprojects/gst-devtools/hooks/pre-commit-python.hook with 100% similarity]
scripts/git-hooks/pre-commit.hook [moved from subprojects/gst-python/hooks/pre-commit.hook with 100% similarity]
subprojects/gst-devtools/hooks/pre-commit.hook [deleted file]
subprojects/gst-editing-services/hooks/pre-commit.hook [deleted file]
subprojects/gst-editing-services/meson.build
subprojects/gst-libav/hooks/pre-commit.hook [deleted file]
subprojects/gst-libav/meson.build
subprojects/gst-omx/hooks/pre-commit.hook [deleted file]
subprojects/gst-omx/meson.build
subprojects/gst-plugins-bad/hooks/pre-commit.hook [deleted file]
subprojects/gst-plugins-bad/meson.build
subprojects/gst-plugins-base/hooks/pre-commit.hook [deleted file]
subprojects/gst-plugins-base/meson.build
subprojects/gst-plugins-good/hooks/pre-commit.hook [deleted file]
subprojects/gst-plugins-good/meson.build
subprojects/gst-plugins-ugly/hooks/pre-commit.hook [deleted file]
subprojects/gst-plugins-ugly/meson.build
subprojects/gst-python/meson.build
subprojects/gst-rtsp-server/hooks/pre-commit.hook [deleted file]
subprojects/gst-rtsp-server/meson.build
subprojects/gstreamer-vaapi/hooks/pre-commit.hook [deleted file]
subprojects/gstreamer-vaapi/meson.build
subprojects/gstreamer/hooks/pre-commit.hook [deleted file]
subprojects/gstreamer/meson.build

index b2709bd..dcc1fba 100644 (file)
@@ -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
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 (executable)
@@ -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.hook b/subprojects/gst-devtools/hooks/pre-commit.hook
deleted file mode 100755 (executable)
index 3c1062b..0000000
+++ /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 (executable)
index 3c1062b..0000000
+++ /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--"
index 81fc109..199e8e4 100644 (file)
@@ -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 (executable)
index 3c1062b..0000000
+++ /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--"
index 0abc528..2ef892b 100644 (file)
@@ -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 (executable)
index 3c1062b..0000000
+++ /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--"
index d37fc7b..37cdecb 100644 (file)
@@ -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 (executable)
index 6f17740..0000000
+++ /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--"
index 7cab556..c693ee7 100644 (file)
@@ -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 (executable)
index 6f17740..0000000
+++ /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--"
index 9b00253..a87b24b 100644 (file)
@@ -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 (executable)
index 6f17740..0000000
+++ /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--"
index f8e1299..bc9e53b 100644 (file)
@@ -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 (executable)
index 6f17740..0000000
+++ /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--"
index c5c78fc..f9fff1d 100644 (file)
@@ -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
index 483ff6c..a1e4c39 100644 (file)
@@ -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 (executable)
index 6f17740..0000000
+++ /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--"
index 0e55878..465011d 100644 (file)
@@ -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 (executable)
index 6f17740..0000000
+++ /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--"
index d069f40..73fe950 100644 (file)
@@ -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 (executable)
index a295d2b..0000000
+++ /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
index bed8c4e..e4252b6 100644 (file)
@@ -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')