NBPR.Package (NBPR v0.4.2)

Copy Markdown View Source

Metadata struct describing an NBPR package.

Returned by the generated __nbpr_package__/0 callback on every module that does use NBPR.BrPackage. The struct is the canonical introspection surface for the curated CI, the build runner, and any future tooling.

Summary

Types

The C library a Nerves system's toolchain targets. Nerves systems are overwhelmingly glibc; x86_64 is the musl one.

t()

Functions

The Buildroot package name, for a mainline package or a vendored one.

The absolute path of a vendored package's Buildroot external tree.

Whether this package brings its own Buildroot tree.

Types

artifact_site()

@type artifact_site() ::
  {:github_releases, String.t()} | {:ghcr, String.t()} | {:oci, String.t()}

libc()

@type libc() :: :gnu | :musl

The C library a Nerves system's toolchain targets. Nerves systems are overwhelmingly glibc; x86_64 is the musl one.

t()

@type t() :: %NBPR.Package{
  artifact_sites: [artifact_site()],
  br_external_path: String.t() | nil,
  br_package: String.t() | nil,
  build_opt_extensions: %{required(atom()) => map()},
  build_opts: keyword(),
  daemons: [NBPR.Package.Daemon.t()],
  description: String.t(),
  homepage: String.t() | nil,
  kernel_modules: [String.t()],
  module: module(),
  name: atom(),
  runtime_env: [{String.t(), String.t()}],
  unsupported_libc: [libc()],
  version: pos_integer()
}

Functions

br_name(package)

@spec br_name(t()) :: String.t()

The Buildroot package name, for a mainline package or a vendored one.

A mainline package names it, because the name that Buildroot knows and the name that Hex knows are not always the same: bluez-alsa is nbpr_bluez_alsa here, and Hex takes no hyphen. A vendored package is named by its own NBPR name, because the external tree is ours and the two names have no reason to differ.

iex> NBPR.Package.br_name(%NBPR.Package{name: :bluez_alsa, br_package: "bluez-alsa"})
"bluez-alsa"

iex> NBPR.Package.br_name(%NBPR.Package{name: :librespot, br_external_path: "buildroot"})
"librespot"

external_tree(package)

@spec external_tree(t()) :: Path.t() | nil

The absolute path of a vendored package's Buildroot external tree.

br_external_path is relative to the package's priv directory. A Hex package ships priv, so the tree travels with the package and it is there at build time whether the package came from Hex or from the workspace.

It returns nil for a mainline package.

vendored?(package)

@spec vendored?(t()) :: boolean()

Whether this package brings its own Buildroot tree.