NBPR.Pack (NBPR v0.2.1)

Copy Markdown View Source

Produces a canonical NBPR artefact tarball from a directory of built files.

Given the build inputs (package, version, system, system-version, build-opts) plus paths to one or more of target/, staging/, legal-info/, and rootfs/ source directories, this module assembles them into a single top-level directory matching NBPR.Artifact.dir_name/1, drops a manifest.json next to them, and tarballs into a file named per NBPR.Artifact.tarball_name/1.

The four sources are routed differently at install time:

  • target/ → installed into the package's priv/ (binaries, libraries, package-specific configs)
  • staging/ → installed into the build sysroot for NIF cross-compilation (currently unused by the installer)
  • rootfs/ → installed into Nerves' build_rootfs_overlay so the files end up at standard rootfs paths in the firmware (kernel modules, daemons that hardcode /etc/foo.conf, etc.)
  • legal-info/ → licence aggregation

Pure I/O on the local filesystem; no network, no Buildroot. Source-build drivers (eventual mix nbpr.build and friends) call into this once they have a directory of installed files.

Summary

Functions

Builds the canonical tarball for inputs, drawing files from sources.

Types

sources()

@type sources() :: %{
  optional(:target) => Path.t(),
  optional(:staging) => Path.t(),
  optional(:rootfs) => Path.t(),
  optional(:legal_info) => Path.t()
}

Functions

pack!(inputs, sources, output_dir)

@spec pack!(NBPR.Artifact.build_inputs(), sources(), Path.t()) :: Path.t()

Builds the canonical tarball for inputs, drawing files from sources.

Returns the absolute path to the produced tarball.