-
Notifications
You must be signed in to change notification settings - Fork 9
Remove v0::Opt from the Package/Recipe Traits #563
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
Codecov Report
@@ Coverage Diff @@
## main #563 +/- ##
==========================================
+ Coverage 53.93% 53.99% +0.06%
==========================================
Files 248 248
Lines 19102 19241 +139
==========================================
+ Hits 10302 10389 +87
- Misses 8800 8852 +52
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
I have found a way to maintain the old behavior and not need to error on missing requirements for either v1 or v0 (largely thanks to the fact that #594 negates the need to inject downstream build requirements) I should be able to backport it to this branch in the future |
db5bceb to
3043738
Compare
741933c to
f4ee76d
Compare
|
This one needs a rebase. |
658caf7 to
e59695f
Compare
|
Thanks, rebased just now |
e59695f to
4173e28
Compare
f84f53e to
07942f4
Compare
| let renderer = Some(std::thread::spawn(move || { | ||
| if let Err(err) = bars.join() { | ||
| tracing::error!("Failed to render commit progress: {err}"); | ||
| tracing::error!("Failed to render commit progress: {}", 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.
this was causing errors for me in cargo 1.68 and seems harmless while we finish updating everything else internally
| )); | ||
| } | ||
| if self.pin || other.pin { | ||
| // we cannot consider an unpinned request to contain any |
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.
pin == true is "unpinned"?
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.
ya this seems to just be a typo
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.
Actually, no - they are unpinned because the request is set as needing to be pinned still - but I'll clarify the comment
| if !value.is_empty() { | ||
| f.write_char('/')?; | ||
| value.fmt(f)?; | ||
| } else if *pin { | ||
| f.write_str("/<fromBuildEnv>")?; | ||
| } |
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.
Should VarRequest::pin and VarRequest::value be combined into an enum (mutually exclusive)?
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.
possibly, but I think that would greatly increase the size of this PR
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.
I am going to give this a try, actually, as it might reduce some of the ambiguity you noted earlier. I'll give up if it get's too involved, though...
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.
Okay, I added a separate commit that introduces an enum for this. I made the VarRequest generic over this type thinking that we could have an instance of it for packages that can only ever have a string value and no pin (since only recipes can pin during build) but it started getting too involved and I left it as-is which is still a bit of an improvement for rusty-ness
| return ours.contains(theirs); | ||
| } | ||
| (Request::Var(ours), Request::Var(theirs)) => { | ||
| return ours.contains(theirs); |
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.
The return here means it will give up on the first thing it checks, compatible or incompatible. That doesn't seem right. Shouldn't this be looking to see if any element in self.iter() is compatible?
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.
The requirements list is not supposed to allow multiple requests with the same name. I'll add a comment and also button up the FromIterator implementations that break this invariant.
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.
Turns out we had some bugs-incognito here, but I've buttoned up the RequirementsList type and tried to make the interaction methods clearer.
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.
What I'm still confused about is if self is something like:
- var: a/1.0.0
- var: b/1.0.0
- var: c/1.0.0
and theirs is var: b/1.0.0, won't this return incompatible when comparing the first element a/1.0.0 <> b/1.0.0?
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.
I see what you are saying now, ya it looks like there are some additional checks for the name here
07942f4 to
541c7bd
Compare
| #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] | ||
| pub enum PinnableValue { | ||
| FromBuildEnv, | ||
| Pinned(String), |
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.
| Pinned(String), | |
| Pinned(Arc<str>), |
Don't need mutability here.
I saw https://youtu.be/A4cKi7PTJSs last night and I think it could help this project conserve memory and maybe improve performance. I'm interested in trying out this kind of change in a few areas, like for PkgNameBuf. A combination of this change and some kind of string interning mechanism for common strings like package names.
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.
Interesting video, definitely could be super beneficial to the name bufs - I'll take a stab at the change here
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.
FYI #766.
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.
A lot of missing coverage in this file.
| return ours.contains(theirs); | ||
| } | ||
| (Request::Var(ours), Request::Var(theirs)) => { | ||
| return ours.contains(theirs); |
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.
What I'm still confused about is if self is something like:
- var: a/1.0.0
- var: b/1.0.0
- var: c/1.0.0
and theirs is var: b/1.0.0, won't this return incompatible when comparing the first element a/1.0.0 <> b/1.0.0?
| /// Requirements lists cannot contain multiple requests with the | ||
| /// same name, requiring instead that they be combined into a single | ||
| /// request as needed. |
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.
Anecdotally, we have some packages published that have multiple install requirements specified for the same package. This generates a warning when the solver walks over them. We've deprecated the packages to in theory make the solver not consider them, but the solver still has to read the packages to find out they are deprecated... which generates the warning.
This changes the current inheritance mechanism from being calculated based on the specific v0::Opt::inheritance field, instead expecting the package itself to identify downstream requests that need to be present. Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
The VarRequest had a pin field used to denote when fromBuildEnv was given and this field was mutually exclusive to a provided value. An enum works better in this case. Ideally, the package would not allow this field to be pinned, only the recipe. For now, I have not made that change only this first one to introduce an enum. Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
fdc3eea to
7c08bd3
Compare
Signed-off-by: Ryan Bottriell <rbottriell@ilm.com>
7c08bd3 to
d07e319
Compare
This changes the current inheritance mechanism from being calculated based on the specific
Opt::inheritancefield, instead expecting the package itself to identify downstream requests that need to be present.