Skip to contentSkip to conversation

scripts/contrib: Add oe-image-files-spdx script

PATCH New Joshua Watt 1 participant 1 message Feb 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/contrib: Add oe-image-files-spdx script

Adds a template for a python project that processes the SPDX 3.0.1 output from a build and lists all the files on the root file system with their checksums

This is intended to be an example to show how to deal with the SPDX data to do common tasks.

---
 .../contrib/oe-image-files-spdx/.gitignore    |  8 ++
 scripts/contrib/oe-image-files-spdx/README.md | 24 ++++++
 .../oe-image-files-spdx/pyproject.toml        | 23 +++++
 .../src/oe_image_files/__init__.py            |  1 +
 .../src/oe_image_files/main.py                | 86 +++++++++++++++++++
 .../src/oe_image_files/version.py             |  1 +
 6 files changed, 143 insertions(+)
 create mode 100644 scripts/contrib/oe-image-files-spdx/.gitignore
 create mode 100644 scripts/contrib/oe-image-files-spdx/README.md
 create mode 100644 scripts/contrib/oe-image-files-spdx/pyproject.toml
 create mode 100644 scripts/contrib/oe-image-files-spdx/src/oe_image_files/__init__.py
 create mode 100644 scripts/contrib/oe-image-files-spdx/src/oe_image_files/main.py
 create mode 100644 scripts/contrib/oe-image-files-spdx/src/oe_image_files/version.py
scripts/contrib/oe-image-files-spdx/.gitignore new file +8 -0
new file mode 100644
index 00000000000..285851c9848
@@ -0,0 +1,8 @@
+*.spdx.json
+*.pyc
+*.bak
+*.swp
+*.swo
+*.swn
+venv/*
+.venv/*
scripts/contrib/oe-image-files-spdx/README.md new file +24 -0
new file mode 100644
index 00000000000..44f76eacd8e
@@ -0,0 +1,24 @@
+# OE Image Files from SBoM
+
+This is an example python script that will list the packaged files with their
+checksums based on the SPDX 3.0.1 SBoM.
+
+It can be used as a template for other programs to investigate output based on
+OE SPDX SBoMs
+
+## Installation
+
+This project can be installed using an virtual environment:
+```
+python3 -m venv .venv
+.venv/bin/activate
+python3 -m pip install -e '.[dev]'
+```
+
+## Usage
+
+After installing, the `oe-image-files` program can be used to show the files, e.g.:
+
+```
+oe-image-files core-image-minimal-qemux86-64.rootfs.spdx.json
+```
scripts/contrib/oe-image-files-spdx/pyproject.toml new file +23 -0
new file mode 100644
index 00000000000..3fab5dd605d
@@ -0,0 +1,23 @@
+[project]
+name = "oe-image-files"
+description = "Displays all packaged files on the root file system"
+dynamic = ["version"]
+requires-python = ">= 3.8"
+readme = "README.md"
+
+dependencies = [
+    "spdx_python_model @ git+https://github.com/spdx/spdx-python-model.git@aa40861f11d1b5d20edba7101835341a70d91179",
+]
+
+[project.scripts]
+oe-image-files = "oe_image_files:main"
+
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+[tool.hatch.version]
+path = "src/oe_image_files/version.py"
+
+[tool.hatch.metadata]
+allow-direct-references = true
scripts/contrib/oe-image-files-spdx/src/oe_image_files/__init__.py new file +1 -0
new file mode 100644
index 00000000000..c28a133f2dd
@@ -0,0 +1 @@
+from .main import main
scripts/contrib/oe-image-files-spdx/src/oe_image_files/main.py new file +86 -0

86 lines not on this page · raw message

scripts/contrib/oe-image-files-spdx/src/oe_image_files/version.py new file +1 -0
new file mode 100644
index 00000000000..901e5110b2e
@@ -0,0 +1 @@
+VERSION = "0.0.1"
Signature · 1 line
2.48.1