pack: resolve every component from the devShell closure, not the store - #16
Merged
Merged
Conversation
nix_locate() globbed /nix/store and took the first match, which is a property of the build HOST's store and not of this flake: on a store holding more than one version of a component, the first match can be a stranger. libuuid.so.1 already bit that way (af36611: a util-linux built against a newer glibc); the same shape remained for the antlr runtime ("antl" matches any antlr in the store), libffi, prjxray (older builds of other revisions sit in long-lived stores; measured on the dev mac: four prjxray outputs, the first glob match not the shell's one and every python package (a version hardcoded in the glob breaks on any nixpkgs bump; two pyyaml versions already coexist on the dev mac). Every component is now resolved from what the .#pack devShell actually links: * python packages (fasm, textx, yaml, simplejson, intervaltree, sortedcontainers, prjxray): importlib.util.find_spec() on the shell's own interpreter -- the shellHook's PYTHONPATH points at the site-packages of the closure, so what it resolves is by construction what the shell linked. copy_python_dep() drops its version argument (and its import-name special case) with it. * libffi: the DT_NEEDED/LC_LOAD_DYLIB of the _ctypes extension of the python3.12 the package ships. The name filter is _ctypes. with the dot: lib-dynload also carries _ctypes_test, which links no libffi. * libantlr4-runtime: scanned across the native objects of the fasm package's parser/ -- which of them carries the dependency differs by platform (the cython extension dlopens libparse_fasm). * libuuid.so.1: unchanged, still resolved through the antlr library. resolve_needed() generalizes the libuuid helper into needed_deps() (ldd on Linux, otool -L via macpack._otool_deps on Darwin) with a regex fullmatch, and nix_locate() is removed rather than kept as a fallback: every former caller now has a closure answer, and a store-glob fallback would reintroduce the silent stranger-picking this commit removes. EOF )
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the /nix/store glob (nix_locate, first match) with resolution from what the .#pack devShell actually links: python packages via the shell interpreter, libffi via the shipped _ctypes,
libantlr4-runtime via the fasm parser objects, libuuid as before. Package byte-identical to main on linux (5562 files) and macOS (5558); L1 37/37 with the release bins; darwin E2E 3/3; 148 tests.