(ctx context.Context, pkg *packageFS)
| 152 | } |
| 153 | |
| 154 | func (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 | |
| 185 | func (d *DerivationBuilder) copyDir(out *packageFS, path string) error { |
| 186 | path, err := out.OSPath(path) |
no test coverage detected