Build image recipe: a patched path dependency goes in whole 87eb0f97c52d
recipe.py stubbed every path package's sources, which is right for the workspace's own crates and wrong for a third-party crate patched in from vendor/: the warm build then compiled object_store against an empty crc-fast. A path package that is not a workspace member is copied as it is. refs andymccall/oxygen#63
- Author
- Andy McCall @andymccall <[email protected]>
- When
- · 2026-10-04 00:42 UTC
- Signature
- ✔ signed by Andy McCall
- Hash
87eb0f97c52d4c3a030da5281bf2b3a78f343b55737cacea2866ffe1be73ca51- Depends on
- eba589f87e4f
- Depended on by
- 9c8820a50d7f
- In bookmarks
- main newer-pipeline push-uses-login
- In tags
- v0.2.0 v0.3.0 v0.3.1 v0.4.0 v0.5.0 v0.5.1 v0.5.2 v0.5.3
- Edits
- 4 atoms, 0 tree operations, 1 file
Browse the tree at this change
modified images/rust/recipe.py +15 −4
| 1 | 1 | #!/usr/bin/env python3 |
|
| 2 | 2 | """Write a dependency recipe of a Cargo workspace (backlog F6b2). |
|
| 3 | 3 | ||
| 4 | - | The recipe is the workspace with its sources stubbed out: every local |
|
| 5 | - | package's Cargo.toml (and the workspace roots its path dependencies |
|
| 6 | - | inherit from), the lock file, real build scripts, and an empty file for |
|
| 7 | - | each other target. Building it compiles exactly the dependencies the real |
|
| 4 | + | The recipe is the workspace with its sources stubbed out: every member's |
|
| 5 | + | Cargo.toml (and the workspace roots its path dependencies inherit from), |
|
| 6 | + | the lock file, real build scripts, and an empty file for each other |
|
| 7 | + | target. A path dependency that is not a member (a patched third-party |
|
| 8 | + | crate under vendor/) is copied whole: it is built as a dependency. Building it compiles exactly the dependencies the real |
|
| 8 | 9 | workspace uses, with the same features, so the build image can hold them |
|
| 9 | 10 | prebuilt: jobs copy that target directory in and compile only their own |
|
| 10 | 11 | crates. |
|
| … | 35 unchanged lines |
||
| 46 | 47 | ||
| 47 | 48 | for name in ("Cargo.toml", "Cargo.lock"): |
|
| 48 | 49 | put(os.path.join(root, name)) |
|
| 50 | + | members = set(meta["workspace_members"]) |
|
| 49 | 51 | for p in meta["packages"]: |
|
| 50 | 52 | if p["source"] is not None: |
|
| 51 | 53 | continue |
|
| 52 | 54 | manifest = p["manifest_path"] |
|
| 55 | + | if p["id"] not in members: |
|
| 56 | + | # A path dependency that is not a member: a patched third-party |
|
| 57 | + | # crate under vendor/. It is a dependency, so it goes in whole. |
|
| 58 | + | src_dir = os.path.dirname(manifest) |
|
| 59 | + | rel = os.path.relpath(src_dir, root) |
|
| 60 | + | if rel.startswith(".."): |
|
| 61 | + | sys.exit(f"{src_dir} is outside the workspace; a recipe holds only paths under it") |
|
| 62 | + | shutil.copytree(src_dir, os.path.join(out, rel), dirs_exist_ok=True) |
|
| 63 | + | continue |
|
| 53 | 64 | put(manifest) |
|
| 54 | 65 | # Workspace roots above a path dependency, for `workspace = true`. |
|
| 55 | 66 | d = os.path.dirname(os.path.dirname(manifest)) |
|
| … | 18 unchanged lines |