Commit b8e3f29
refactor(bootstrapper): convert recursive bootstrap to iterative processing
Replace the recursive DFS in Bootstrapper.bootstrap() with an explicit
LIFO stack and a six-phase state machine (START, PREPARE_SOURCE,
PREPARE_BUILD, BUILD, PROCESS_INSTALL_DEPS, COMPLETE). This eliminates
Python stack overflow on deep/wide dependency graphs, especially with
--multiple-versions enabled.
Key changes:
- Add BootstrapPhase enum and WorkItem dataclass for phase-based processing
- Add six phase handler methods that replace the monolithic _bootstrap_impl
- Rewrite bootstrap() to use an iterative DFS loop with explicit work stack
- Remove _bootstrap_single_version, _bootstrap_impl, _build_from_source
- Preserve all three error handling modes (normal, test, multiple-versions)
- Keep _prepare_build_dependencies for git URL resolution path only
- Update tests to match new internal structure
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Rohan Devasthale <rdevasth@redhat.com>1 parent 1429c1a commit b8e3f29
2 files changed
Lines changed: 578 additions & 363 deletions
0 commit comments