docs(deps): add a worked deps: example manifest, docs, and test

There was no committed emb.yaml with a deps: block. Add one and document
the schema.

- example/ivi-homescreen/emb.yaml: a self-describing package with a real
  deps: block (graphics build deps for fedora/ubuntu/macos) alongside a
  build: block.
- README: a 'Host dependencies (deps:)' section — the OS/distro schema,
  list-vs-map semantics, WhatProvides name resolution, the legacy
  configs/*.json schema, and an 'emb deps --packages example --dry-run'.
- test: load the committed example and assert deps resolve to the right
  packages per host (fedora/ubuntu/macos), excluding other hosts' names.

Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
This commit is contained in:
Joel Winarske
2026-06-18 15:34:39 -07:00
parent 56b946afc1
commit 109075fbe3
3 changed files with 115 additions and 0 deletions
+29
View File
@@ -342,6 +342,35 @@ deps: # optional host packages, by OS / distro
windows: [Kitware.CMake]
```
#### Host dependencies (`deps:`)
The `deps:` block declares host build packages, keyed by **OS**, then optionally
by **distro id** on Linux:
- A **list** directly under an OS (`macos: [...]`, `windows: [...]`, or
`linux: [...]`) applies to **any** distro on that OS.
- A **map** under `linux` (`fedora: [...]`, `ubuntu: [...]`, …) selects by the
host's distro id (from `/etc/os-release`, what `emb doctor` prints).
`emb deps` coalesces these across every selected manifest, filters to what's
**missing** on the current host, and installs the union in one transaction
(PackageKit on Linux, brew on macOS). Resolution is by package *name*, mapped to
the backend's real package via `WhatProvides`, so e.g. `pkg-config` resolves
even where the package is `pkgconf`.
A complete worked manifest (ivi-homescreen graphics deps for fedora/ubuntu/macOS)
is in [`example/ivi-homescreen/emb.yaml`](example/ivi-homescreen/emb.yaml).
Inspect the resolved/missing plan for your host without installing:
```sh
emb deps --packages example --dry-run
```
> Legacy `configs/*.json` declare deps differently — as inline
> `sudo … install` strings under `runtime.pre-requisites[arch][distro][version]`
> — from which `emb` extracts the package names. Both schemas normalize to the
> same per-host rule set.
---
### `emb cross`
+45
View File
@@ -0,0 +1,45 @@
# A self-describing package manifest. `emb build .` builds its arch x mode
# matrix; `emb deps --packages <parent-dir>` installs the host build deps below.
# See ../README.md and the top-level README "Host dependencies (deps:)".
id: ivi-homescreen
type: app
supported_archs: [arm64, x86_64]
supported_host_types: [fedora, ubuntu, darwin]
build:
app_path: .
archs: [arm64, x86_64]
modes: [release]
output: bundles
# Host build dependencies, keyed by OS then (on Linux) distro id. A list
# directly under an OS applies to any distro on that OS. `emb deps` coalesces
# these across all discovered packages, filters to what's missing on the host,
# and installs the union in one PackageKit (Linux) / brew (macOS) transaction.
deps:
linux:
fedora:
- pkg-config
- mesa-libEGL-devel
- mesa-libGLES-devel
- libdrm-devel
- mesa-libgbm-devel
- libinput-devel
- libxkbcommon-devel
- wayland-devel
- wayland-protocols-devel
- systemd-devel
ubuntu:
- pkg-config
- libegl-dev
- libgles2-mesa-dev
- libdrm-dev
- libgbm-dev
- libinput-dev
- libxkbcommon-dev
- libwayland-dev
- wayland-protocols
- libudev-dev
macos:
- pkg-config
- wayland
@@ -196,4 +196,45 @@ emb:
);
});
});
group('example/ivi-homescreen deps', () {
final dir = Directory(p.join('example', 'ivi-homescreen'));
const ubuntu = HostInfo(
os: HostOs.linux,
machineArch: 'x86_64',
archAliases: {'x86_64', 'x64', 'amd64'},
hostType: 'ubuntu',
versionId: '24.04',
);
const macos = HostInfo(
os: HostOs.macos,
machineArch: 'arm64',
archAliases: {'arm64'},
hostType: 'darwin',
versionId: '14',
);
test('the committed example manifest loads', () {
expect(dir.existsSync(), isTrue, reason: 'missing ${dir.path}');
final m = loader.loadPackageDir(dir);
expect(m, isNotNull);
expect(m!.id, 'ivi-homescreen');
});
test('deps resolve to the right packages per host', () {
final m = loader.loadPackageDir(dir)!;
final onFedora = m.deps.resolve(fedora);
expect(onFedora, containsAll(['pkg-config', 'mesa-libEGL-devel']));
expect(onFedora, isNot(contains('libegl-dev'))); // ubuntu-only name
final onUbuntu = m.deps.resolve(ubuntu);
expect(onUbuntu, containsAll(['pkg-config', 'libegl-dev']));
expect(onUbuntu, isNot(contains('mesa-libEGL-devel'))); // fedora-only
final onMac = m.deps.resolve(macos);
expect(onMac, containsAll(['pkg-config', 'wayland']));
expect(onMac, isNot(contains('libdrm-devel'))); // linux-only
});
});
}