-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Derivation building goal simplify -- no goto
#13905
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
Derivation building goal simplify -- no goto
#13905
Conversation
Do this with a new `useHook` boolean we carefully make sure is set in all cases. This change isn't really worthwhile by itself, but it allows us to make further refactors (see later commits) which are well-motivated.
This will make it easier to convert somethings to RAII.
It doesn't need to be a field any more, because we just use it with two loops.
We don't need to keep doing this every loop iteration, hook stuff it is only set above.
d7be7fb
to
c6ba120
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.
Pull Request Overview
This PR refactors the derivation building goal to simplify the control flow by eliminating the controversial goto
statement, consolidating the hook and local build paths into a single function flow.
- Inlines the
hookDone()
coroutine andstarted()
function into the maintryToBuild()
flow - Moves hook machine name tracking from the goal to the
HookInstance
struct - Converts the hook build path from a separate coroutine to inline logic with a loop structure
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/libstore/unix/include/nix/store/build/hook-instance.hh |
Adds documentation and machineName field to HookInstance struct |
src/libstore/include/nix/store/build/derivation-building-goal.hh |
Removes hook-related member variables and methods, moves constructor/destructor to public |
src/libstore/build/derivation-building-goal.cc |
Refactors tryToBuild() to inline hook logic, removes separate hookDone() coroutine |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Exactly why is is correct is a little subtle, because sometimes the worker is owned by the worker. But the commit message in e437b08 explained the situation well enough: I made that commit message part of the ABI docs, and now it should be understandable to the next person.
…`tryToBuild` Will help us make this a local variable.
Also inline `assertPathValidity` in the process.
5de69f7
to
a30bf96
Compare
Motivation
The first few commits of #13865 before the
goto
that would be controversial.Context
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.