From 859b9e07a872f6a741e62d446e041c6bb1c9ee67 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20H=C3=B6ppner?= <jonas.hoeppner@garz-fricke.com>
Date: Thu, 17 Oct 2024 08:39:24 +0200
Subject: [PATCH] YT-277: Add SPDX licenses to release

  Enable the creation of spdx json files in CI pipeline
  Add list of generated spdx files into Confluence release page
---
 build-pipeline.yml         |  2 ++
 confluence-page.xml.jinja2 | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/build-pipeline.yml b/build-pipeline.yml
index 9c5ba134..ac6d0184 100644
--- a/build-pipeline.yml
+++ b/build-pipeline.yml
@@ -152,6 +152,8 @@ workflow:
   - export MACHINE="${MACHINE}"
   - export DISTRO="${YOCTO_DISTRO}"
   - export EULA="1"
+  - echo "Enable SPDX License generation"
+  - export GENERATE_SPDX_LICENSES="true"
   - source "${SETUP_SCRIPT}" "${BUILD_PATH}"
 
 .run_build: &run_build
diff --git a/confluence-page.xml.jinja2 b/confluence-page.xml.jinja2
index 8999173d..0166af2f 100644
--- a/confluence-page.xml.jinja2
+++ b/confluence-page.xml.jinja2
@@ -207,6 +207,24 @@
                 {#- ------------------------------------------------------------------------------------------ -#}
                 {%- set files = [] -%}
                 {%- for file in FILES_machine -%}
+                {%- if "spdx" in file.lower() -%}
+                {%- set _ = used_files.append(file) -%}
+                {%- set _ = files.append(file) -%}
+                {%- endif -%}
+                {%- endfor -%}
+                {%- if files -%}
+                <tr>
+                    <th><b>Licensing</b></th>
+                    <td>
+                    {%- for file in files -%}
+                    <a href="{{ file }}">🔽 {{ (file | basename) }}</a>{{ "<br/>" if not loop.last else "" }}
+                    {%- endfor -%}
+                    </td>
+                </tr>
+                {%- endif -%}
+                {#- ------------------------------------------------------------------------------------------ -#}
+                {%- set files = [] -%}
+                {%- for file in FILES_machine -%}
                 {%- if file not in used_files -%}
                 {%- set _ = files.append(file) -%}
                 {%- endif -%}
-- 
GitLab