-
Notifications
You must be signed in to change notification settings - Fork 198
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
upgrader: Generate "computed" origin #2972
Conversation
941541b
to
cf5ae87
Compare
Pushed:
Ahhhh that was so confusing and tricky to debug. But, hooray again for the test suite! |
And here's where Rust's `&` vs `&mut` would have saved us in Rust-native code. Our translation code here was mutating the input, which broke things when trying to use it in the upgrader code. But because dealing with `&/&mut` with GLib would have been too hard, the GLib bindings accept `&` but still support mutating the underlying object. Further, we don't want to remove all the "transient" state here anyways. The history of ostree and origin files is tangled. We just want to drop `libostree-transient` (ostree should have an API for this). Or stated positively, we do want to translate the `override-commit`.
cf5ae87
to
a347b4d
Compare
Direction and code looks fine to me, however I disagree with this claim. This now has two members ( In this context, I would naively have expected |
@@ -73,6 +73,7 @@ struct RpmOstreeSysrootUpgrader { | |||
OstreeDeployment *cfg_merge_deployment; | |||
OstreeDeployment *origin_merge_deployment; | |||
RpmOstreeOrigin *origin; | |||
RpmOstreeOrigin *computed_origin; |
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'd be happier if we can keep only a single RpmOstreeOrigin *
in this scope (i.e. the computed one), see longer comment in the PR.
We replaced 3 previous variables with one though. Hmm. I can rename the other one to
I was alluding to the reason we can't do that in the commit message here:
The core problem is around the case where someone does e.g. What this logic in the upgrader is doing is emitting the warning around having the package in the base, and also drops out the request to install it (because at time t0 it is in the base). But that request needs to stay in the origin file so that we remember to start layering at time t1 later if needed. |
Yes, I fully agree with the direction of this (both for the reduction of variables, and for the explicit computed state). The concern is mainly around having two subtly-diverging entities available in the same scope. |
a347b4d
to
b41e421
Compare
This is is part of reducing internal complexity - in particular our "representations of state". The code here is basically printing a warning if a requested package is already in the base tree, and avoid passing that package down to the core. To accomplish this original code here was doing: origin -> (computed state) -> treespec Now that we dropped treespec in a recent PR, it's going: origin -> (computed state) -> treefile Instead of having anonymous (computed state) we can just make that a new (filtered) origin file. IOW we now do: origin -> origin -> treefile This is easier to understand and debug. Note how duplication around checking "requires local assembly" between the upgrader and origin code just drops out!
b41e421
to
42766c8
Compare
I don't see a way to get down to just one thing while preserving the current semantics. But very clearly some comments here were warranted 😄 I added a big one at the top, and also renamed the first variable to |
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.
LGTM! Approach makes a lot of sense to me. The ability to use e.g. rpmostree_origin_has_packages
on the computed origin is nice.
This stopped being used after coreos#2972.
This stopped being used after #2972.
This is is part of reducing internal complexity - in particular
our "representations of state". The code here is basically
printing a warning if a requested package is already in the base
tree, and avoid passing that package down to the core.
To accomplish this original code here was doing:
origin -> (computed state) -> treespec
Now that we dropped treespec in a recent PR, it's going:
origin -> (computed state) -> treefile
Instead of having anonymous (computed state) we can
just make that a new (filtered) origin file. IOW
we now do:
origin -> origin -> treefile
This is easier to understand and debug. Note
how duplication around checking "requires local
assembly" between the upgrader and origin code
just drops out!