From 5745e53bab360428d5298d3e3cb6660c4d4e19e5 Mon Sep 17 00:00:00 2001 From: SorinO Date: Thu, 19 Feb 2026 15:03:17 +0200 Subject: [PATCH 1/3] scripts(c_formatting): add license banner checker for .c/.h files Signed-off-by: SorinO --- scripts/check_license_banner.sh | 58 +++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 scripts/check_license_banner.sh diff --git a/scripts/check_license_banner.sh b/scripts/check_license_banner.sh new file mode 100644 index 00000000..b5ce4869 --- /dev/null +++ b/scripts/check_license_banner.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# @copyright Copyright (c) contributors to Project Ocre, +# which has been established as Project Ocre a Series of LF Projects, LLC +# +# SPDX-License-Identifier: Apache-2.0 + +# Checks all C/C++ files for license banner + +set -e + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +SRC_DIR="$ROOT_DIR/src" + +check_license_banner() { + local file="$1" + local file_header + + file_header=$(head -n 6 "$file") + + # Expected license banner + local expected_banner="/** + * @copyright Copyright (c) contributors to Project Ocre, + * which has been established as Project Ocre a Series of LF Projects, LLC + * + * SPDX-License-Identifier: Apache-2.0 + */" + + if [ "$file_header" != "$expected_banner" ]; then + echo "ERROR: Missing or incorrect license banner in $file" + return 1 + fi + + return 0 +} + +echo "Checking license banners." +ERROR_FOUND=0 +for file in $(find . -type f \( -name '*.c' -o -name '*.h' \) \ + ! -name 'utlist.h' \ + ! -name 'CMakeCCompilerId.c' \ + ! -path './tests/Unity/*' \ + ! -path './build/*' \ + ! -path './wasm-micro-runtime/*' \ + ! -path './ocre-sdk/*' \ + ! -path './src/shell/sha256/*' \ + ! -path './src/runtime/wamr-wasip1/ocre_api/utils/*' \ + | sort); do + + if ! check_license_banner "$file"; then + ERROR_FOUND=1 + fi +done + +if [ $ERROR_FOUND -ne 0 ]; then + echo "License check failed." + exit 1 +fi From cc4c3ab94d87fb7ef1a00473509bdc7a0ba330e3 Mon Sep 17 00:00:00 2001 From: SorinO Date: Thu, 19 Feb 2026 16:45:22 +0200 Subject: [PATCH 2/3] fix: add and modify all license banners for c files Signed-off-by: SorinO --- src/common/common.c | 7 +++++++ src/platform/zephyr/memory.c | 2 +- src/runtime/wamr-wasip1/ocre_api/core/core_eventq.c | 2 +- src/runtime/wamr-wasip1/ocre_api/core/core_external.h | 2 +- src/runtime/wamr-wasip1/ocre_api/core/core_internal.h | 2 +- src/runtime/wamr-wasip1/ocre_api/core/core_memory.c | 2 +- src/runtime/wamr-wasip1/ocre_api/core/core_misc.c | 2 +- src/runtime/wamr-wasip1/ocre_api/core/core_mutex.c | 2 +- src/runtime/wamr-wasip1/ocre_api/core/core_timer.c | 2 +- src/runtime/wamr-wasip1/ocre_api/ocre_api.c | 2 +- src/runtime/wamr-wasip1/ocre_api/ocre_api.h | 2 +- src/runtime/wamr-wasip1/ocre_api/ocre_common.c | 4 ++-- src/runtime/wamr-wasip1/ocre_api/ocre_common.h | 4 ++-- src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.c | 4 ++-- src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.h | 2 +- .../wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.c | 6 +++--- .../wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.h | 6 +++--- .../wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.c | 2 +- .../wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.h | 2 +- src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.c | 2 +- src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.h | 2 +- src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.c | 4 ++-- src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.h | 2 +- 23 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/common/common.c b/src/common/common.c index 367117a5..e7e2b1e6 100644 --- a/src/common/common.c +++ b/src/common/common.c @@ -1,3 +1,10 @@ +/** + * @copyright Copyright (c) contributors to Project Ocre, + * which has been established as Project Ocre a Series of LF Projects, LLC + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include #include #include diff --git a/src/platform/zephyr/memory.c b/src/platform/zephyr/memory.c index d98b89ef..5b79f1d4 100644 --- a/src/platform/zephyr/memory.c +++ b/src/platform/zephyr/memory.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/core/core_eventq.c b/src/runtime/wamr-wasip1/ocre_api/core/core_eventq.c index 9ecbfe51..8f797d10 100644 --- a/src/runtime/wamr-wasip1/ocre_api/core/core_eventq.c +++ b/src/runtime/wamr-wasip1/ocre_api/core/core_eventq.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/core/core_external.h b/src/runtime/wamr-wasip1/ocre_api/core/core_external.h index b1435174..74b72990 100644 --- a/src/runtime/wamr-wasip1/ocre_api/core/core_external.h +++ b/src/runtime/wamr-wasip1/ocre_api/core/core_external.h @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/core/core_internal.h b/src/runtime/wamr-wasip1/ocre_api/core/core_internal.h index ba915f37..f22ee886 100644 --- a/src/runtime/wamr-wasip1/ocre_api/core/core_internal.h +++ b/src/runtime/wamr-wasip1/ocre_api/core/core_internal.h @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/core/core_memory.c b/src/runtime/wamr-wasip1/ocre_api/core/core_memory.c index cfd3471b..656bb9c0 100644 --- a/src/runtime/wamr-wasip1/ocre_api/core/core_memory.c +++ b/src/runtime/wamr-wasip1/ocre_api/core/core_memory.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/core/core_misc.c b/src/runtime/wamr-wasip1/ocre_api/core/core_misc.c index 1bee91de..1aff9ceb 100644 --- a/src/runtime/wamr-wasip1/ocre_api/core/core_misc.c +++ b/src/runtime/wamr-wasip1/ocre_api/core/core_misc.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/core/core_mutex.c b/src/runtime/wamr-wasip1/ocre_api/core/core_mutex.c index 5c511458..45c56f09 100644 --- a/src/runtime/wamr-wasip1/ocre_api/core/core_mutex.c +++ b/src/runtime/wamr-wasip1/ocre_api/core/core_mutex.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/core/core_timer.c b/src/runtime/wamr-wasip1/ocre_api/core/core_timer.c index f39dec16..9ec55330 100644 --- a/src/runtime/wamr-wasip1/ocre_api/core/core_timer.c +++ b/src/runtime/wamr-wasip1/ocre_api/core/core_timer.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_api.c b/src/runtime/wamr-wasip1/ocre_api/ocre_api.c index 1ca8db8c..5377064a 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_api.c +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_api.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_api.h b/src/runtime/wamr-wasip1/ocre_api/ocre_api.h index a0e8385f..f5822a4d 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_api.h +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_api.h @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_common.c b/src/runtime/wamr-wasip1/ocre_api/ocre_common.c index f2032345..35b07c8d 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_common.c +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_common.c @@ -1,6 +1,6 @@ /** - * @copyright Copyright © contributors to Project Ocre, - * which has been established as Project Ocre, a Series of LF Projects, LLC + * @copyright Copyright (c) contributors to Project Ocre, + * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_common.h b/src/runtime/wamr-wasip1/ocre_api/ocre_common.h index 71a3649e..699b97bf 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_common.h +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_common.h @@ -1,8 +1,8 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * - * SPDX-License-License: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 */ #ifndef OCRE_COMMON_H diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.c b/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.c index f3e9de61..ce49fc0c 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.c +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.c @@ -1,6 +1,6 @@ /** - * @copyright Copyright © contributors to Project Ocre, - * which has been established as Project Ocre, a Series of LF Projects, LLC + * @copyright Copyright (c) contributors to Project Ocre, + * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.h b/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.h index 4164ed06..f002d48c 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.h +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_gpio/ocre_gpio.h @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.c b/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.c index 791fc271..2f1a02f4 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.c +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.c @@ -1,8 +1,8 @@ /** - * @copyright Copyright © contributors to Project Ocre, - * which has been established as Project Ocre, a Series of LF Projects, LLC + * @copyright Copyright (c) contributors to Project Ocre, + * which has been established as Project Ocre a Series of LF Projects, LLC * - * SPDX-License-License: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 */ #include diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.h b/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.h index 34f13267..a728235d 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.h +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_messaging/ocre_messaging.h @@ -1,8 +1,8 @@ /** - * @copyright Copyright © contributors to Project Ocre, - * which has been established as Project Ocre, a Series of LF Projects, LLC + * @copyright Copyright (c) contributors to Project Ocre, + * which has been established as Project Ocre a Series of LF Projects, LLC * - * SPDX-License-License: Apache-2.0 + * SPDX-License-Identifier: Apache-2.0 */ #ifndef OCRE_MESSAGING_H diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.c b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.c index 285ae090..ba106a5b 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.c +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.h b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.h index 31059638..ab1a54e1 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.h +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/ocre_sensors.h @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.c b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.c index 22acc6df..fd739bec 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.c +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.c @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.h b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.h index 77c90f4f..2e25e783 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.h +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/rng_sensor.h @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.c b/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.c index 53d3dd05..036950d9 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.c +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.c @@ -1,6 +1,6 @@ /** - * @copyright Copyright © contributors to Project Ocre, - * which has been established as Project Ocre, a Series of LF Projects, LLC + * @copyright Copyright (c) contributors to Project Ocre, + * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.h b/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.h index d922d4a3..14c024d7 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.h +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_timers/ocre_timer.h @@ -1,5 +1,5 @@ /** - * @copyright Copyright © contributors to Project Ocre, + * @copyright Copyright (c) contributors to Project Ocre, * which has been established as Project Ocre a Series of LF Projects, LLC * * SPDX-License-Identifier: Apache-2.0 From 742584feae67baeb6eeeded1303121c41712698e Mon Sep 17 00:00:00 2001 From: SorinO Date: Thu, 19 Feb 2026 17:06:19 +0200 Subject: [PATCH 3/3] ci(formatting-checks): add banner license check Signed-off-by: SorinO --- .github/workflows/formatting-checks.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/formatting-checks.yml b/.github/workflows/formatting-checks.yml index 34dab7a0..e5536f5e 100644 --- a/.github/workflows/formatting-checks.yml +++ b/.github/workflows/formatting-checks.yml @@ -38,3 +38,6 @@ jobs: - name: Run YAML Format Checks run: sh scripts/yml_linter.sh + + - name: Run Banner License Checks + run: sh scripts/check_license_banner.sh