MCPcopy Create free account
hub / github.com/jetify-com/devbox / restoreMissingRefs

Method restoreMissingRefs

internal/patchpkg/builder.go:154–183  ·  view source on GitHub ↗
(ctx context.Context, pkg *packageFS)

Source from the content-addressed store, hash-verified

152}
153
154func (d *DerivationBuilder) restoreMissingRefs(ctx context.Context, pkg *packageFS) error {
155 // Find store path references to build inputs that were removed
156 // from Python.
157 refs, err := d.findRemovedRefs(ctx, pkg)
158 if err != nil {
159 return err
160 }
161
162 // Group the references we want to restore by file path.
163 d.bytePatches = make(map[string][]fileSlice, len(refs))
164 for _, ref := range refs {
165 d.bytePatches[ref.path] = append(d.bytePatches[ref.path], ref)
166 }
167
168 // If any of those references have shared libraries, add them
169 // back to Python's RPATH.
170 if d.glibcPatcher != nil {
171 nixStore := cmp.Or(os.Getenv("NIX_STORE"), "/nix/store")
172 seen := make(map[string]bool)
173 for _, ref := range refs {
174 storePath := filepath.Join(nixStore, string(ref.data))
175 if seen[storePath] {
176 continue
177 }
178 seen[storePath] = true
179 d.glibcPatcher.prependRPATH(newPackageFS(storePath))
180 }
181 }
182 return nil
183}
184
185func (d *DerivationBuilder) copyDir(out *packageFS, path string) error {
186 path, err := out.OSPath(path)

Callers 1

buildMethod · 0.95

Calls 3

findRemovedRefsMethod · 0.95
newPackageFSFunction · 0.85
prependRPATHMethod · 0.80

Tested by

no test coverage detected