NBPR.Buildroot.Builder (NBPR v0.2.0)

Copy Markdown View Source

Source-builds an NBPR package artefact tarball end-to-end.

Driven from both Mix.Tasks.Nbpr.Build (CLI) and Mix.Tasks.Nbpr.Fetch's fallback path (when no prebuilt artefact is published for the active (system, system_version, build_opts) tuple).

Pipeline:

  1. Discover deps/nerves_system_br/ and read the pinned BR version.
  2. Ensure the patched BR source tree at $NERVES_DATA_DIR/nbpr/buildroot/<version>/.
  3. Render a defconfig that layers the package + its build_opts on top of the active system's nerves_defconfig.
  4. Run BR (<pkg>-dirclean && <pkg>) against a stable per-(system, BR-version) output dir, in Docker on non-Linux hosts.
  5. Filter per-package output via BR's files-list (runtime-only).
  6. Pack into the canonical artefact tarball at output_dir/.

Returns the absolute path to the produced tarball.

Summary

Functions

Builds the artefact for pkg against inputs.system_app/system_version, with inputs.build_opts applied. Writes the tarball into output_dir and returns its absolute path.

Returns the stable per-(system, BR-version) BR output dir. Reusing across builds keeps the toolchain extraction, host-skeleton, and unchanged packages cached; make olddefconfig reconciles defconfig drift.

Functions

build!(pkg, inputs, output_dir)

Builds the artefact for pkg against inputs.system_app/system_version, with inputs.build_opts applied. Writes the tarball into output_dir and returns its absolute path.

inputs is the standard NBPR.Artifact.build_inputs/0 map (the same one used for cache-key/manifest computation in the fetch path).

stable_output_dir(system_app, br_version)

@spec stable_output_dir(atom(), String.t()) :: Path.t()

Returns the stable per-(system, BR-version) BR output dir. Reusing across builds keeps the toolchain extraction, host-skeleton, and unchanged packages cached; make olddefconfig reconciles defconfig drift.