Skip to content

sow build

Turn desired state and current configuration into a new Generation, or finish an interrupted operation.

sow build reapplies the current limit and exclude policy and renders the indexes and configured signatures for each affected Dist. Once packages are in pool/, it atomically switches each Dist directory and records the repository Generation after the switches complete. add and rm build by default. Run build yourself after add --skip or rm --skip, after editing sow.yml, or to finish an interrupted operation. Run sow check afterwards before you deliver the tree.

Synopsis

sow build [-j|--jobs N] [-C|--workdir DIR] [-r|--repo NAME] [-d|--dist NAME]... [-T|--timeout DUR | -N|--no-wait] [--json] [--passfile PATH]
Flag Meaning Default
-j, --jobs N Parallel package inspection and render workers; at least 1 logical CPU count
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
-d, --dist NAME Build only these Dists; repeatable all affected Dists
-T, --timeout DUR Maximum lock wait; 0 waits indefinitely 0
-N, --no-wait Fail immediately when the lock is held false
--passfile PATH Signing password file for this run; overrides per-key config (Password files) —
--json Output JSON false

Without -d, SOW builds every affected Dist in the repository. With -d, it builds only the named Dists, and changes to the others stay dirty.

Result

sow build -r demo -d el9
built repository=demo operation=2769214987359113555 dists=el9 revision=4 generation=00000000000000000005 dirty=false

dirty=false means nothing is left to build. Use --json to read the result in a script.

When membership, relevant policy, renderer settings, and signing configuration already match the current Generation, build is a no-op and keeps it:

sow build -r demo -d el9
build repository=demo dists=el9 already current (noop) revision=4 generation=00000000000000000005 dirty=false

Apply policy changes

build re-evaluates the current exclude and limit policy against desired membership. Tightening policy can remove members. Loosening it does not bring back earlier members from leftover pool files; run sow add again for the packages you want to restore.

Metadata signing

Configure metadata signing in sow.yml. Changing a configured key reference or fingerprint makes the affected Dists dirty, and the next build re-signs their metadata.

  • RPM: always writes repodata/repomd.xml; adds repomd.xml.asc when signing is configured.
  • DEB: always writes Release; adds InRelease and Release.gpg when signing is configured.

Commit and recovery

SOW moves the packages the build needs from the pending area into pool/, writes the new indexes, and only then replaces client entry points such as repomd.xml and Release, so an entry point never refers to a file that is not there yet. One build can cover several Dists; they share the resulting Generation, and Dists you did not select stay dirty until a later build.

If a build stops, run it again. SOW finds the unfinished operation by its pending state, not by timestamp order, and uses the operation journal to finish or roll back the work. If the journal, database, and files disagree, the command reports an integrity error; use sow check and sow log to find the affected state.

A build refuses to withdraw a client entry point (a pointer-phase file) that a configured target has published. See Removing a published view.

Publication time

Each new build records one UTC publication time with whole-second precision. APT Release dates, RPM data timestamps, and metadata signatures across the affected Dists all use it. Recovery reuses the recorded time, and a no-op build leaves it unchanged.

The time cannot precede the recorded time of an earlier build or the activation time of the selected signing key; a key that is not usable yet makes the build fail. Keep the host clock correct.

Progress events

Long builds append structured build_progress records to the operation log. Each record has phase, completed, total, and jobs; the phases are rendering, promoting_payload, publishing_dists, normalizing_public_tree, and finalizing. Read them with sow log OPERATION.

Details

  • repo migrate and journals without a recorded publication time keep their earlier timestamp behavior; see Publication times.
  • An rm --check preview picks its own publication time, so the hashes and sizes it predicts can differ from those of the real run.

Exit codes

Code Trigger
0 Build completed, or nothing to do
1 Renderer, signing, or filesystem failure
2 Usage error, workspace not found, or implicit repository selection is ambiguous
4 Repository write lock unavailable
5 Recovery cannot complete safely, or the repository is in error
6 Explicit scope is not configured, the current configuration rejects existing state, or the build would withdraw a published entry point

See also

Table reader