From 92a20d902d18cb9f0f762e5c7ab6278d49b48071 Mon Sep 17 00:00:00 2001 From: "Abner C. Paula" Date: Thu, 5 Dec 2024 08:50:26 -0300 Subject: Add workflow to automatically update LICENSE file with recipe licenses Originally from meta-freescale-3rdparty. Signed-off-by: Abner C. Paula (cherry picked from commit 77f6565f4ac5d9a57dc49abafa04dca07cb2979a) --- scripts/generate-license-file | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 scripts/generate-license-file (limited to 'scripts/generate-license-file') diff --git a/scripts/generate-license-file b/scripts/generate-license-file new file mode 100755 index 00000000..b6d43cd9 --- /dev/null +++ b/scripts/generate-license-file @@ -0,0 +1,18 @@ +#!/bin/bash + +# Create or clear the LICENSE file +echo "# License Information" > LICENSE +echo "" >> LICENSE +echo "This file lists all licenses used by recipes in the meta-freescale-3rdparty layer." >> LICENSE +echo "" >> LICENSE + +# Find all .bb and .inc files and extract license information +find . -type f \( -name "*.bb" -o -name "*.inc" \) | while read -r file; do + # Extract the license line from each recipe file, if it exists + license_line=$(grep -i "^LICENSE" "$file") + if [ -n "$license_line" ]; then + echo "$file: $license_line" >> LICENSE + fi +done + +echo "LICENSE file has been generated and updated with current recipe licenses." -- cgit v1.2.3-54-g00ecf