Skip to content

Commit 587359d

Browse files
committed
lucille: rewrite for clarity
1 parent a735e64 commit 587359d

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

internal/impl/update.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
"go.jetpack.io/devbox/internal/boxcli/featureflag"
1111
"go.jetpack.io/devbox/internal/devpkg"
12+
"go.jetpack.io/devbox/internal/lock"
1213
"go.jetpack.io/devbox/internal/nix"
1314
"go.jetpack.io/devbox/internal/nix/nixprofile"
1415
"go.jetpack.io/devbox/internal/searcher"
@@ -113,23 +114,26 @@ func (d *Devbox) updateDevboxPackage(
113114
if err != nil {
114115
return err
115116
}
116-
var needsSysInfo bool
117-
var needsLocalStorePath bool
117+
118+
var sysInfo *lock.SystemInfo
119+
var caStorePath string
118120
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 {
122123
// 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,
124125
// we'll need to progressively add it to a project's lockfile.
125-
needsLocalStorePath = userSysInfo.LocalStorePath == ""
126+
caStorePath = sysInfo.LocalStorePath
126127
}
127128
}
128-
if needsSysInfo {
129+
130+
if sysInfo != nil {
129131
d.lockfile.Packages[pkg.Raw] = newEntry
130132
ux.Finfo(d.writer, "Updated system information for %s\n", pkg)
131133
return nil
132-
} else if needsLocalStorePath {
134+
}
135+
136+
if caStorePath == "" {
133137
// Update the LocalStorePath for the user's system
134138
d.lockfile.Packages[pkg.Raw].Systems[userSystem].LocalStorePath = newEntry.Systems[userSystem].LocalStorePath
135139
ux.Finfo(d.writer, "Updated system information for %s\n", pkg)

0 commit comments

Comments
 (0)