From: Joshua Watt <jpewhacker@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Joshua Watt <JPEWhacker@gmail.com>
Subject: [OE-core][PATCH 01/22] scripts/pull-spdx-licenses.py: Add exceptions
Date: Tue, 14 Jul 2026 12:31:11 -0600 [thread overview]
Message-ID: <20260714190405.3328796-2-JPEWhacker@gmail.com> (raw)
In-Reply-To: <20260714190405.3328796-1-JPEWhacker@gmail.com>
Adds exceptions to the script that updates the SPDX license files
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
scripts/pull-spdx-licenses.py | 124 ++++++++++++++++++++++++----------
1 file changed, 87 insertions(+), 37 deletions(-)
diff --git a/scripts/pull-spdx-licenses.py b/scripts/pull-spdx-licenses.py
index 597a62133f..7d1715ff24 100755
--- a/scripts/pull-spdx-licenses.py
+++ b/scripts/pull-spdx-licenses.py
@@ -13,6 +13,88 @@ from pathlib import Path
TOP_DIR = Path(__file__).parent.parent
+def update_licenses(dest, version, overwrite, deprecated):
+ print(f"Pulling SPDX license list version {version}")
+ req = urllib.request.Request(
+ f"https://raw.githubusercontent.com/spdx/license-list-data/{version}/json/licenses.json"
+ )
+ with urllib.request.urlopen(req) as response:
+ spdx_licenses = json.load(response)
+
+ with (TOP_DIR / "meta" / "files" / "spdx-licenses.json").open("w") as f:
+ json.dump(spdx_licenses, f, sort_keys=True, indent=2)
+
+ total_count = len(spdx_licenses["licenses"])
+ updated = 0
+ for idx, lic in enumerate(spdx_licenses["licenses"]):
+ lic_id = lic["licenseId"]
+
+ print(f"[{idx + 1} of {total_count}] ", end="")
+
+ dest_license_file = dest / lic_id
+ if dest_license_file.is_file() and not overwrite:
+ print(f"Skipping {lic_id} since it already exists")
+ continue
+
+ print(f"Fetching {lic_id}... ", end="", flush=True)
+
+ req = urllib.request.Request(lic["detailsUrl"])
+ with urllib.request.urlopen(req) as response:
+ lic_data = json.load(response)
+
+ if lic_data["isDeprecatedLicenseId"] and not deprecated:
+ print("Skipping (deprecated)")
+ continue
+
+ with dest_license_file.open("w") as f:
+ f.write(lic_data["licenseText"])
+ updated += 1
+ print("done")
+
+ return updated
+
+
+def update_exceptions(dest, version, overwrite, deprecated):
+ print(f"Pulling SPDX license exceptions list version {version}")
+ req = urllib.request.Request(
+ f"https://raw.githubusercontent.com/spdx/license-list-data/{version}/json/exceptions.json"
+ )
+ with urllib.request.urlopen(req) as response:
+ spdx_exceptions = json.load(response)
+
+ with (TOP_DIR / "meta" / "files" / "spdx-exceptions.json").open("w") as f:
+ json.dump(spdx_exceptions, f, sort_keys=True, indent=2)
+
+ total_count = len(spdx_exceptions["exceptions"])
+ updated = 0
+ for idx, lic in enumerate(spdx_exceptions["exceptions"]):
+ lic_id = lic["licenseExceptionId"]
+
+ print(f"[{idx + 1} of {total_count}] ", end="")
+
+ dest_license_file = dest / lic_id
+ if dest_license_file.is_file() and not overwrite:
+ print(f"Skipping {lic_id} since it already exists")
+ continue
+
+ print(f"Fetching {lic_id}... ", end="", flush=True)
+
+ req = urllib.request.Request(lic["detailsUrl"])
+ with urllib.request.urlopen(req) as response:
+ lic_data = json.load(response)
+
+ if lic_data["isDeprecatedLicenseId"] and not deprecated:
+ print("Skipping (deprecated)")
+ continue
+
+ with dest_license_file.open("w") as f:
+ f.write(lic_data["licenseExceptionText"])
+ updated += 1
+ print("done")
+
+ return updated
+
+
def main():
parser = argparse.ArgumentParser(
description="Update SPDX License files from upstream"
@@ -55,44 +137,12 @@ def main():
data = json.load(response)
version = data["tag_name"]
- print(f"Pulling SPDX license list version {version}")
- req = urllib.request.Request(
- f"https://raw.githubusercontent.com/spdx/license-list-data/{version}/json/licenses.json"
+ license_count = update_licenses(args.dest, version, args.overwrite, args.deprecated)
+ exception_count = update_exceptions(
+ args.dest, version, args.overwrite, args.deprecated
)
- with urllib.request.urlopen(req) as response:
- spdx_licenses = json.load(response)
-
- with (TOP_DIR / "meta" / "files" / "spdx-licenses.json").open("w") as f:
- json.dump(spdx_licenses, f, sort_keys=True, indent=2)
-
- total_count = len(spdx_licenses["licenses"])
- updated = 0
- for idx, lic in enumerate(spdx_licenses["licenses"]):
- lic_id = lic["licenseId"]
-
- print(f"[{idx + 1} of {total_count}] ", end="")
-
- dest_license_file = args.dest / lic_id
- if dest_license_file.is_file() and not args.overwrite:
- print(f"Skipping {lic_id} since it already exists")
- continue
-
- print(f"Fetching {lic_id}... ", end="", flush=True)
-
- req = urllib.request.Request(lic["detailsUrl"])
- with urllib.request.urlopen(req) as response:
- lic_data = json.load(response)
-
- if lic_data["isDeprecatedLicenseId"] and not args.deprecated:
- print("Skipping (deprecated)")
- continue
-
- with dest_license_file.open("w") as f:
- f.write(lic_data["licenseText"])
- updated += 1
- print("done")
-
- print(f"Updated {updated} licenses")
+ print(f"Updated {license_count} licenses")
+ print(f"Updated {exception_count} exceptions")
return 0
--
2.54.0
next prev parent reply other threads:[~2026-07-14 19:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 18:31 [OE-core][PATCH 00/22] Rework LICENSE to be SPDX License Expressions Joshua Watt
2026-07-14 18:31 ` Joshua Watt [this message]
2026-07-14 18:31 ` [OE-core][PATCH 02/22] Add SPDX License Exceptions Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 03/22] Add SPDX license library Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 04/22] Parse LICENSE as SPDX Expression Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 05/22] linux-firmware: Convert to SPDX license strings Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 06/22] meta-selftest: Add NO_GENERIC_LICENSE Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 07/22] convert-spdx-licenses: Convert to valid SPDX expressions Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 08/22] gcc-common.inc: Remove LICENSE Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 09/22] gcc: Update license Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 10/22] xz: Replace deprecated SPDX identifier Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 11/22] autoconf-archive: " Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 12/22] gnu-config: " Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 13/22] libglvnd: " Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 14/22] flac: " Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 15/22] libgit2: " Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 16/22] Fix up licenses Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 17/22] lib: oe: license: Rework package licenses matching Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 18/22] classes/go-mod-update-modules: Switch to SPDX license Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 19/22] license: Remove tidy_licenses() Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 20/22] meta-selftest: Change license on test recipes Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 21/22] Convert licenses to SPDX expressions Joshua Watt
2026-07-14 18:31 ` [OE-core][PATCH 22/22] meta-selftest: libxpm: Fix license Joshua Watt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260714190405.3328796-2-JPEWhacker@gmail.com \
--to=jpewhacker@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.