Skip to content

Commit dc7529f

Browse files
committed
fix(rpm): install every SDK module and record the license accounting
The python3-openshell %install copied only __init__.py, sandbox.py and _proto/, but the package imports .errors, .mutations and .providers and ships a py.typed marker, so an installed RPM could not import openshell. Install the missing files and add a %check that fails if any relative import in the installed package has no matching installed module. Importing the package needs grpcio, which the build environment lacks, so the check is static. Set License to the minimal SPDX expression covering every crate linked into the shipped binaries, keep the pure-Python subpackage at Apache-2.0, and note how the non-crate content is covered. Signed-off-by: politerealism <[email protected]>
1 parent d00e9fa commit dc7529f

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

‎openshell.spec‎

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ Version: %{openshell_version}
1717
Release: 1.20260518180028805757.podman.toml.gateway.listener.11.g8c0cb7c8%{?dist}
1818
Summary: Safe, sandboxed runtimes for autonomous AI agents
1919

20-
License: Apache-2.0
20+
# OpenShell's own code is Apache-2.0. The binaries statically link third-party
21+
# crates; this is the minimal SPDX expression covering every crate linked into
22+
# openshell, openshell-gateway and openshell-prover (computed from `cargo tree`
23+
# license metadata, treating "X OR MIT" as satisfied by MIT or Apache-2.0).
24+
# The docs, man page sources, config templates and Python SDK sources carry
25+
# Apache-2.0 SPDX headers or fall under the repository LICENSE. The unit file is
26+
# generated from this spec. Re-check when Cargo.lock changes.
27+
License: Apache-2.0 AND BSD-3-Clause AND CC0-1.0 AND CDLA-Permissive-2.0 AND ISC AND MIT AND Unicode-3.0 AND Zlib
2128
URL: https://github.com/NVIDIA/OpenShell
2229
Source0: openshell-%{openshell_version}.tar.gz
2330
Source1: openshell-%{openshell_version}-vendor.tar.xz
@@ -69,6 +76,8 @@ within an operator-supplied maximum without connecting to a gateway.
6976
# --- Python SDK sub-package ---
7077
%package -n python3-%{name}
7178
Summary: OpenShell Python SDK for agent execution and management
79+
# Pure Python; links none of the crates covered by the main License tag.
80+
License: Apache-2.0
7281
# Use Recommends instead of Requires because Fedora 43+ ships older
7382
# versions of grpcio (1.48) and protobuf (3.19) than the SDK needs.
7483
# Users on distros with older packages can install these via pip/uv.
@@ -195,7 +204,11 @@ install -d %{buildroot}%{python3_sitelib}/%{name}
195204
install -d %{buildroot}%{python3_sitelib}/%{name}/_proto
196205

197206
install -pm 0644 python/%{name}/__init__.py %{buildroot}%{python3_sitelib}/%{name}/
207+
install -pm 0644 python/%{name}/errors.py %{buildroot}%{python3_sitelib}/%{name}/
208+
install -pm 0644 python/%{name}/mutations.py %{buildroot}%{python3_sitelib}/%{name}/
209+
install -pm 0644 python/%{name}/providers.py %{buildroot}%{python3_sitelib}/%{name}/
198210
install -pm 0644 python/%{name}/sandbox.py %{buildroot}%{python3_sitelib}/%{name}/
211+
install -pm 0644 python/%{name}/py.typed %{buildroot}%{python3_sitelib}/%{name}/
199212
install -pm 0644 python/%{name}/_proto/__init__.py %{buildroot}%{python3_sitelib}/%{name}/_proto/
200213
install -pm 0644 python/%{name}/_proto/*.py %{buildroot}%{python3_sitelib}/%{name}/_proto/
201214

@@ -237,6 +250,22 @@ touch %{buildroot}%{python3_sitelib}/%{name}-%{openshell_python_version}.dist-in
237250
# build environment.
238251
PYTHONPATH=%{buildroot}%{python3_sitelib} %{python3} -c "from importlib.metadata import version; v = version('openshell'); print(v); assert v == '%{openshell_python_version}', f'expected %{openshell_python_version}, got {v}'"
239252

253+
# Verify every module the installed SDK pulls in with a relative import was
254+
# installed. Importing the package needs grpcio, which the build environment
255+
# does not have, so check the imports statically.
256+
%{python3} - %{buildroot}%{python3_sitelib}/%{name} <<'PY'
257+
import ast, pathlib, sys
258+
pkg = pathlib.Path(sys.argv[1])
259+
missing = []
260+
for source in pkg.glob("*.py"):
261+
for node in ast.walk(ast.parse(source.read_text())):
262+
if isinstance(node, ast.ImportFrom) and node.level == 1 and node.module:
263+
base = pkg.joinpath(*node.module.split("."))
264+
if not (base.with_suffix(".py").exists() or (base / "__init__.py").exists()):
265+
missing.append(f"{source.name}: .{node.module}")
266+
assert not missing, f"installed SDK imports modules that were not installed: {missing}"
267+
PY
268+
240269
# Verify the RPM default TOML config template was installed.
241270
# A missing template means first-start seeding silently falls back to the
242271
# binary default of 127.0.0.1, which breaks Podman sandbox connectivity.

0 commit comments

Comments
 (0)