211 lines
11 KiB
Markdown
211 lines
11 KiB
Markdown
---
|
||
title: Installers, Provenance and Publishing
|
||
description: Stage install trees, produce eight installer formats, sign and attest products, and publish releases and binary variants
|
||
section: Shipping & Publishing
|
||
badge: install + registry
|
||
order: 1
|
||
tags: [install, packaging, tar, zip, deb, rpm, wix, dmg, nuget, sbom, signing, registry, publish]
|
||
updated: 2026-12-06
|
||
---
|
||
|
||
# Installers, Provenance and Publishing
|
||
|
||
VBS covers the path from a built profile to a verifiable release: staged installs with an ownership manifest, relocatable CMake and native exports, deterministic installer archives, SPDX/CycloneDX SBOMs, Ed25519 signatures, and source or binary publication to a registry.
|
||
|
||
## Install a prefix
|
||
|
||
```cpp
|
||
auto app = project.executable("app");
|
||
app.sources({"src/main.cpp"}).link(core).install("bin");
|
||
|
||
auto core = project.static_library("core");
|
||
core.sources(project.glob("src/core/**/*.cpp"))
|
||
.include_directory("include", Void::Build::Visibility::Public)
|
||
.install("lib");
|
||
|
||
project.install_directory("include", "include");
|
||
project.install_file("LICENSE", "share/doc/app/LICENSE", "docs");
|
||
```
|
||
|
||
```sh
|
||
vbs install --prefix dist/prefix --package-name app --package-version 1.2.3
|
||
```
|
||
|
||
`vbs install` builds with the selected profile and resolves dependencies online; it has no `--locked`, `--offline` or `--native-foreign` flag in 1.0.0. Only targets with an install rule and explicitly declared files are installed. An empty destination uses the default for the kind (executables to `bin`, libraries to `lib`). Headers are not installed automatically; declare `install_directory("include", "include")`.
|
||
|
||
The resulting prefix contains:
|
||
|
||
```text
|
||
prefix/
|
||
├── .vbs-install-manifest.json # owned files, used by uninstall
|
||
├── bin/app
|
||
├── lib/libcore.a
|
||
├── include/...
|
||
├── lib/cmake/app/appConfig.cmake # unless --no-cmake-export
|
||
├── lib/cmake/app/appTargets.cmake
|
||
└── share/vbs/app/package.json # unless --no-native-export
|
||
```
|
||
|
||
- Installation is staged privately and published only after every item validates.
|
||
- Path traversal, destination collisions, duplicate files and build-tree path leaks are rejected.
|
||
- `--component NAME` installs only one component.
|
||
- `--bundle-dependencies` copies the installed targets' runtime shared libraries into `<prefix>/lib`, deduplicated.
|
||
- `vbs uninstall --prefix DIR` removes only manifest-owned files and preserves everything else.
|
||
|
||
CMake exports are relocatable: generated targets use `${_vbs_prefix}` and relative include directories, never the original build or snapshot path. The native `package.json` records the package name/version, profile, compiler, OS, architecture, include directory, targets, public defines/options and local target dependencies.
|
||
|
||
## Installer archives
|
||
|
||
```sh
|
||
vbs install --prefix dist/prefix --archive dist/app.tar
|
||
vbs install --prefix dist/prefix --archive dist/app.run --archive-format sh
|
||
vbs install --prefix dist/prefix --archive dist/app.deb --archive-format deb
|
||
vbs install --prefix dist/prefix --archive dist/app.rpm --archive-format rpm
|
||
vbs install --prefix dist/prefix --archive dist/app.zip --archive-format zip
|
||
vbs install --prefix dist/prefix --archive dist/app.wxs --archive-format wix
|
||
vbs install --prefix dist/prefix --archive dist/app.dmg --archive-format dmg
|
||
vbs install --prefix dist/prefix --archive dist/app.nupkg --archive-format nuget
|
||
```
|
||
|
||
| Format | Output |
|
||
| --- | --- |
|
||
| `tar` (default) | Deterministic USTAR/PAX archive of the owned prefix files |
|
||
| `sh` | Executable POSIX self-extracting installer with a tar payload; `--prefix DIR` or `PREFIX` selects the destination |
|
||
| `zip` | Stored (uncompressed) deterministic ZIP with CRC-32 and canonical timestamps |
|
||
| `deb` | Debian `ar` package with `debian-binary`, `control.tar`, `data.tar`; accepted by `dpkg-deb` |
|
||
| `rpm` | Real RPM with lead, signature header, main header and newc cpio payload; accepted by `rpm` |
|
||
| `wix` | WiX v3 source XML with deterministic Product/Upgrade GUIDs; compile with candle/light on Windows |
|
||
| `dmg` | UDIF container: deterministic tar payload plus a 512-byte `koly` trailer with CRC-32 checksums |
|
||
| `nuget` | `.nupkg` OPC ZIP with `.nuspec`, `[Content_Types].xml`, `_rels/.rels` and `runtimes/<rid>/native/**` |
|
||
|
||
The `wix` output is a source file, not an MSI. The `dmg` output is a valid UDIF container but does not include an HFS+/APFS payload writer, so it is not a mountable macOS image by itself. `deb`, `rpm`, `zip` and `nuget` are validated by their native readers in the test suite.
|
||
|
||
Archives contain the installed files and generated export metadata. The `.vbs-install-manifest.json` is written into the prefix after the installed-file list is fixed, so it is **not** inside the archive in 1.0.0. Two runs with the same input produce identical archive bytes.
|
||
|
||
## Sign installer archives
|
||
|
||
```sh
|
||
vbs install --prefix dist/prefix \
|
||
--archive dist/app.tar \
|
||
--signing-key signing.seed
|
||
```
|
||
|
||
This writes:
|
||
|
||
| File | Content |
|
||
| --- | --- |
|
||
| `dist/app.tar.sha256` | `sha256sum` format checksum |
|
||
| `dist/app.tar.sig` | Ed25519 detached signature hex |
|
||
| `dist/app.tar.pub` | Signer public key hex |
|
||
| `dist/app.tar.msg` | Exact signed message |
|
||
|
||
The signed message is short and size-independent:
|
||
|
||
```text
|
||
vbs-installer-v1
|
||
<archive-sha256>
|
||
```
|
||
|
||
Signing streams the archive digest, so large packages do not hit a one-shot crypto limit. If no Ed25519 backend is available, signing fails closed with an explicit error instead of writing a partial signature.
|
||
|
||
## SBOM
|
||
|
||
```sh
|
||
vbs build --sbom build/app.spdx.json
|
||
vbs build --sbom build/app.cdx.json --sbom-format cyclonedx
|
||
vbs test --sbom build/app.spdx.json
|
||
```
|
||
|
||
- **SPDX 2.3** is the default; **CycloneDX 1.5** is selected with `--sbom-format`.
|
||
- Inputs are the pinned lockfile entries that carry a concrete version (registry packages) and the build graph's primary output files, with SHA-256 digests. Git/path/archive/pkg-config entries without a version are omitted.
|
||
- The document namespace/serial is derived from the input content, and the timestamp comes from the reproducibility epoch, so identical inputs produce byte-identical SBOMs.
|
||
- Unknown supplier/download locations are encoded as `NOASSERTION`, not omitted silently.
|
||
|
||
The SBOM records what was resolved and built; it does not prove that the build was honest. Pair it with signed archives and the install manifest for provenance.
|
||
|
||
## Publish a source release
|
||
|
||
```sh
|
||
vbs publish --registry https://packages.example.com \
|
||
--name my-lib --version 1.2.3 \
|
||
--description "A small library" \
|
||
--signing-key signing.seed
|
||
```
|
||
|
||
`vbs publish`:
|
||
|
||
1. creates a deterministic source archive of the project;
|
||
2. excludes `.git`, `.vbs`, `build`, `.serena`, `.cache`, `keys`, `.env`, `WG.conf`, symlinks and the output archive itself;
|
||
3. uploads the raw tar to `PUT /api/v1/packages/<name>/<version>`;
|
||
4. optionally signs the canonical `vbs-package-v1` digest message and attaches `X-Package-Signature` / `X-Package-Public-Key`.
|
||
|
||
Publishing the same bytes again is idempotent. Publishing different bytes for an existing version is rejected as an immutable conflict. The archive must extract safely (no traversal, absolute paths, symlinks, hardlinks, duplicates or quota violations), or the registry rejects it as `422 invalid_archive`.
|
||
|
||
Registry metadata:
|
||
|
||
- descriptions and private flags are carried by `X-Package-Description` / `X-Package-Private` on publish and can be changed later with `PATCH /api/v1/packages/<name>` (no CLI in 1.0.0);
|
||
- release signature metadata is stored and served but not verified server-side; consumers enforce trust;
|
||
- yanking flips a flag used by clients when selecting releases/variants. Download endpoints still serve yanked content, so yanking is advisory, not deletion.
|
||
|
||
## Publish a binary variant
|
||
|
||
```sh
|
||
vbs publish-binary --registry https://packages.example.com \
|
||
--name my-lib --version 1.2.3 \
|
||
--variant linux-x86_64-gcc16-release \
|
||
--file dist/prefix/lib/libmy_lib.a \
|
||
--signing-key signing.seed
|
||
```
|
||
|
||
`vbs publish-binary` computes the artifact SHA-256, optionally signs the canonical binary message, and uploads to `PUT /api/v1/packages/<name>/<version>/binaries/<variant>`. Variant ids are 1–128 characters of `[A-Za-z0-9._-]`. Identical bytes are idempotent; different bytes for the same variant are a 409 immutable conflict.
|
||
|
||
Binary variants are selected by a compatibility key covering OS, architecture, compiler family and ABI, stdlib ABI, linkage, CPU features, sanitizers, LTO and dependency-closure hash. **Normal `vbs build` dependency resolution still builds registry packages from source in 1.0.0.** Binary variants are published, listed, fetched and verified explicitly.
|
||
|
||
```sh
|
||
vbs binaries list --registry URL --name my-lib --version 1.2.3
|
||
vbs binaries show --registry URL --name my-lib --version 1.2.3 --variant linux-x86_64-gcc16-release
|
||
vbs binaries fetch --registry URL --name my-lib --version 1.2.3 \
|
||
--variant linux-x86_64-gcc16-release --output libmy_lib.a
|
||
```
|
||
|
||
A fetch verifies SHA-256 before writing. With `--trusted-public-key` or `--trusted-key-file`, it also requires a valid Ed25519 signature from a trusted key.
|
||
|
||
## Releases and tokens
|
||
|
||
```sh
|
||
vbs releases list --registry URL --name my-lib
|
||
vbs releases show --registry URL --name my-lib --version 1.2.3
|
||
vbs releases yank --registry URL --name my-lib --version 1.2.3
|
||
vbs releases yank --registry URL --name my-lib --version 1.2.3 --unyank
|
||
|
||
vbs tokens list --registry URL
|
||
vbs tokens revoke --registry URL --token-id tok_...
|
||
```
|
||
|
||
- `releases show` prints the digest, size, yank state, signature presence and binary count.
|
||
- Plaintext token secrets are returned exactly once at creation and are never listed again.
|
||
- Token revocation is a soft flag and takes effect on the next verification.
|
||
|
||
## Private packages
|
||
|
||
:::callout{type="warning" title="Private means hidden from anonymous access"}
|
||
In 1.0.0, a private package is omitted from anonymous listings and requires authentication. Any authenticated principal carrying the default `read` scope can read it; private is not a per-user ACL. Treat a registry as a trusted team service and use separate registries or groups when stronger isolation is required.
|
||
:::
|
||
|
||
## Release checklist
|
||
|
||
:::steps
|
||
@@step[Build and test reproducibly]
|
||
`vbs test --profile release --locked --no-cache`
|
||
@@step[Generate provenance]
|
||
`vbs test --profile release --sbom dist/app.spdx.json`
|
||
@@step[Install and package]
|
||
`vbs install --profile release --prefix dist/prefix --archive dist/app.tar --signing-key signing.seed`
|
||
@@step[Publish the source]
|
||
`vbs publish --registry URL --name app --version 1.2.3 --signing-key signing.seed`
|
||
@@step[Publish platform binaries]
|
||
`vbs publish-binary --registry URL --name app --version 1.2.3 --variant linux-x86_64 --file dist/prefix/bin/app --signing-key signing.seed`
|
||
:::
|
||
|
||
Next: [run the registry yourself](/build-system/consumer/registry-service) or [read the registry internals](/build-system/developer/registry-internals).
|