Skip to content

feat(fqbn): install a vendor package and its tools from a package index (#1298) - #2234

Merged
zackees merged 1 commit into
mainfrom
agent/1298-package-install
Dec 1, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/1298-package-install

Conversation

@zackees

@zackees zackees commented Dec 1, 2026

Copy link
Copy Markdown
Member

What this delivers

Cell 3 of #1298: the FQBN path could resolve an installed vendor core but not
install one, so the motivating Seeeduino:mbed:xiaonRF52840Plus repro still
needed arduino-cli core install first. This adds the install as a separate,
explicit verb:

fbuild fqbn <FQBN> --install --package-index <package_<vendor>_index.json> \
    [--version V] [--arduino-data-dir DIR] [--json]

The plan (one line per archive) goes to stderr before the first fetch; the
report (target=… state=installed|reused destination=… bytes=…) goes to stdout.

Design (record updated: docs/design/fqbn-resolution.md §Follow-up 3)

  • Trust root = the index file the caller names. Nothing searches for one
    and there is no default URL, because installing from an index is code
    execution. Every archive is matched against that file's SHA-256 and size,
    so the transport is not the identity: http and https are both accepted
    (measured — the published Seeeduino index serves openocd and mkspiffs over
    plain http, so an https-only rule made the package uninstallable), any other
    scheme is refused by name, MD5 is refused by name, a digest that is not 64
    hex characters is refused, and a missing size is refused.
  • Verify before extract: size, then SHA-256, then unpack through the
    existing extractor (hostile-tar + long-path guards) into a staging dir
    inside the data dir, renamed into place only after validation. A package must
    carry boards.txt + platform.txt; a tool must be non-empty; a single
    top-level wrapper directory is flattened (gcc-arm-none-eabi-7-2017-q4-major/).
  • Data dir is the cache: both targets land in the canonical
    packages/<vendor>/hardware/<arch>/<version> and
    packages/<packager>/tools/<name>/<version> layout, so the resolver and the
    toolchain mapping (cells 1–2b) read them with no migration. An installed
    target is reused with zero requests.
  • Published indexes carry junk. The real Seeeduino index has a platform
    object inside a tools array (no host); a strict parse rejected the whole
    file and made every other package in it unusable. Every model field is
    optional, so an unrelated malformed entry never matches a selection.

Deliberately not done, and said so in the record: no post-install hook
execution (recipe.hooks.* is recipe evaluation, follow-up 4), no index
discovery / "latest" tracking, and no download of any kind during a build.

Real end-to-end evidence

Against the published index (290,172 B) on this host:

target=Seeeduino:[email protected] state=installed bytes=34722259
target=Seeeduino:[email protected] state=installed bytes=2052080
target=Seeeduino:arm-none-eabi-gcc@7-2017q4 state=installed bytes=99857645
target=Seeeduino:[email protected] state=installed bytes=399532
target=Seeeduino:[email protected] state=installed bytes=77184
  • Second run: all five state=reused bytes=0, no network.
  • fbuild fqbn Seeeduino:mbed:xiaonRF52840Plus --arduino-data-dir ./data on the
    freshly installed tree: toolchain=arm-none-eabi-gcc@7-2017q4,
    compiler=…/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-gcc.
  • That compiler built an ELF32 object with the board's own
    -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16; --version =
    7.2.1 20170904.

Gates (real output)

  • fqbn_install 19/19; -p fbuild-build-engine --lib fqbn 51 passed, 0 failed.
  • -p fbuild-cli --bin fbuild fqbn 22 passed, 0 failed (4 new: flag parse,
    --install without an index refused by clap, missing index named, report
    rendering).
  • clippy -p fbuild-build-engine -p fbuild-cli --all-targets -- -D warnings:
    0 errors/warnings; cargo fmt --all -- --check clean; platform boundary
    rows=0; dylint_rows=0.
  • RED proven twice: with verification disabled 2 failed (corrupt archive,
    size mismatch), with reuse disabled 1 failed (the reuse test); restored, 19/19.

Refs #1298 (stays open — the build-side --fqbn wiring and recipe evaluation are
still follow-ups).

…ex (#1298)

Cell 3 of the FQBN work: resolution read only packages an Arduino tool had
already installed, so the motivating Seeeduino:mbed core still needed
`arduino-cli core install` first. `fbuild fqbn <FQBN> --install
--package-index <file>` now installs the package and every tool it depends on.

- Trust root is the caller-supplied index file: no search, no default URL.
  Every archive is matched against that file's SHA-256 and size, so transport
  is not the identity. Measured: the published Seeeduino index serves openocd
  and mkspiffs over plain http, so https-only made the package uninstallable;
  http/https are accepted, any other scheme is refused by name. MD5 or a
  non-64-hex digest is refused, as is a missing size.
- Verification happens before extraction (size, then SHA-256), into a staging
  dir inside the data dir, renamed into place after validation: a package must
  carry boards.txt + platform.txt, a tool must be non-empty, and a single
  top-level wrapper directory is flattened.
- Offline reuse: an installed target is skipped with zero requests.
- Published indexes carry junk (a platform object inside the Seeed `tools`
  array); every model field is optional so an unrelated malformed entry cannot
  make the whole index unusable.
- No post-install hook execution, no index discovery, and no download during a
  build.

Tests: fqbn_install 19 (engine fqbn* 51), CLI fqbn 22 (4 new); RED proven
twice (verification disabled -> 2 failed; reuse disabled -> 1 failed).

Refs #1298 (stays open).
@zackees
zackees added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 74674b1 Dec 1, 2026
44 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant