|
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"
|
@@ -115,22 +116,30 @@ func (d *Devbox) updateDevboxPackage(
|
115 | 116 | return err
|
116 | 117 | }
|
117 | 118 |
|
118 |
| - // Check if the system info is missing for the user's system. |
119 |
| - sysInfo := d.lockfile.Packages[pkg.Raw].Systems[userSystem] |
120 |
| - if sysInfo == nil { |
121 |
| - d.lockfile.Packages[pkg.Raw] = newEntry |
122 |
| - ux.Finfo(d.writer, "Updated system information for %s\n", pkg) |
123 |
| - return nil |
124 |
| - } |
| 119 | + // If the newEntry has a system info for the user's system, |
| 120 | + // then check if we need to update system info |
| 121 | + if newEntry.Systems[userSystem] != nil { |
| 122 | + |
| 123 | + // Check if the system info is missing for the user's system. |
| 124 | + sysInfo := d.lockfile.Packages[pkg.Raw].Systems[userSystem] |
| 125 | + if sysInfo == nil { |
| 126 | + if d.lockfile.Packages[pkg.Raw].Systems == nil { |
| 127 | + d.lockfile.Packages[pkg.Raw].Systems = map[string]*lock.SystemInfo{} |
| 128 | + } |
| 129 | + d.lockfile.Packages[pkg.Raw].Systems[userSystem] = newEntry.Systems[userSystem] |
| 130 | + ux.Finfo(d.writer, "Updated system information for %s\n", pkg) |
| 131 | + return nil |
| 132 | + } |
125 | 133 |
|
126 |
| - // Check if the CAStorePath is missing for the user's system. |
127 |
| - // Since any one user cannot add this field for all systems, |
128 |
| - // we'll need to progressively add it to a project's lockfile. |
129 |
| - if sysInfo.CAStorePath == "" { |
130 |
| - // Update the CAStorePath for the user's system |
131 |
| - d.lockfile.Packages[pkg.Raw].Systems[userSystem].CAStorePath = newEntry.Systems[userSystem].CAStorePath |
132 |
| - ux.Finfo(d.writer, "Updated system information for %s\n", pkg) |
133 |
| - return nil |
| 134 | + // Check if the CAStorePath is missing for the user's system. |
| 135 | + // Since any one user cannot add this field for all systems, |
| 136 | + // we'll need to progressively add it to a project's lockfile. |
| 137 | + if sysInfo.CAStorePath == "" { |
| 138 | + // Update the CAStorePath for the user's system |
| 139 | + d.lockfile.Packages[pkg.Raw].Systems[userSystem].CAStorePath = newEntry.Systems[userSystem].CAStorePath |
| 140 | + ux.Finfo(d.writer, "Updated system information for %s\n", pkg) |
| 141 | + return nil |
| 142 | + } |
134 | 143 | }
|
135 | 144 | }
|
136 | 145 |
|
|
0 commit comments