Skip to content

Commit

Permalink
[remove nixpkgs] bug fix: update only the user's sysInfo, rather than…
Browse files Browse the repository at this point in the history
… for all systems
  • Loading branch information
savil committed Jul 7, 2023
1 parent 5becdc1 commit 71b5744
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions internal/impl/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,27 @@ func (d *Devbox) updateDevboxPackage(
return err
}

// Check if the system info is missing for the user's system.
sysInfo := d.lockfile.Packages[pkg.Raw].Systems[userSystem]
if sysInfo == nil {
d.lockfile.Packages[pkg.Raw] = newEntry
ux.Finfo(d.writer, "Updated system information for %s\n", pkg)
return nil
}
// If the newEntry has a system info for the user's system,
// then check if we need to update system info
if newEntry.Systems[userSystem] != nil {

// Check if the system info is missing for the user's system.
sysInfo := d.lockfile.Packages[pkg.Raw].Systems[userSystem]
if sysInfo == nil {
d.lockfile.Packages[pkg.Raw].Systems[userSystem] = newEntry.Systems[userSystem]
ux.Finfo(d.writer, "Updated system information for %s\n", pkg)
return nil
}

// Check if the CAStorePath is missing for the user's system.
// Since any one user cannot add this field for all systems,
// we'll need to progressively add it to a project's lockfile.
if sysInfo.CAStorePath == "" {
// Update the CAStorePath for the user's system
d.lockfile.Packages[pkg.Raw].Systems[userSystem].CAStorePath = newEntry.Systems[userSystem].CAStorePath
ux.Finfo(d.writer, "Updated system information for %s\n", pkg)
return nil
// Check if the CAStorePath is missing for the user's system.
// Since any one user cannot add this field for all systems,
// we'll need to progressively add it to a project's lockfile.
if sysInfo.CAStorePath == "" {
// Update the CAStorePath for the user's system
d.lockfile.Packages[pkg.Raw].Systems[userSystem].CAStorePath = newEntry.Systems[userSystem].CAStorePath
ux.Finfo(d.writer, "Updated system information for %s\n", pkg)
return nil
}
}
}

Expand Down

0 comments on commit 71b5744

Please sign in to comment.