Module config

Module config 

Source
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.

FieldTypeDefaultDescription
build_threadsinteger1Number of parallel build sandboxes. Each sandbox builds one package at a time.
scan_threadsinteger1Number of parallel scan processes for dependency discovery.
strict_scanbooleanfalseIf true, abort on scan errors. If false, continue and report failures separately.
verbosebooleanfalseEnable 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

FieldTypeDescription
basedirstringAbsolute path to the pkgsrc source tree (e.g., /data/pkgsrc).
logdirstringDirectory for all logs. Per-package build logs go in subdirectories. Failed builds leave logs here; successful builds clean up.
makestringAbsolute path to the bmake binary (e.g., /usr/pkg/bin/bmake).
packagesstringDirectory where binary packages are stored after successful builds.
pkgtoolsstringDirectory containing pkg_add, pkg_delete, and other pkg tools (e.g., /usr/pkg/sbin).
prefixstringInstallation prefix for packages (e.g., /usr/pkg). Must match the bootstrap kit.
tarstringAbsolute path to a tar binary capable of extracting the bootstrap kit.

§Optional Fields

FieldTypeDefaultDescription
bootstrapstringnonePath to a bootstrap tarball. Required on non-NetBSD systems. Unpacked into each sandbox before builds.
build_userstringnoneUnprivileged user to run builds as. If set, builds run as this user instead of root.
pkgpathstable{}List of package paths to build (e.g., {"mail/mutt", "www/curl"}). Dependencies are discovered automatically.
report_dirstringlogdirDirectory for HTML build reports. Defaults to the logdir directory.
save_wrkdir_patternstable{}Glob patterns for files to preserve from WRKDIR on build failure (e.g., {"**/config.log"}).
envfunction 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:

FieldTypeDescription
pkgnamestringPackage name with version (e.g., mutt-2.2.12).
pkgpathstringPackage path in pkgsrc (e.g., mail/mutt).
all_dependsstringSpace-separated list of all transitive dependency paths.
dependsstringSpace-separated list of direct dependency package names.
scan_dependsstringSpace-separated list of scan-time dependency paths.
categoriesstringPackage categories from CATEGORIES.
maintainerstringPackage maintainer email from MAINTAINER.
bootstrap_pkgstringValue of BOOTSTRAP_PKG if set.
usergroup_phasestringValue of USERGROUP_PHASE if set.
use_destdirstringValue of USE_DESTDIR.
multi_versionstringValue of MULTI_VERSION if set.
pbulk_weightstringValue of PBULK_WEIGHT if set.
pkg_skip_reasonstringValue of PKG_SKIP_REASON if set.
pkg_fail_reasonstringValue of PKG_FAIL_REASON if set.
no_bin_on_ftpstringValue of NO_BIN_ON_FTP if set.
restrictedstringValue of RESTRICTED if set.

§Scripts Section

The scripts section defines paths to build scripts. Relative paths are resolved from the configuration file’s directory.

ScriptRequiredDescription
pre-buildnoExecuted before each package build. Used for per-build sandbox setup (e.g., unpacking bootstrap kit). Receives environment variables listed in Script Environment.
post-buildnoExecuted after each package build completes (success or failure).

§Script Environment

Build scripts receive these environment variables:

VariableDescription
bob_logdirPath to the log directory.
bob_makePath to the bmake binary.
bob_packagesPath to the packages directory.
bob_pkgtoolsPath to the pkg tools directory.
bob_pkgsrcPath to the pkgsrc source tree.
bob_prefixInstallation prefix.
bob_tarPath to the tar binary.
bob_build_userUnprivileged build user, if configured.
bob_bootstrapPath to the bootstrap tarball, if configured.
bob_status_fdFile 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:

MessageDescription
stage:<name>Build entered a new phase (e.g., stage:configure). Displayed in the TUI.
skippedPackage was skipped (e.g., already up-to-date).

§Sandboxes Section

The sandboxes section is optional. When present, builds run in isolated chroot environments.

FieldTypeRequiredDescription
basedirstringyesBase directory for sandbox roots. Sandboxes are created as numbered subdirectories (basedir/0, basedir/1, etc.).
actionstableyesList of actions to perform during sandbox setup. See the action module for details.

Structs§

Config
Main configuration structure.
ConfigFile
Parsed configuration file contents.
LuaEnv
Holds the Lua state for evaluating env functions.
Options
General build options from the options section.
Pkgsrc
pkgsrc-related configuration from the pkgsrc section.
Sandboxes
Sandbox configuration from the sandboxes section.