From 62c5dd4c91956b4749dacc88db4ddfcc820c7e96 Mon Sep 17 00:00:00 2001 From: omendez Date: Thu, 28 May 2026 11:22:57 -0600 Subject: [PATCH 1/4] Add COMPATIBLE_MACHINE to GStreamer recipes --- recipes-multimedia/gstreamer/gst-emboverlay.bb | 1 + recipes-multimedia/gstreamer/gst-interpipes.bb | 1 + recipes-multimedia/gstreamer/gst-isp.bb | 1 + recipes-multimedia/gstreamer/gst-motion-detect.bb | 3 ++- recipes-multimedia/gstreamer/gst-opencl.bb | 1 + recipes-multimedia/gstreamer/gst-perf.bb | 1 + recipes-multimedia/gstreamer/gst-prerecord.bb | 1 + recipes-multimedia/gstreamer/gst-qt-overlay.bb | 1 + recipes-multimedia/gstreamer/gst-rtsp-sink.bb | 1 + recipes-multimedia/gstreamer/gst-sei.bb | 1 + recipes-multimedia/gstreamer/gst-shark.bb | 1 + recipes-multimedia/gstreamer/gstd.bb | 1 + 12 files changed, 13 insertions(+), 1 deletion(-) diff --git a/recipes-multimedia/gstreamer/gst-emboverlay.bb b/recipes-multimedia/gstreamer/gst-emboverlay.bb index af1ae46..ef9c508 100644 --- a/recipes-multimedia/gstreamer/gst-emboverlay.bb +++ b/recipes-multimedia/gstreamer/gst-emboverlay.bb @@ -5,6 +5,7 @@ SECTION = "multimedia" LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://COPYING;md5=1887e8dfc90a84423fd31d1d45ee6718" +COMPATIBLE_MACHINE = ".*" DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base cairo" diff --git a/recipes-multimedia/gstreamer/gst-interpipes.bb b/recipes-multimedia/gstreamer/gst-interpipes.bb index 98cd5f8..2eff42e 100644 --- a/recipes-multimedia/gstreamer/gst-interpipes.bb +++ b/recipes-multimedia/gstreamer/gst-interpipes.bb @@ -4,6 +4,7 @@ HOMEPAGE = "https://developer.ridgerun.com/wiki/index.php?title=GstInterpipe" SECTION = "multimedia" LICENSE = "LGPL2.1" LIC_FILES_CHKSUM = "file://COPYING;md5=3191ae9476980e87e3494d2d8ebe4584" +COMPATIBLE_MACHINE = ".*" # Base dependencies DEPENDS = " \ diff --git a/recipes-multimedia/gstreamer/gst-isp.bb b/recipes-multimedia/gstreamer/gst-isp.bb index 6ea79d6..d8e20c2 100644 --- a/recipes-multimedia/gstreamer/gst-isp.bb +++ b/recipes-multimedia/gstreamer/gst-isp.bb @@ -4,6 +4,7 @@ HOMEPAGE = "https://www.ridgerun.com/gstisp" SECTION = "multimedia" LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://COPYING;md5=46819161aba98ab8c502e93a15713e58" +COMPATIBLE_MACHINE = "(imx-nxp-bsp)" DEPENDS = " \ gstreamer1.0 \ diff --git a/recipes-multimedia/gstreamer/gst-motion-detect.bb b/recipes-multimedia/gstreamer/gst-motion-detect.bb index 9559965..2562d2d 100644 --- a/recipes-multimedia/gstreamer/gst-motion-detect.bb +++ b/recipes-multimedia/gstreamer/gst-motion-detect.bb @@ -4,7 +4,8 @@ HOMEPAGE = "https://developer.ridgerun.com/wiki/index.php?title=Camera_Based_Mot SECTION = "multimedia" LICENSE = "Proprietary" -LIC_FILES_CHKSUM = "file://COPYING;md5=46819161aba98ab8c502e93a15713e58" +LIC_FILES_CHKSUM = "file://COPYING;md5=152bda62bf553a99a8aff727654bb4c7" +COMPATIBLE_MACHINE = ".*" DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base glib-2.0 glibc" diff --git a/recipes-multimedia/gstreamer/gst-opencl.bb b/recipes-multimedia/gstreamer/gst-opencl.bb index 594b5a9..f3c5ba6 100644 --- a/recipes-multimedia/gstreamer/gst-opencl.bb +++ b/recipes-multimedia/gstreamer/gst-opencl.bb @@ -4,6 +4,7 @@ HOMEPAGE = "https://www.ridgerun.com/post/gstreamer-opencl-accelerated-isp" SECTION = "multimedia" LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://COPYING;md5=46819161aba98ab8c502e93a15713e58" +COMPATIBLE_MACHINE = "(imx-nxp-bsp)" DEPENDS = " \ gstreamer1.0 \ diff --git a/recipes-multimedia/gstreamer/gst-perf.bb b/recipes-multimedia/gstreamer/gst-perf.bb index d7f8bee..3d6f7a5 100644 --- a/recipes-multimedia/gstreamer/gst-perf.bb +++ b/recipes-multimedia/gstreamer/gst-perf.bb @@ -4,6 +4,7 @@ HOMEPAGE = "https://github.com/RidgeRun/gst-perf-autotools" SECTION = "multimedia" LICENSE = "LGPLv2" LIC_FILES_CHKSUM="file://LICENSE;md5=5f30f0716dfdd0d91eb439ebec522ec2" +COMPATIBLE_MACHINE = ".*" DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad" diff --git a/recipes-multimedia/gstreamer/gst-prerecord.bb b/recipes-multimedia/gstreamer/gst-prerecord.bb index 51a85f5..9183420 100644 --- a/recipes-multimedia/gstreamer/gst-prerecord.bb +++ b/recipes-multimedia/gstreamer/gst-prerecord.bb @@ -5,6 +5,7 @@ SECTION = "multimedia" LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://COPYING;md5=1887e8dfc90a84423fd31d1d45ee6718" +COMPATIBLE_MACHINE = ".*" DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base libffi" diff --git a/recipes-multimedia/gstreamer/gst-qt-overlay.bb b/recipes-multimedia/gstreamer/gst-qt-overlay.bb index c77a62f..7cb3006 100644 --- a/recipes-multimedia/gstreamer/gst-qt-overlay.bb +++ b/recipes-multimedia/gstreamer/gst-qt-overlay.bb @@ -3,6 +3,7 @@ DESCRIPTION = "GStreamer element used to overlay QML files over video streams" SECTION = "multimedia" LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://COPYING;md5=2282fc857e14ce7b17c1c9d810504ac5" +COMPATIBLE_MACHINE = ".*" DEPENDS = " \ gstreamer1.0 \ diff --git a/recipes-multimedia/gstreamer/gst-rtsp-sink.bb b/recipes-multimedia/gstreamer/gst-rtsp-sink.bb index ac0be07..9b31255 100644 --- a/recipes-multimedia/gstreamer/gst-rtsp-sink.bb +++ b/recipes-multimedia/gstreamer/gst-rtsp-sink.bb @@ -4,6 +4,7 @@ HOMEPAGE = "https://developer.ridgerun.com/wiki/index.php?title=GstRtspSink" SECTION = "multimedia" LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://COPYING;md5=1887e8dfc90a84423fd31d1d45ee6718" +COMPATIBLE_MACHINE = ".*" DEPENDS = " \ gstreamer1.0 \ diff --git a/recipes-multimedia/gstreamer/gst-sei.bb b/recipes-multimedia/gstreamer/gst-sei.bb index cbd7a7b..2b7dc0e 100644 --- a/recipes-multimedia/gstreamer/gst-sei.bb +++ b/recipes-multimedia/gstreamer/gst-sei.bb @@ -4,6 +4,7 @@ HOMEPAGE = "https://www.ridgerun.com/gstseimetadata" SECTION = "multimedia" LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://COPYING;md5=2207b8e5f4ab4b3a0c794e43f2002ea3" +COMPATIBLE_MACHINE = ".*" DEPENDS = " \ diff --git a/recipes-multimedia/gstreamer/gst-shark.bb b/recipes-multimedia/gstreamer/gst-shark.bb index e5bf550..a0640f3 100644 --- a/recipes-multimedia/gstreamer/gst-shark.bb +++ b/recipes-multimedia/gstreamer/gst-shark.bb @@ -5,6 +5,7 @@ SECTION = "multimedia" LICENSE = "GPL-2.0-or-later" LIC_FILES_CHKSUM = "file://COPYING;md5=e1caa368743492879002ad032445fa97" +COMPATIBLE_MACHINE = ".*" DEPENDS = " \ gstreamer1.0 \ diff --git a/recipes-multimedia/gstreamer/gstd.bb b/recipes-multimedia/gstreamer/gstd.bb index 6b8ffe5..6f5d09d 100644 --- a/recipes-multimedia/gstreamer/gstd.bb +++ b/recipes-multimedia/gstreamer/gstd.bb @@ -4,6 +4,7 @@ HOMEPAGE = "https://developer.ridgerun.com/wiki/index.php?title=Gstd-1.0" SECTION = "multimedia" LICENSE = "LGPL-2.1-or-later" LIC_FILES_CHKSUM = "file://COPYING;md5=c71b653a0f608a58cdc5693ae57126bc" +COMPATIBLE_MACHINE = ".*" DEPENDS = " \ gstreamer1.0 \ From 4455adc4f8634e287e7c6c05207dc9cbc6549696 Mon Sep 17 00:00:00 2001 From: omendez Date: Thu, 28 May 2026 11:23:29 -0600 Subject: [PATCH 2/4] Add pre-commit hook runner --- README.md | 19 +++++++++++++++ hooks/pre-commit | 26 +++++++++++++++++++++ hooks/pre-commit.d/10-compatible-machine.sh | 26 +++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100755 hooks/pre-commit create mode 100755 hooks/pre-commit.d/10-compatible-machine.sh diff --git a/README.md b/README.md index 58ad779..a8fae1a 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,25 @@ If you maintain `bblayers.conf` manually, append: BBLAYERS += "${TOPDIR}/../meta-ridgerun" ``` +Git Hooks +--------- +This layer includes a pre-commit hook runner at `hooks/pre-commit`. +Checks are implemented as executable scripts under `hooks/pre-commit.d/`. +Current checks: +- `10-compatible-machine.sh`: verifies each staged `.bb` file defines `COMPATIBLE_MACHINE`. + +Enable layer hooks from the `meta-ridgerun` repository root: +``` +git config core.hooksPath hooks +``` + +You can verify the configuration with: +``` +git config --get core.hooksPath +``` + +To add new pre-commit validations, add an executable `*.sh` file to `hooks/pre-commit.d/`. + Customer repositories --------------------- Proprietary plugins in this layer fetch from private RidgeRun GitLab paths under `git@gitlab.ridgerun.com/ridgerun/orders/${RR_CUSTOMER_GITLAB_ORDER_DIR}`. Set the directory you were given in one of these ways (prefer `conf/local.conf`): diff --git a/hooks/pre-commit b/hooks/pre-commit new file mode 100755 index 0000000..8a5e71e --- /dev/null +++ b/hooks/pre-commit @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -euo pipefail + +HOOK_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)" +HOOKS_D="${HOOK_DIR}/pre-commit.d" + +if [ ! -d "${HOOKS_D}" ]; then + exit 0 +fi + +status=0 +for hook in "${HOOKS_D}"/*.sh; do + [ -e "${hook}" ] || continue + if [ ! -x "${hook}" ]; then + echo "Skipping non-executable hook: ${hook}" + continue + fi + "${hook}" || status=$? +done + +if [ "${status}" -ne 0 ]; then + exit "${status}" +fi + +exit 0 diff --git a/hooks/pre-commit.d/10-compatible-machine.sh b/hooks/pre-commit.d/10-compatible-machine.sh new file mode 100755 index 0000000..8b8e45c --- /dev/null +++ b/hooks/pre-commit.d/10-compatible-machine.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -euo pipefail + +bb_files="$(git diff --cached --name-only --diff-filter=ACMR | grep -E '\.bb$' || true)" + +[ -z "${bb_files}" ] && exit 0 + +missing=() +while IFS= read -r file; do + [ -z "${file}" ] && continue + if ! git show ":${file}" | grep -Eq '^[[:space:]]*COMPATIBLE_MACHINE([[:alnum:]_:-]*)?[[:space:]]*([?+]?=)'; then + missing+=("${file}") + fi +done <<< "${bb_files}" + +if [ ${#missing[@]} -gt 0 ]; then + echo "ERROR: COMPATIBLE_MACHINE is missing in the following staged .bb files:" + for file in "${missing[@]}"; do + echo " - ${file}" + done + echo "Add COMPATIBLE_MACHINE before committing." + exit 1 +fi + +exit 0 From 9b869c12207f7d8588560a8aae38ba88957675d6 Mon Sep 17 00:00:00 2001 From: omendez Date: Fri, 29 May 2026 09:36:54 -0600 Subject: [PATCH 3/4] Add pre-commit configuration for recipe validation --- .pre-commit-config.yaml | 10 ++++++++++ README.md | 15 +++++++-------- hooks/pre-commit | 25 +++++-------------------- 3 files changed, 22 insertions(+), 28 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..dffeeba --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +repos: + - repo: local + hooks: + - id: compatible-machine-check + name: Ensure COMPATIBLE_MACHINE in .bb files + entry: hooks/pre-commit.d/10-compatible-machine.sh + language: system + pass_filenames: false + stages: [pre-commit] + files: \.bb$ diff --git a/README.md b/README.md index a8fae1a..64a1d40 100644 --- a/README.md +++ b/README.md @@ -31,22 +31,21 @@ BBLAYERS += "${TOPDIR}/../meta-ridgerun" Git Hooks --------- -This layer includes a pre-commit hook runner at `hooks/pre-commit`. -Checks are implemented as executable scripts under `hooks/pre-commit.d/`. -Current checks: +This layer uses the `pre-commit` framework. Current checks: - `10-compatible-machine.sh`: verifies each staged `.bb` file defines `COMPATIBLE_MACHINE`. -Enable layer hooks from the `meta-ridgerun` repository root: +Install `pre-commit` and enable hooks from the `meta-ridgerun` repository root: ``` -git config core.hooksPath hooks +pip install pre-commit +pre-commit install --hook-type pre-commit --install-hooks ``` -You can verify the configuration with: +If you prefer this repository-managed hook path, keep: ``` -git config --get core.hooksPath +git config core.hooksPath hooks ``` -To add new pre-commit validations, add an executable `*.sh` file to `hooks/pre-commit.d/`. +To add new validations, add a new executable script under `hooks/pre-commit.d/` and register it in `.pre-commit-config.yaml`. Customer repositories --------------------- diff --git a/hooks/pre-commit b/hooks/pre-commit index 8a5e71e..4eb8a02 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -2,25 +2,10 @@ set -euo pipefail -HOOK_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)" -HOOKS_D="${HOOK_DIR}/pre-commit.d" - -if [ ! -d "${HOOKS_D}" ]; then - exit 0 -fi - -status=0 -for hook in "${HOOKS_D}"/*.sh; do - [ -e "${hook}" ] || continue - if [ ! -x "${hook}" ]; then - echo "Skipping non-executable hook: ${hook}" - continue - fi - "${hook}" || status=$? -done - -if [ "${status}" -ne 0 ]; then - exit "${status}" +if ! command -v pre-commit >/dev/null 2>&1; then + echo "ERROR: pre-commit is not installed." + echo "Install it with: pip install pre-commit" + exit 1 fi -exit 0 +exec pre-commit run --hook-stage pre-commit From 522633ba286a6ffb8b1e11f2a33d51ed44b740ff Mon Sep 17 00:00:00 2001 From: omendez Date: Fri, 29 May 2026 09:49:03 -0600 Subject: [PATCH 4/4] Update COMPATIBLE_MACHINE check header --- .gitignore | 1 + README.md | 5 ---- hooks/pre-commit | 11 -------- hooks/pre-commit.d/10-compatible-machine.sh | 30 +++++++++++++++++++++ 4 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 .gitignore delete mode 100755 hooks/pre-commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d17dae --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.venv diff --git a/README.md b/README.md index 64a1d40..c9706ec 100644 --- a/README.md +++ b/README.md @@ -40,11 +40,6 @@ pip install pre-commit pre-commit install --hook-type pre-commit --install-hooks ``` -If you prefer this repository-managed hook path, keep: -``` -git config core.hooksPath hooks -``` - To add new validations, add a new executable script under `hooks/pre-commit.d/` and register it in `.pre-commit-config.yaml`. Customer repositories diff --git a/hooks/pre-commit b/hooks/pre-commit deleted file mode 100755 index 4eb8a02..0000000 --- a/hooks/pre-commit +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -if ! command -v pre-commit >/dev/null 2>&1; then - echo "ERROR: pre-commit is not installed." - echo "Install it with: pip install pre-commit" - exit 1 -fi - -exec pre-commit run --hook-stage pre-commit diff --git a/hooks/pre-commit.d/10-compatible-machine.sh b/hooks/pre-commit.d/10-compatible-machine.sh index 8b8e45c..5401fb1 100755 --- a/hooks/pre-commit.d/10-compatible-machine.sh +++ b/hooks/pre-commit.d/10-compatible-machine.sh @@ -1,5 +1,35 @@ #!/usr/bin/env bash +## meta-ridgerun pre-commit hook: COMPATIBLE_MACHINE check +## Copyright 2026 RidgeRun, LLC (http://www.ridgerun.com) +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## +## 1. Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## +## 2. Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## +## 3. Neither the name of the copyright holder nor the names of its +## contributors may be used to endorse or promote products derived from +## this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + set -euo pipefail bb_files="$(git diff --cached --name-only --diff-filter=ACMR | grep -E '\.bb$' || true)"