-
Notifications
You must be signed in to change notification settings - Fork 249
devbox add fallthrough and fallback for packages not handled by search #1264
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
Conversation
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.
This is a great and simple start, but I think there a few issues we may need to solve before we merge (or ship?)
- Adding fall-through package causes the warning
Warning: Your devbox.json contains packages in legacy format. Please run devbox update to update your devbox.json.
to be shown on subsequent commands. - Running
devbox update
will add@latest
to the packages indevbox.json
which will cause them to fail on the next run/shell. (Adding@latest
was our upgrade path for old configs)
Possible solution:
- Add "source" field to lock file packages. Source can be devbox-search, nixpkgs. etc. Only show legacy warning is source if unknown and package is in legacy format.
- When doing
devbox update
don't update stuff with nixpkgs source. If lockfile/source is missing then check if package exists in search before appending the@latest
.
50b7687
to
6c60238
Compare
6c60238
to
fca5809
Compare
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.
Nice! This is super clean
@@ -403,7 +403,7 @@ func (p *Package) Versioned() string { | |||
} | |||
|
|||
func (p *Package) IsLegacy() bool { | |||
return p.isDevboxPackage() && !p.isVersioned() | |||
return p.isDevboxPackage() && !p.isVersioned() && p.lockfile.Source(p.Raw) == "" |
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.
Another possible API could be
p.lockfile.Get(p.Raw).Source()
to have lock packages themselves respond to source()
(and just default Source() to be empty string if not set or if package is nil)
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.
Oh I like p.lockfile.Get(p.Raw).Source()
better. I'll follow up with a separate PR
## Summary Update lockfile api for package source as suggested in #1264 (comment) ## How was it tested? devbox run build devbox update
…1463) ## Summary Restores functionality implemented by #1264 and refactored in #1279 which was accidentally broken by #1437 tldr: the `FillNarInfoCache` function breaks if packages are not in search, but we support non-search packages via fallback (.e.g. stdenv.cc.cc.lib) I'm keeping surface area as small as possible, but as a follow up I think we can remove the `devpkg.FillNarInfoCache` calls from `impl.Add` if we simply ignore the`IsInBinaryCache` errors in [ValidateExists](https://github.com/jetpack-io/devbox/blob/main/internal/devpkg/validation.go#L10-L26) or remove `IsInBinaryCache` from that function completely (I'm not convinced it is needed, @savil @ipince correct me if I'm wrong) ## How was it tested? `devbox add stdenv.cc.cc.lib`
Summary
devbox add
fallthrough and fallback for packages not handled by search.This PR does not do the following:
nixpkg
commit field indevbox.json
immediately?)I'd like to address those two things above if needed in a separate PR as a follow up.
Example lockfile:
How was it tested?
In the Tensorflow example: