Skip to content

Commit 81606cd

Browse files
committed
Ensure we resolve even uninstallable packages in lockfile; undo package.IsLegacy change
1 parent 1514597 commit 81606cd

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

internal/devpkg/package.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -416,13 +416,7 @@ func (p *Package) Versioned() string {
416416
}
417417

418418
func (p *Package) IsLegacy() bool {
419-
if !p.IsDevboxPackage() || p.isVersioned() {
420-
return false
421-
}
422-
if p.IsInstallable() {
423-
return false
424-
}
425-
return p.lockfile.Get(p.Raw).GetSource() == ""
419+
return p.IsDevboxPackage() && !p.isVersioned() && p.lockfile.Get(p.Raw).GetSource() == ""
426420
}
427421

428422
func (p *Package) LegacyToVersioned() string {
@@ -554,3 +548,12 @@ func (p *Package) StoreName() (string, error) {
554548
}
555549
return name, nil
556550
}
551+
552+
func (p *Package) EnsureUninstallableIsInLockfile() error {
553+
// TODO savil: Do we need the IsDevboxPackage check here?
554+
if !p.IsInstallable() || !p.IsDevboxPackage() {
555+
return nil
556+
}
557+
_, err := p.lockfile.Resolve(p.Raw)
558+
return err
559+
}

internal/impl/packages.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,17 @@ func (d *Devbox) ensurePackagesAreInstalled(ctx context.Context, mode installMod
235235
return err
236236
}
237237

238+
// Update lockfile with new packages that are not to be installed
239+
cfgPkgs, err := d.ConfigPackages()
240+
if err != nil {
241+
return err
242+
}
243+
for _, pkg := range cfgPkgs {
244+
if err := pkg.EnsureUninstallableIsInLockfile(); err != nil {
245+
return err
246+
}
247+
}
248+
238249
return d.lockfile.Save()
239250
}
240251

0 commit comments

Comments
 (0)