Repository navigation
feat(toolchain): install the pinned ESP-IDF profile and describe its build environment - #1976
Merged
Merged
Conversation
…environment #1975 pinned the four ESP32-S3 tool components but could only prove one of them installed, and nothing turned an install into something a build could consume. This adds the profile-level half: - `EspIdfRelease` installs every component of an `IdfProfile` in pin order. - `IdfEnvironment` derives the PATH entries from the archives themselves (a component contributes its `bin/` or it does not) and emits `ESP_ROM_ELF_DIR` / `OPENOCD_SCRIPTS` only when the target directory exists. - `is_installed()` requires every component. - `installed_bytes()` measures the installed tree in `du` terms. That last point is a real bug found by the proof: summing each directory entry reported 1320 MB for a profile the merged constants describe as 1149 MB, because Espressif hardlinks the versioned toolchain binaries to the unversioned names (60 hardlinks in `xtensa-esp-elf` alone: naive 1262 MB vs `du -sb` 1103 MB). `du` counts each inode once, so the budget measurement now dedupes through `fbuild_core::platform::fs::file_identity` and a hardlink unit test pins it. Proven end to end (ignored test, run for real): all four pinned archives downloaded and sha256-verified (~192 MB), `xtensa-esp32-elf-gcc --version` prints `esp-14.2.0_20241119` from the installed tree, the profile measures 1149.2 MB (<= 1.3 GB, #1970 AC2), and a sentinel written into the tree survives a second install with an unchanged byte total (AC4, package level).
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
5 tasks
This was referenced Nov 10, 2026
This was referenced Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1975 (merged), part 2 of #1970.
#1975 pinned the four ESP32-S3 tool components as fbuild packages but could only
prove one of them installed, and nothing turned an install into something a
build could use. This PR adds the profile-level half: install the whole profile,
then describe the environment a delegated
idf.pybuild (#1971) has to hand thesubprocess.
What is new
crates/fbuild-toolchain/src/toolchain/esp_idf_release_profile.rsEspIdfRelease::new(project_dir, profile)— resolves every component of aprofile against the normal cache;
install()installs them in pin order andreturns an
IdfEnvironment.IdfEnvironment::path_dirs()— thebin/of every component that exports one.Decided by the archive, not by a hard-coded table:
esp-rom-elfsexportslinker data and no
bin/, so a future component can never be pinned and thensilently left off
PATH.IdfEnvironment::env_vars()— the two variables ESP-IDF's CMake layer readsinstead of
IDF_TOOLS_PATH:ESP_ROM_ELF_DIRandOPENOCD_SCRIPTS. Emittedonly when the target directory exists, so a profile without OpenOCD does not
export a path that points at nothing (CMake then blames the board script).
EspIdfRelease::is_installed()— all components, not any: three of fourtools is not a usable ESP-IDF.
EspIdfRelease::installed_bytes()— the real byte total of the installedtree, used for feat(toolchain): pin an ESP-IDF release as fbuild packages with an esp32s3-only install profile #1970's 1.3 GB acceptance criterion.
The measurement bug this exposed
The first version of
installed_bytes()summed every directory entry andreported 1320 MB — over the 1.3 GB budget, for a profile the merged #1975
constants describe as 1,149 MB. The difference is hardlinks: Espressif ships the
versioned toolchain binaries as hardlinks to the unversioned names (60 of them in
xtensa-esp-elfalone; naive sum 1,262 MB vsdu -sb1,103 MB for that onecomponent).
ducounts each inode once, so a budget measurement has to as well.dir_bytes()now dedupes throughfbuild_core::platform::fs::file_identity(the platform facade, so the rule holds on Windows) and a hardlink unit test
pins it. After the fix the same install measures 1149.2 MB, matching the
du -sbconstant already on main.Real proof (not a claim)
soldr cargo test -p fbuild-toolchain --lib -- --ignored esp_idf_s3_profile→ 1 passed, 56.5 s: all four pinned archives downloaded (≈192 MB), sha256
verified, extracted, and then:
xtensa-esp32-elf-gcc --versionprintsesp-14.2.0_20241119— the pinnedrelease, executed out of the installed tree;
esp32s3_rev0_rom.elfis present in theesp-rom-elfsroot;<= 1.3 GB, feat(toolchain): pin an ESP-IDF release as fbuild packages with an esp32s3-only install profile #1970 AC2);install(), and thebyte total is unchanged — no re-download, no re-extract (feat(toolchain): pin an ESP-IDF release as fbuild packages with an esp32s3-only install profile #1970 AC4, at the
package level).
12 unit tests pass (4 new: PATH derivation,
env_varsonly for realdirectories, a partial profile exporting nothing, and hardlink-aware byte
counting).
cargo fmt --checkclean, boundary44/43, test layout ok, dylintallowlists current.
Deliberately not here
"no
install.sh" criterion and the actual input to feat(espidf): opt-in delegating idf.py build producing <build>/idf/ artifacts #1971. The 1.4 GBesp-idf-v5.5.1.ziprelease asset turns out to embed a.gitdirectory, so itis not a usable package artifact; the honest pin is the recursive shallow
clone at
fcae3288(603 MB on disk, 152 MB of it.git), whose submoduleSHAs are part of the pinned commit's tree, or a submodule slice through the
existing
SubmodulePlanmachinery. That decision is the next PR; recordingmeasurements on feat(toolchain): pin an ESP-IDF release as fbuild packages with an esp32s3-only install profile #1970.
integration=idf-cmakeemission, no CMake, no caching (feat(espidf): false-coverage gate — integration=idf-cmake only with artifact proof #1972-perf(espidf): decide caching for delegated IDF builds (zccache launcher vs documented cold-only) #1974).