()
| 60 | } |
| 61 | |
| 62 | func (d *DerivationBuilder) init() error { |
| 63 | if d.Out == "" { |
| 64 | d.Out = os.Getenv("out") |
| 65 | if d.Out == "" { |
| 66 | return fmt.Errorf("patchpkg: $out is empty (is this being run from a nix build?)") |
| 67 | } |
| 68 | } |
| 69 | if d.Glibc != "" { |
| 70 | if d.glibcPatcher == nil { |
| 71 | d.glibcPatcher = &libPatcher{} |
| 72 | } |
| 73 | err := d.glibcPatcher.setGlibc(newPackageFS(d.Glibc)) |
| 74 | if err != nil { |
| 75 | return fmt.Errorf("patchpkg: can't patch glibc using %s: %v", d.Glibc, err) |
| 76 | } |
| 77 | } |
| 78 | if d.Gcc != "" { |
| 79 | if d.glibcPatcher == nil { |
| 80 | d.glibcPatcher = &libPatcher{} |
| 81 | } |
| 82 | err := d.glibcPatcher.setGcc(newPackageFS(d.Gcc)) |
| 83 | if err != nil { |
| 84 | return fmt.Errorf("patchpkg: can't patch gcc using %s: %v", d.Gcc, err) |
| 85 | } |
| 86 | } |
| 87 | if src := os.Getenv("src"); src != "" { |
| 88 | d.src = newPackageFS(src) |
| 89 | } |
| 90 | return nil |
| 91 | } |
| 92 | |
| 93 | // Build applies patches to a package store path and puts the result in the |
| 94 | // d.Out directory. |
no test coverage detected