From cb5cf4e06ab7c58d453b1667ec57d2e9098f8534 Mon Sep 17 00:00:00 2001 From: SorinO Date: Mon, 23 Feb 2026 13:16:14 +0200 Subject: [PATCH 1/4] scripts: add license banner validation for shell and config files Signed-off-by: SorinO --- scripts/check_license_banner_conf_files.sh | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 scripts/check_license_banner_conf_files.sh diff --git a/scripts/check_license_banner_conf_files.sh b/scripts/check_license_banner_conf_files.sh new file mode 100644 index 00000000..fae8e4c9 --- /dev/null +++ b/scripts/check_license_banner_conf_files.sh @@ -0,0 +1,65 @@ +#!/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 + local start_line=1 + + # Check first line and skip if it's a shebang line(only for .sh scripts) + local first_line + first_line=$(head -n 1 "$file") + if [ "${first_line#\#\!/bin}" != "$first_line" ]; then + start_line=2 + fi + + file_header=$(tail -n +$start_line "$file" | head -n 4) + + # 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 'CMakeLists.txt' -o -name '*.yaml' \ + -o -name '*.yml' -o -name '*.awk' -o -name '*.conf' -o -name 'Kconfig*' \ + -o -name '.gitignore' -o -name '.gitmodules' -o -name '*.sh' -o -name '*.cmake' \) \ + ! -name 'utlist.h' \ + ! -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 ccf619526b59fa2bb1a7360b2f9b3eac83a2976d Mon Sep 17 00:00:00 2001 From: SorinO Date: Mon, 23 Feb 2026 13:28:58 +0200 Subject: [PATCH 2/4] fix: add missing license banners Signed-off-by: SorinO --- .github/ISSUE_TEMPLATE/config.yml | 5 + .gitignore | 136 +++++++++--------- .gitmodules | 5 + .../ocre_sensors/custom,rng-sensor.yaml | 5 + .../zephyr/boards/overlay-nsos.conf | 5 + .../boards/shields/enc28j60/Kconfig.defconfig | 4 + .../boards/shields/enc28j60/Kconfig.shield | 5 + .../zephyr/boards/shields/enc28j60/shield.yml | 5 + .../shields/wiznet_w5500/Kconfig.defconfig | 4 + .../shields/wiznet_w5500/Kconfig.shield | 5 + .../boards/shields/wiznet_w5500/shield.yml | 5 + tests_hw/beginTests.sh | 6 +- tests_hw/groups/flashValidation/clean.sh | 7 +- tests_hw/groups/flashValidation/setup.sh | 7 +- 14 files changed, 133 insertions(+), 71 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 90569cb5..5b3a9dd9 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,3 +1,8 @@ +# @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 + blank_issues_enabled: true contact_links: - name: Ocre Community diff --git a/.gitignore b/.gitignore index 4e60561d..3d32a3e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,68 +1,68 @@ -# These are some examples of commonly ignored file patterns. -# You should customize this list as applicable to your project. -# Learn more about .gitignore: -# https://www.atlassian.com/git/tutorials/saving-changes/gitignore - -# Zephyr build folder -build/ - -# Zephyr native_sim/POSIX simulated flash -*.bin - -# Generated files -*.g - -# Node artifact files -node_modules/ -dist/ - -# Compiled Java class files -*.class - -# Compiled Python bytecode -*.py[cod] - -# Log files -*.log - -# Package files -*.jar - -# Maven -target/ -dist/ - -# Unit test reports -TEST*.xml - -# Generated by Windows -Thumbs.db - -# Applications -*.app -*.exe -*.war - -# Large media files -*.mp4 -*.tiff -*.avi -*.flv -*.mov -*.wmv - -# Generated by VS -settings.json - -src/common/include/ocre/commit_id.h - -**/.DS_Store - -# hidden files -.* -!.git -!.gitignore -!/.gitmodules -!/.github -!.devcontainer -!.clang-format +# @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 + +# Zephyr build folder +build/ + +# Zephyr native_sim/POSIX simulated flash +*.bin + +# Generated files +*.g + +# Node artifact files +node_modules/ +dist/ + +# Compiled Java class files +*.class + +# Compiled Python bytecode +*.py[cod] + +# Log files +*.log + +# Package files +*.jar + +# Maven +target/ +dist/ + +# Unit test reports +TEST*.xml + +# Generated by Windows +Thumbs.db + +# Applications +*.app +*.exe +*.war + +# Large media files +*.mp4 +*.tiff +*.avi +*.flv +*.mov +*.wmv + +# Generated by VS +settings.json + +src/common/include/ocre/commit_id.h + +**/.DS_Store + +# hidden files +.* +!.git +!.gitignore +!/.gitmodules +!/.github +!.devcontainer +!.clang-format diff --git a/.gitmodules b/.gitmodules index 6ac55962..2e94ed92 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,8 @@ +# @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 + [submodule "wasm-micro-runtime"] path = wasm-micro-runtime url = https://github.com/project-ocre/wasm-micro-runtime.git diff --git a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/custom,rng-sensor.yaml b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/custom,rng-sensor.yaml index 73a86d79..f46e0a10 100644 --- a/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/custom,rng-sensor.yaml +++ b/src/runtime/wamr-wasip1/ocre_api/ocre_sensors/custom,rng-sensor.yaml @@ -1,3 +1,8 @@ +# @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 + # custom,rng-sensor.yaml title: Custom RNG Sensor diff --git a/src/samples/supervisor/zephyr/boards/overlay-nsos.conf b/src/samples/supervisor/zephyr/boards/overlay-nsos.conf index c4cb08fe..32f33e23 100644 --- a/src/samples/supervisor/zephyr/boards/overlay-nsos.conf +++ b/src/samples/supervisor/zephyr/boards/overlay-nsos.conf @@ -1,3 +1,8 @@ +# @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 + CONFIG_ETH_NATIVE_TAP=n CONFIG_NET_DRIVERS=y CONFIG_NET_SOCKETS=y diff --git a/src/samples/supervisor/zephyr/boards/shields/enc28j60/Kconfig.defconfig b/src/samples/supervisor/zephyr/boards/shields/enc28j60/Kconfig.defconfig index 71a47db2..d86c60d5 100644 --- a/src/samples/supervisor/zephyr/boards/shields/enc28j60/Kconfig.defconfig +++ b/src/samples/supervisor/zephyr/boards/shields/enc28j60/Kconfig.defconfig @@ -1,3 +1,7 @@ +# @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 SHIELD_ENC28J60 diff --git a/src/samples/supervisor/zephyr/boards/shields/enc28j60/Kconfig.shield b/src/samples/supervisor/zephyr/boards/shields/enc28j60/Kconfig.shield index f665f20d..0a4b4b3a 100644 --- a/src/samples/supervisor/zephyr/boards/shields/enc28j60/Kconfig.shield +++ b/src/samples/supervisor/zephyr/boards/shields/enc28j60/Kconfig.shield @@ -1,3 +1,8 @@ +# @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 + config SHIELD_ENC28J60 def_bool $(shields_list_contains,enc28j60) \ No newline at end of file diff --git a/src/samples/supervisor/zephyr/boards/shields/enc28j60/shield.yml b/src/samples/supervisor/zephyr/boards/shields/enc28j60/shield.yml index 3ed0619f..d250b35d 100644 --- a/src/samples/supervisor/zephyr/boards/shields/enc28j60/shield.yml +++ b/src/samples/supervisor/zephyr/boards/shields/enc28j60/shield.yml @@ -1,3 +1,8 @@ +# @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 + shield: name: enc28j60 full_name: Microchip ENC28J60 Ethernet Shield diff --git a/src/samples/supervisor/zephyr/boards/shields/wiznet_w5500/Kconfig.defconfig b/src/samples/supervisor/zephyr/boards/shields/wiznet_w5500/Kconfig.defconfig index ee715a3e..8975f0fe 100644 --- a/src/samples/supervisor/zephyr/boards/shields/wiznet_w5500/Kconfig.defconfig +++ b/src/samples/supervisor/zephyr/boards/shields/wiznet_w5500/Kconfig.defconfig @@ -1,3 +1,7 @@ +# @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 SHIELD_WIZNET_W5500 diff --git a/src/samples/supervisor/zephyr/boards/shields/wiznet_w5500/Kconfig.shield b/src/samples/supervisor/zephyr/boards/shields/wiznet_w5500/Kconfig.shield index 2438b89b..f0770bd4 100644 --- a/src/samples/supervisor/zephyr/boards/shields/wiznet_w5500/Kconfig.shield +++ b/src/samples/supervisor/zephyr/boards/shields/wiznet_w5500/Kconfig.shield @@ -1,2 +1,7 @@ +# @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 + config SHIELD_WIZNET_W5500 def_bool $(shields_list_contains,wiznet_w5500) diff --git a/src/samples/supervisor/zephyr/boards/shields/wiznet_w5500/shield.yml b/src/samples/supervisor/zephyr/boards/shields/wiznet_w5500/shield.yml index c239cecc..21d1414a 100644 --- a/src/samples/supervisor/zephyr/boards/shields/wiznet_w5500/shield.yml +++ b/src/samples/supervisor/zephyr/boards/shields/wiznet_w5500/shield.yml @@ -1,3 +1,8 @@ +# @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 + shield: name: wiznet_w5500 full_name: WIZnet W5500 Ethernet Shield diff --git a/tests_hw/beginTests.sh b/tests_hw/beginTests.sh index 5f9cf1dc..782faa4e 100755 --- a/tests_hw/beginTests.sh +++ b/tests_hw/beginTests.sh @@ -1,4 +1,8 @@ #!/bin/bash +# @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 TG=$1 LOGFILE="/tmp/$TG.log" @@ -116,4 +120,4 @@ else echo "$NAME test group failed" fi -exit $TEST_GROUP_RESULT \ No newline at end of file +exit $TEST_GROUP_RESULT diff --git a/tests_hw/groups/flashValidation/clean.sh b/tests_hw/groups/flashValidation/clean.sh index 6b895bf1..415d2310 100644 --- a/tests_hw/groups/flashValidation/clean.sh +++ b/tests_hw/groups/flashValidation/clean.sh @@ -1 +1,6 @@ -echo "Cleanup is complete" \ No newline at end of file +# @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 + +echo "Cleanup is complete" diff --git a/tests_hw/groups/flashValidation/setup.sh b/tests_hw/groups/flashValidation/setup.sh index 78545bd9..51c7d0c8 100644 --- a/tests_hw/groups/flashValidation/setup.sh +++ b/tests_hw/groups/flashValidation/setup.sh @@ -1 +1,6 @@ -echo "Setup is complete" \ No newline at end of file +# @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 + +echo "Setup is complete" From fe7b34a2d7cde29556191668e58c4c16685f047e Mon Sep 17 00:00:00 2001 From: SorinO Date: Mon, 23 Feb 2026 13:33:44 +0200 Subject: [PATCH 3/4] ci(formatting-checks): add license banner checker for conf files 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 e5536f5e..de6b986b 100644 --- a/.github/workflows/formatting-checks.yml +++ b/.github/workflows/formatting-checks.yml @@ -41,3 +41,6 @@ jobs: - name: Run Banner License Checks run: sh scripts/check_license_banner.sh + + - name: License Banner Checks(conf files) + run: sh scripts/check_license_banner_conf_files.sh From 1c4ce5261b343789498f9506a5d59bba23423b69 Mon Sep 17 00:00:00 2001 From: SorinO Date: Mon, 23 Feb 2026 13:38:19 +0200 Subject: [PATCH 4/4] ci/scripts: modifications from previous PR Signed-off-by: SorinO --- .github/workflows/formatting-checks.yml | 4 ++-- .../{check_license_banner.sh => check_license_banner_c.sh} | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) rename scripts/{check_license_banner.sh => check_license_banner_c.sh} (97%) diff --git a/.github/workflows/formatting-checks.yml b/.github/workflows/formatting-checks.yml index de6b986b..6e09407f 100644 --- a/.github/workflows/formatting-checks.yml +++ b/.github/workflows/formatting-checks.yml @@ -39,8 +39,8 @@ jobs: - name: Run YAML Format Checks run: sh scripts/yml_linter.sh - - name: Run Banner License Checks - run: sh scripts/check_license_banner.sh + - name: License Banner Checks(.c files) + run: sh scripts/check_license_banner_c.sh - name: License Banner Checks(conf files) run: sh scripts/check_license_banner_conf_files.sh diff --git a/scripts/check_license_banner.sh b/scripts/check_license_banner_c.sh similarity index 97% rename from scripts/check_license_banner.sh rename to scripts/check_license_banner_c.sh index b5ce4869..dc6b5f45 100644 --- a/scripts/check_license_banner.sh +++ b/scripts/check_license_banner_c.sh @@ -38,7 +38,6 @@ 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/*' \