|
9 | 9 |
|
10 | 10 | "go.jetpack.io/devbox/internal/boxcli/featureflag"
|
11 | 11 | "go.jetpack.io/devbox/internal/devpkg"
|
| 12 | + "go.jetpack.io/devbox/internal/lock" |
12 | 13 | "go.jetpack.io/devbox/internal/nix"
|
13 | 14 | "go.jetpack.io/devbox/internal/nix/nixprofile"
|
14 | 15 | "go.jetpack.io/devbox/internal/searcher"
|
@@ -113,23 +114,26 @@ func (d *Devbox) updateDevboxPackage(
|
113 | 114 | if err != nil {
|
114 | 115 | return err
|
115 | 116 | }
|
116 |
| - var needsSysInfo bool |
117 |
| - var needsLocalStorePath bool |
| 117 | + |
| 118 | + var sysInfo *lock.SystemInfo |
| 119 | + var caStorePath string |
118 | 120 | if featureflag.RemoveNixpkgs.Enabled() {
|
119 |
| - userSysInfo := d.lockfile.Packages[pkg.Raw].Systems[userSystem] |
120 |
| - needsSysInfo = userSysInfo == nil |
121 |
| - if !needsSysInfo { |
| 121 | + sysInfo = d.lockfile.Packages[pkg.Raw].Systems[userSystem] |
| 122 | + if sysInfo == nil { |
122 | 123 | // Check if the LocalStorePath is missing for the user's system.
|
123 |
| - // Since any one user cannot add this field for all systems, |
| 124 | + // Since any one user cannot add this field for all systems, |
124 | 125 | // we'll need to progressively add it to a project's lockfile.
|
125 |
| - needsLocalStorePath = userSysInfo.LocalStorePath == "" |
| 126 | + caStorePath = sysInfo.LocalStorePath |
126 | 127 | }
|
127 | 128 | }
|
128 |
| - if needsSysInfo { |
| 129 | + |
| 130 | + if sysInfo != nil { |
129 | 131 | d.lockfile.Packages[pkg.Raw] = newEntry
|
130 | 132 | ux.Finfo(d.writer, "Updated system information for %s\n", pkg)
|
131 | 133 | return nil
|
132 |
| - } else if needsLocalStorePath { |
| 134 | + } |
| 135 | + |
| 136 | + if caStorePath == "" { |
133 | 137 | // Update the LocalStorePath for the user's system
|
134 | 138 | d.lockfile.Packages[pkg.Raw].Systems[userSystem].LocalStorePath = newEntry.Systems[userSystem].LocalStorePath
|
135 | 139 | ux.Finfo(d.writer, "Updated system information for %s\n", pkg)
|
|
0 commit comments