Reads metadata for a Buildroot mainline package from a cached, extracted
BR tree. Used by mix nbpr.new so the scaffolded mix.exs and module
arrive pre-populated with version, licences, homepage, and a starter
description sourced from BR itself rather than left as # TODO stubs.
Inputs
br_tree— absolute path to an extracted BR tree (typically the one cached byNBPR.Buildroot.Source).name— Buildroot package name as it appears underpackage/<name>/, e.g."iperf3","dnsmasq","kernel-modules".
What's read
| Field | Source |
|---|---|
version | <NAME>_VERSION in <name>.mk |
licences | <NAME>_LICENSE in <name>.mk, comma-split, trimmed |
homepage | First https?:// URL in Config.in help block, else <NAME>_SITE |
description | First sentence of the Config.in help block, capitalised |
title | The bool "..." label in Config.in |
help | Raw help block (multi-paragraph) |
dependencies | Target-side BR deps: <NAME>_DEPENDENCIES ∪ select BR2_PACKAGE_* |
$(VAR) references in a scalar value (e.g. <NAME>_VERSION = $(<NAME>_VERSION_MAJOR).4) are resolved against assignments in the same
.mk. References to vars defined elsewhere (BR globals, $(call ...)
functions) are left literal; conditional definitions and computed sites
fall back to nil.
Dependency extraction
dependencies lists BR package directory names this package needs at
target-build time. It's the union of:
- The first literal
<NAME>_DEPENDENCIES = ...assignment in<name>.mk. Conditional_DEPENDENCIES += fooblocks (gated byifeq/kconfig) are deliberately ignored — they depend on user kconfig choices, not on intrinsic package wiring, and we have no way to evaluate them statically. - Every
select BR2_PACKAGE_<X>line inConfig.in, lowercased.
Filtered out:
host-*deps (build-host tools, never on the target rootfs).$(...)make-variable references (can't be resolved without a full BR config evaluation; e.g.$(TARGET_NLS_DEPENDENCIES)).- Duplicates across the two sources.
Summary
Functions
Reads metadata for name from the BR tree at br_tree.
Types
Functions
Reads metadata for name from the BR tree at br_tree.
Returns {:error, :package_not_found} when package/<name>/ is absent
(most likely a misspelt BR package name) and {:error, :mk_not_found}
when the package directory exists but lacks a <name>.mk (rare; usually
a virtual-package umbrella in BR). Missing _VERSION or _LICENSE keys
return {:error, {:missing_var, "<key>"}}.