@@ -109,31 +109,30 @@ func (d *Devbox) updateDevboxPackage(
109
109
}
110
110
111
111
// Check if the package's system info is missing, or not complete.
112
- userSystem , err := nix .System ()
113
- if err != nil {
114
- return err
115
- }
116
- var needsSysInfo bool
117
- var needsLocalStorePath bool
118
112
if featureflag .RemoveNixpkgs .Enabled () {
119
- userSysInfo := d .lockfile .Packages [pkg .Raw ].Systems [userSystem ]
120
- needsSysInfo = userSysInfo == nil
121
- if ! needsSysInfo {
113
+ userSystem , err := nix .System ()
114
+ if err != nil {
115
+ return err
116
+ }
117
+ var caStorePath string
118
+ sysInfo := d .lockfile .Packages [pkg .Raw ].Systems [userSystem ]
119
+ if sysInfo != nil {
122
120
// Check if the LocalStorePath is missing for the user's system.
123
- // Since any one user cannot add this field for all systems,
121
+ // Since any one user cannot add this field for all systems,
124
122
// we'll need to progressively add it to a project's lockfile.
125
- needsLocalStorePath = userSysInfo .LocalStorePath == ""
123
+ caStorePath = sysInfo .LocalStorePath
124
+ }
125
+
126
+ if sysInfo == nil {
127
+ d .lockfile .Packages [pkg .Raw ] = newEntry
128
+ ux .Finfo (d .writer , "Updated system information for %s\n " , pkg )
129
+ return nil
130
+ } else if caStorePath == "" {
131
+ // Update the LocalStorePath for the user's system
132
+ d .lockfile .Packages [pkg .Raw ].Systems [userSystem ].LocalStorePath = newEntry .Systems [userSystem ].LocalStorePath
133
+ ux .Finfo (d .writer , "Updated system information for %s\n " , pkg )
134
+ return nil
126
135
}
127
- }
128
- if needsSysInfo {
129
- d .lockfile .Packages [pkg .Raw ] = newEntry
130
- ux .Finfo (d .writer , "Updated system information for %s\n " , pkg )
131
- return nil
132
- } else if needsLocalStorePath {
133
- // Update the LocalStorePath for the user's system
134
- d .lockfile .Packages [pkg .Raw ].Systems [userSystem ].LocalStorePath = newEntry .Systems [userSystem ].LocalStorePath
135
- ux .Finfo (d .writer , "Updated system information for %s\n " , pkg )
136
- return nil
137
136
}
138
137
139
138
ux .Finfo (d .writer , "Already up-to-date %s %s\n " , pkg , existing .Version )
0 commit comments