Skip to content

Commit

Permalink
Ensure we resolve even uninstallable packages in lockfile; undo packa…
Browse files Browse the repository at this point in the history
…ge.IsLegacy change
  • Loading branch information
savil committed Aug 10, 2023
1 parent 1514597 commit 81606cd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
17 changes: 10 additions & 7 deletions internal/devpkg/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,13 +416,7 @@ func (p *Package) Versioned() string {
}

func (p *Package) IsLegacy() bool {
if !p.IsDevboxPackage() || p.isVersioned() {
return false
}
if p.IsInstallable() {
return false
}
return p.lockfile.Get(p.Raw).GetSource() == ""
return p.IsDevboxPackage() && !p.isVersioned() && p.lockfile.Get(p.Raw).GetSource() == ""
}

func (p *Package) LegacyToVersioned() string {
Expand Down Expand Up @@ -554,3 +548,12 @@ func (p *Package) StoreName() (string, error) {
}
return name, nil
}

func (p *Package) EnsureUninstallableIsInLockfile() error {
// TODO savil: Do we need the IsDevboxPackage check here?
if !p.IsInstallable() || !p.IsDevboxPackage() {
return nil
}
_, err := p.lockfile.Resolve(p.Raw)
return err
}
11 changes: 11 additions & 0 deletions internal/impl/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,17 @@ func (d *Devbox) ensurePackagesAreInstalled(ctx context.Context, mode installMod
return err
}

// Update lockfile with new packages that are not to be installed
cfgPkgs, err := d.ConfigPackages()
if err != nil {
return err
}
for _, pkg := range cfgPkgs {
if err := pkg.EnsureUninstallableIsInLockfile(); err != nil {
return err
}
}

return d.lockfile.Save()
}

Expand Down

0 comments on commit 81606cd

Please sign in to comment.