-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[sandboxes] devbox ls: print versions #2277
Conversation
// Continue to print the package even if we can't resolve the version | ||
// so that the user can see the error for this package, as well as get the | ||
// results for the other packages | ||
resolvedVersion = "<error resolving version>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe omit the version from the list and print it on stderr at the end?
if err := p.resolve(); err != nil { | ||
return "", err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If package is not in lockfile this is just current resolved version, but that's probably ok.
@@ -848,6 +848,11 @@ func (d *Devbox) AllPackageNamesIncludingRemovedTriggerPackages() []string { | |||
return result | |||
} | |||
|
|||
func (d *Devbox) AllPackagesIncludingRemovedTriggerPackages() []*devpkg.Package { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change AllPackageNamesIncludingRemovedTriggerPackages
to use this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There's a small subtle difference that I think is okay in practice, but let me call it out.
- In
AllPackageNamesIncludingRemovedTriggerPackages
, thep.VersionedName()
will append the Version if it exists - In devpkg's Package.Versioned(), if the version is missing we'll append
@latest
I think this doesn't matter in practice, because we always append @latest
during devbox add <name>
.
|
||
// Print the resolved version, unless the user has specified a version already | ||
if strings.HasSuffix(pkg.Versioned(), "latest") && resolvedVersion != "" { | ||
// Runx packages have a "v" prefix (why?). Trim for consistency. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically semver has (or can have?) a prefix v
@savil Is this ready to be merged? |
8373b7f
to
642058b
Compare
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
## Summary Fixes issue introduced in #2277 This comment explains it pretty well: https://github.com/jetify-com/devbox/pull/2277/files#r1767085866 except: > I think this doesn't matter in practice, because we always append @latest during devbox add <name>. This is not 100% true. In the very small number of packages that are not in nixhub but are valid attribute paths, (e.g. `stdenv.cc.cc.lib`) we store the key in the lockfile without `@latest` :(. The key missmatch caused lockfile.Tidy to remove entries. My bad for making the suggestion that lead to this, this was really subtle difference. ## How was it tested? Added `stdenv.cc.cc.lib` on devbox.json linux only, installed on linux and copied over lockfile to macos. Did `devbox install` and ensured lockfile was not modified.
Summary
For packages without an explicit version, this PR will print the version for
the user in
devbox ls
.Fixes #2274
How was it tested?
Notice that versions are printed for go@latest and the runx packages, but
not for cowsay since it was added via
devbox add [email protected]
Also,
devbox ls -c examples/flakes/php
anddevbox ls -c examples/flakes/remote