@@ -25,7 +25,6 @@ import (
2525 "go.jetpack.io/devbox/internal/devpkg"
2626 "go.jetpack.io/devbox/internal/devpkg/pkgtype"
2727 "go.jetpack.io/devbox/internal/lock"
28- "go.jetpack.io/devbox/internal/searcher"
2928 "go.jetpack.io/devbox/internal/setup"
3029 "go.jetpack.io/devbox/internal/shellgen"
3130 "go.jetpack.io/devbox/internal/telemetry"
@@ -51,36 +50,25 @@ type UpdateVersion struct {
5150
5251// Outdated returns a map of package names to their available latest version.
5352func (d * Devbox ) Outdated (ctx context.Context ) (map [string ]UpdateVersion , error ) {
54- ctx , task := trace .NewTask (ctx , "devboxOutdated" )
55- defer task .End ()
56-
53+ lockfile := d .Lockfile ()
5754 outdatedPackages := map [string ]UpdateVersion {}
5855
5956 for _ , pkg := range d .AllPackages () {
60- if strings .HasSuffix (pkg .Versioned (), "latest" ) {
57+ // For non-devbox packages, like flakes or runx, we can skip for now
58+ if ! pkg .IsDevboxPackage {
6159 continue
6260 }
6361
64- result , err := searcher . Client (). Search ( ctx , pkg .CanonicalName ())
62+ lockPackage , err := lockfile . FetchResolvedPackage ( pkg .Versioned ())
6563 if err != nil {
66- return nil , err
64+ return nil , errors . Wrap ( err , "failed to fetch resolved package" )
6765 }
68-
69- for _ , p := range result .Packages {
70- if p .Name == pkg .CanonicalName () {
71- for _ , v := range p .Versions {
72- vv , err := pkg .ResolvedVersion ()
73- if err != nil {
74- return nil , err
75- }
76-
77- if v .Version > vv {
78- outdatedPackages [p .Name ] = UpdateVersion {Current : vv , Latest : v .Version }
79- break
80- }
81- }
82- }
66+ existingLockPackage := lockfile .Packages [pkg .Raw ]
67+ if lockPackage .Version == existingLockPackage .Version {
68+ continue
8369 }
70+
71+ outdatedPackages [pkg .Versioned ()] = UpdateVersion {Current : existingLockPackage .Version , Latest : lockPackage .Version }
8472 }
8573
8674 return outdatedPackages , nil
0 commit comments