Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions .github/scripts/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from datetime import datetime, timezone
import gzip
import hashlib
import importlib.util
import inspect
import io
import json
Expand Down Expand Up @@ -401,13 +402,9 @@ def sdk(engine, metadata):
raise ValueError("Engine and binding libraries conflict: " + path.name)
shutil.copy2(path, destination)
shutil.copytree(ROOT / "lib/include", prefix / "include")
licenses = prefix / "licenses/bindings"
licenses.mkdir(parents=True)
shutil.copy2(ROOT / "LICENSE", licenses / "LICENSE")
shutil.copy2(ROOT / "deps/mariadb-connector-c/COPYING.LIB", licenses / "MariaDB-COPYING.LIB")
shutil.copy2(ROOT / "deps/mariadb-connector-c/external/zlib/zlib.h", licenses / "zlib.h")
if layout != "windows":
shutil.copy2(ROOT / "deps/openssl/LICENSE.txt", licenses / "OpenSSL-LICENSE.txt")
run([sys.executable, ROOT / "scripts/stage-license-bundle.py", "--sdk-dir", prefix,
"--version", metadata["package_versions"]["python"],
"--layout", layout, "--tls-provider", metadata["tls_provider"]])
metadata["target"] = os.environ["PACKAGE_TARGET"] + {
"linux": "-glibc2.28", "macos": "-min15.0", "windows": "-md", "android": "-api28",
}[layout]
Expand All @@ -420,6 +417,21 @@ def sdk(engine, metadata):
return prefix


def license_bundle_problems(bindings):
spec = importlib.util.spec_from_file_location("stage_license_bundle", ROOT / "scripts/stage-license-bundle.py")
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module.verify_bundle(bindings)


def verify_license_bundle(root):
problems = license_bundle_problems(root / "pylibseekdb/licenses/bindings")
if problems:
raise ValueError("bindings license bundle: " + "; ".join(problems))
if not (root / "pylibseekdb/licenses/THIRD_PARTY_COMPONENTS.json").is_file():
print("warning: wheel has no engine license inventory: pylibseekdb/licenses")


def python_wheels():
prefix = WORK / "sdk"
metadata = json.loads((prefix / "BUILD-INFO.json").read_text())
Expand Down Expand Up @@ -458,6 +470,7 @@ def python_wheels():
with zipfile.ZipFile(wheel) as stream:
stream.extractall(checked)
symbols.verify_stripped(checked)
verify_license_bundle(checked)
wheel.with_name(wheel.name + ".sha256").write_text(digest(wheel) + " " + wheel.name + "\n")


Expand Down
21 changes: 21 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
seekdb-bindings
Copyright (c) 2026 OceanBase and contributors

This product includes software developed by OceanBase and contributors and is
licensed under the Apache License, Version 2.0 (see LICENSE).

Third-party components bundled by the pylibseekdb wheel and the libseekdb SDK:

MariaDB Connector/C 3.4.8 LGPL-2.1 licenses/bindings/mariadb-connector-c/COPYING.LIB
OpenSSL 3.5.9 Apache-2.0 licenses/bindings/openssl/LICENSE.txt
zlib 1.3.1 Zlib licenses/bindings/zlib/LICENSE
nanobind (see inventory) BSD-3-Clause licenses/bindings/nanobind/LICENSE
libaio 0.3.112 LGPL-2.1 licenses/bindings/libaio/COPYING

The bundled seekdb engine carries its own third-party notices and license
texts under licenses/, next to the bindings layer.

The complete component inventory and the redistribution requirements are
generated at build time as licenses/bindings/THIRD_PARTY_COMPONENTS.md,
licenses/bindings/THIRD_PARTY_COMPONENTS.json and
licenses/bindings/REDISTRIBUTION.md.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ seekdb-bindings/
├── rust/ Rust lifecycle binding, embedded native runtime and SQL examples
├── java/ Java lifecycle API and JNI bridge
├── android/ Android packaging and examples
├── licenses/ third-party license corpus bundled into the SDK and wheels
├── scripts/ wheel build, seekdb manylinux build, verify-wheel, etc.
└── deps/ vendored mariadb-connector-c, googletest
```
Expand Down
56 changes: 56 additions & 0 deletions licenses/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Third-party license corpus

Each directory under `licenses/` is one third-party component bundled by the
pylibseekdb wheel and the libseekdb SDK:

```text
licenses/<component>/
METADATA.json
<upstream license text>
```

`METADATA.json` records the component name, version, upstream source, packaging
form, license, modification state, license files, redistribution requirements,
and the evidence for the recorded version.

`METADATA.json` may also carry:

- `version_from`: an ordered list of build-time version sources. `build_requirement`
reads the exact `name==x.y.z` pin from the `[build-system]` requires of
`python/pyproject.toml` (the wheel build and the inventory share that pin);
`python_package` asks `importlib.metadata` of the running interpreter.
- `version_check`: the dependency source or engine inventory entry the recorded
version must still match.
- `tls_providers`: the TLS providers under which the component is linked. The
staging step omits the record for other providers (Windows builds use schannel).
- `system_library`: layouts that provide the library themselves (`layouts`), the
`packaged_as` text to record instead of the vendored form, and the SDK header
(`version_from`) the version is read from. The dependency-source `version_check`
is skipped for those layouts because the vendored copy is not compiled.

`scripts/stage-license-bundle.py` walks this directory, validates the metadata
against the pinned dependency sources, and renders the bindings layer of the
license bundle inside the SDK. `package.py` passes the packaging `--layout` and
`--tls-provider`; a wheel built without the SDK (`make wheel`,
`scripts/build-pylibseekdb-wheel.sh`) renders the bindings layer alone with
`--output` and `--version`. `--verify <bindings dir>` checks a rendered bundle
and is what `package.py` and `scripts/verify-wheel.sh` run on every wheel:

- `licenses/bindings/LICENSE` and `NOTICE` for the seekdb-bindings project;
- `licenses/bindings/THIRD_PARTY_COMPONENTS.md` and `.json` inventory;
- `licenses/bindings/REDISTRIBUTION.md`;
- `licenses/bindings/MANIFEST.sha256`;
- the component directories with the original license texts.

The verification requires every inventory license text and every required file
to be listed in a non-empty manifest with a matching digest, allows no
unlisted file, and rejects a `build_requirement` version that no longer matches
the pin.

The engine's own license bundle, generated by the seekdb source tree, stays
under `licenses/` next to `bindings/`. `licenses/README.md` explains the two
layers and points at both inventories.

The license texts must remain verbatim. Update the version and evidence fields
whenever the corresponding dependency changes; the build fails when the
recorded version no longer matches the dependency source.
Loading
Loading