PMDB: Exporter: Export SPDX Expressions and Migrate to v3

Overview

We want the exporter to return full SPDX expressions, not just individual license identifiers. This requires migrating to the v3 format, and is also a good opportunity to move the export artifacts to Cloudflare R2 to reduce egress costs.

Proposed Work

  • Modify the export logic to conditionally return an SPDX license id or expression
  • Expose a raw expression string
  • Publish a JSON schema for the v3 license object
  • Migrate to v3 as part of the expression support work (reusing the manifest.json + full export + deltas approach)

Export format

Each entry in default_licenses and other_licenses should contains either expression or licenses, for example:

{
  "name": "app.cash.backfila/client-misk-hibernate",
  "lowest_version": "0.1.4-20211109.2053-alpha-41370-d",
  "highest_version": "2026.3.26.140500-911435-f",
  "default_licenses": [
    {
      "expression": "Apache-2.0 AND (MIT OR GPL-3.0)",
    }
  ],
  "other_licenses": [
    {
      "licenses": [
        {
          "id": "MIT",
        }
      ],
      "versions": [
        "0.1.3-20210127.1838-76ab4fc",
        "0.1.3-20210805.0116-93702c4",
        "0.1.3-20210805.0207-0d08d2b",
        "0.1.4-20210806.0204-5341f38"
      ]
    }
  ]
}

Suggested breakdown

  1. v3 format + expression support — define the v3 license object and its JSON schema (each block carries expression xor licenses), and carry the raw expression through the versions compression pipeline.

  2. v3 delta export: read expressions from the db and export to the v3 manifest.json + deltas layout.

  3. v3 full snapshot: produce the full_dataset.tar.zst bootstrap archive.

Out of scope:

  • Host artifacts on Cloudflare R2
Edited by Orin Naaman