Skip to content

Commit 9ec8286

Browse files
authored
[ls] return unresolved packages as a warning instead of an error (#2511)
## Summary Fixes #2510 Previously, `devbox ls --outdated` would error on packages that it could not resolve, like `stdenv.cc.cc.lib` or `darwin.apple_sdk.frameworks.IOKit`. This prevented devbox from checking if the rest of the packages were outdated. This PR changes the error to a warning, so the rest of the version checks can proceed ## How was it tested? 1. Create a devbox.json 2. Add standard packages using `devbox add` 3. Add `stdenv.cc.cc.lib` or `darwin.apple_sdk.frameworks.IOKit` to the project 4. Verify that `devbox ls --outdated` shows a warning for the non-versioned packages instead of an error.
1 parent 0e154db commit 9ec8286

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/devbox/packages.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type UpdateVersion struct {
5252
func (d *Devbox) Outdated(ctx context.Context) (map[string]UpdateVersion, error) {
5353
lockfile := d.Lockfile()
5454
outdatedPackages := map[string]UpdateVersion{}
55+
var warnings []string
5556

5657
for _, pkg := range d.AllPackages() {
5758
// For non-devbox packages, like flakes, we can skip for now
@@ -61,7 +62,8 @@ func (d *Devbox) Outdated(ctx context.Context) (map[string]UpdateVersion, error)
6162

6263
lockPackage, err := lockfile.FetchResolvedPackage(pkg.Versioned())
6364
if err != nil {
64-
return nil, errors.Wrap(err, "failed to fetch resolved package")
65+
warnings = append(warnings, fmt.Sprintf("Note: unable to check updates for %s", pkg.CanonicalName()))
66+
continue
6567
}
6668
existingLockPackage := lockfile.Packages[pkg.Raw]
6769
if lockPackage.Version == existingLockPackage.Version {
@@ -71,6 +73,10 @@ func (d *Devbox) Outdated(ctx context.Context) (map[string]UpdateVersion, error)
7173
outdatedPackages[pkg.Versioned()] = UpdateVersion{Current: existingLockPackage.Version, Latest: lockPackage.Version}
7274
}
7375

76+
for _, warning := range warnings {
77+
fmt.Fprintf(d.stderr, "%s\n", warning)
78+
}
79+
7480
return outdatedPackages, nil
7581
}
7682

0 commit comments

Comments
 (0)