Expand description
Configuration file parsing (Lua format).
Bob uses Lua configuration files for maximum flexibility. The configuration defines paths to pkgsrc, packages to build, sandbox setup, and build scripts.
§Configuration File Structure
A configuration file has four main sections:
options- General build options (optional)pkgsrc- pkgsrc paths and package list (required)scripts- Build script paths (required)sandboxes- Sandbox configuration (optional)
§Options Section
The options section is optional. All fields have defaults.
| Field | Type | Default | Description |
|---|---|---|---|
build_threads | integer | 1 | Number of parallel build sandboxes. Each sandbox builds one package at a time. |
scan_threads | integer | 1 | Number of parallel scan processes for dependency discovery. |
strict_scan | boolean | false | If true, abort on scan errors. If false, continue and report failures separately. |
verbose | boolean | false | Enable verbose output. Can be overridden by the -v command line flag. |
§Pkgsrc Section
The pkgsrc section is required and defines paths to pkgsrc components.
§Required Fields
| Field | Type | Description |
|---|---|---|
basedir | string | Absolute path to the pkgsrc source tree (e.g., /data/pkgsrc). |
logdir | string | Directory for all logs. Per-package build logs go in subdirectories. Failed builds leave logs here; successful builds clean up. |
make | string | Absolute path to the bmake binary (e.g., /usr/pkg/bin/bmake). |
packages | string | Directory where binary packages are stored after successful builds. |
pkgtools | string | Directory containing pkg_add, pkg_delete, and other pkg tools (e.g., /usr/pkg/sbin). |
prefix | string | Installation prefix for packages (e.g., /usr/pkg). Must match the bootstrap kit. |
tar | string | Absolute path to a tar binary capable of extracting the bootstrap kit. |
§Optional Fields
| Field | Type | Default | Description |
|---|---|---|---|
bootstrap | string | none | Path to a bootstrap tarball. Required on non-NetBSD systems. Unpacked into each sandbox before builds. |
build_user | string | none | Unprivileged user to run builds as. If set, builds run as this user instead of root. |
pkgpaths | table | {} | List of package paths to build (e.g., {"mail/mutt", "www/curl"}). Dependencies are discovered automatically. |
report_dir | string | logdir | Directory for HTML build reports. Defaults to the logdir directory. |
save_wrkdir_patterns | table | {} | Glob patterns for files to preserve from WRKDIR on build failure (e.g., {"**/config.log"}). |
env | function or table | {} | Environment variables for builds. Can be a table of key-value pairs, or a function receiving package metadata and returning a table. See Environment Function. |
§Environment Function
The env field can be a function that returns environment variables for each
package build. The function receives a pkg table with the following fields:
| Field | Type | Description |
|---|---|---|
pkgname | string | Package name with version (e.g., mutt-2.2.12). |
pkgpath | string | Package path in pkgsrc (e.g., mail/mutt). |
all_depends | string | Space-separated list of all transitive dependency paths. |
depends | string | Space-separated list of direct dependency package names. |
scan_depends | string | Space-separated list of scan-time dependency paths. |
categories | string | Package categories from CATEGORIES. |
maintainer | string | Package maintainer email from MAINTAINER. |
bootstrap_pkg | string | Value of BOOTSTRAP_PKG if set. |
usergroup_phase | string | Value of USERGROUP_PHASE if set. |
use_destdir | string | Value of USE_DESTDIR. |
multi_version | string | Value of MULTI_VERSION if set. |
pbulk_weight | string | Value of PBULK_WEIGHT if set. |
pkg_skip_reason | string | Value of PKG_SKIP_REASON if set. |
pkg_fail_reason | string | Value of PKG_FAIL_REASON if set. |
no_bin_on_ftp | string | Value of NO_BIN_ON_FTP if set. |
restricted | string | Value of RESTRICTED if set. |
§Scripts Section
The scripts section defines paths to build scripts. Relative paths are
resolved from the configuration file’s directory.
| Script | Required | Description |
|---|---|---|
pre-build | no | Executed before each package build. Used for per-build sandbox setup (e.g., unpacking bootstrap kit). Receives environment variables listed in Script Environment. |
post-build | no | Executed after each package build completes (success or failure). |
§Script Environment
Build scripts receive these environment variables:
| Variable | Description |
|---|---|
bob_logdir | Path to the log directory. |
bob_make | Path to the bmake binary. |
bob_packages | Path to the packages directory. |
bob_pkgtools | Path to the pkg tools directory. |
bob_pkgsrc | Path to the pkgsrc source tree. |
bob_prefix | Installation prefix. |
bob_tar | Path to the tar binary. |
bob_build_user | Unprivileged build user, if configured. |
bob_bootstrap | Path to the bootstrap tarball, if configured. |
bob_status_fd | File descriptor for sending status messages back to bob. |
§Status Messages
Scripts can send status updates to bob by writing to the file descriptor
in bob_status_fd:
| Message | Description |
|---|---|
stage:<name> | Build entered a new phase (e.g., stage:configure). Displayed in the TUI. |
skipped | Package was skipped (e.g., already up-to-date). |
§Sandboxes Section
The sandboxes section is optional. When present, builds run in isolated
chroot environments.
| Field | Type | Required | Description |
|---|---|---|---|
basedir | string | yes | Base directory for sandbox roots. Sandboxes are created as numbered subdirectories (basedir/0, basedir/1, etc.). |
actions | table | yes | List of actions to perform during sandbox setup. See the action module for details. |
Structs§
- Config
- Main configuration structure.
- Config
File - Parsed configuration file contents.
- LuaEnv
- Holds the Lua state for evaluating env functions.
- Options
- General build options from the
optionssection. - Pkgsrc
- pkgsrc-related configuration from the
pkgsrcsection. - Sandboxes
- Sandbox configuration from the
sandboxessection.