Repository navigation
ruff: link pkgs' libzstd instead of zstd-sys's vendored copy - #1739
Conversation
ZSTD_SYS_USE_PKG_CONFIG=1 with pkgconf + zstd as build deps, libzstd as a runtime dep, and a readelf check that ruff NEEDs libzstd.so.1 (the same pattern as codex). ruff's lock has zstd-sys 2.1.2+zstd.1.5.7, the same zstd as pkgs'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
zstd 1.6.0 is on main now (pkgs#1694), so linking pkgs' libzstd no longer downgrades anything. Check the floor at build time so an older libzstd fails the build instead of shipping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Scope matches the title. Both files change only what the zstd link needs: two build deps, one runtime dep, the ZSTD_SYS_USE_PKG_CONFIG export, a version floor and a NEEDED check. Clobber none: git log on packages/ruff shows only version bumps before this branch, and the merge of main brought zstd 1.6.0 from #1694. Correctness the change is good. pkgconf ships usr/bin/pkg-config, toolchain supplies readelf through binutils, and base supplies sed and grep. The libzstd output of zstd matches libzstd.so.1, and packages/codex uses the same subsetOf zstd ["libzstd"] pattern. The existing smoke test starts ruff with only the runtime closure, so it fails if the runtime dep is missing. The PR body is stale: it says the PR is blocked on #1694 and that pkgs zstd is 1.5.7, and both statements are no longer true. Not checked, because the check needs a build: that zstd-sys 2.1.2 compiles and links against the 1.6.0 headers, and that workspace feature unification puts libzstd.so.1 in the ruff binary. The NEEDED check fails the build if the second assumption is wrong.
| # paths (source dir + cargo registry) and disable incremental builds. | ||
| export RUSTFLAGS="-C linker=gcc --remap-path-prefix=$(pwd)=/builddir --remap-path-prefix=$HOME/.cargo=/cargo" | ||
| export CARGO_INCREMENTAL=0 | ||
| # Link pkgs' libzstd instead of the copy vendored in zstd-sys (2.1.2+zstd.1.5.7), |
There was a problem hiding this comment.
nit · The comment pins the zstd-sys version 2.1.2+zstd.1.5.7. The automated ruff version bumps edit build.ncl only, so this number will be stale after the next bump that moves zstd-sys. Remove the version from the comment. The comment in packages/codex/build.sh names no version, so this is one instance.
There was a problem hiding this comment.
Fixed in the latest push: the comment no longer names a zstd-sys version.
The automated ruff bumps edit build.ncl only, so a version named here goes stale on the next bump that moves zstd-sys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
ruff links pkgs'
libzstdinstead of the copy vendored inzstd-sys:ZSTD_SYS_USE_PKG_CONFIG=1.pkgconfandzstdas build deps, andsubsetOf zstd ["libzstd"]as a runtime dep.readelfcheck fails the build unlessruffhasNEEDED libzstd.so.1.This is the same pattern as codex (#1713) and the uv PR.
Why
Evidence
Cargo.lock, read from the pinned tarball (sha2562c7f6831…), has zstd-sys2.1.2+zstd.1.5.7, zstd-safe 8.2.0 and zstd 0.14.3. pkgs zstd is 1.5.7, so the versions match.ruff -> ruff_db -> zip -> zstd -> zstd-safe -> zstd-sys. Thezstdfeature on zip comes fromty_vendored/zstd, whichty_projectenables.build.shruns a workspace-widecargo build --release, so feature unification turns it on for theruffbinary too.zstd-sys's pkg-config path panics whenlibzstdisn't found, so there is no silent fallback. The NEEDED check is belt-and-braces.minimal buildcheck is the verifier. Nothing was built locally.Expected saving: small per build (one C library, about a minute).
Follow-up idea (not in this PR)
build.shbuilds the whole workspace: ty, ty_server, the wasm crates and the rest, none of which this package ships. Restricting the cargo build to-p ruffwould save much more build time than this PR does.The trade-off: it drops the feature unification that turns on
ty_vendored/zstd. The vendored typeshed zip would then be Stored instead of zstd-compressed, and ruff would no longer link libzstd at all. That is a separate decision.🤖 Generated with Claude Code
Summary by CodeRabbit