Skip to content

This is the multi-page printable view of this section.

Return to the regular view of this page

Commands

Every SOW command at a glance, plus the rules they share: workspace discovery, repository and Dist selection, locking, JSON output, and exit codes.

SOW commands fall into two groups. Commands for simple repositories, create and prune, work on one directory of packages and keep nothing else: no configuration, no database, no history. Workspace commands are everything else. They work on standard repositories, which live in a workspace that sow init creates and that the commands find through its sow.yml. They record which packages each Dist should contain (its desired membership), build that into a Generation, verify it, and publish it.

Day-to-day work on a standard repository is one loop:

sow add PATH... -r REPO -d DIST   # change desired membership (builds unless --skip)
sow build -r REPO                 # build pending changes into a new Generation
sow check -r REPO                 # verify the tree before clients see it
sow publish TARGET                # copy the verified Generation to a server or bucket

add and rm build the Dists they change, so a separate build is needed only after --skip or a sow.yml edit. The other workspace commands set things up (init, config, repo, dist), inspect state (ls, show, where, status, changes, log), or reclaim space (retain, gc). The rules that all commands share follow the table.

Command index

help and version run anywhere. Commands for simple repositories never look for a workspace; every workspace command except init needs an existing one.

Command Works on Purpose
sow create [DIR] simple repository Index a directory of RPM/DEB files in place
sow prune DIR simple repository Keep the newest RPM per name and architecture
sow init [DIR] workspace Create a workspace and the repositories and Dists it declares
sow config check|show workspace Validate or print the effective configuration
sow repo ls|new|show|migrate|rm workspace Create, inspect, upgrade, or remove standard repositories
sow dist ls|new|show|rm workspace Manage Dists
sow add PATH... workspace Add packages and rebuild indexes
sow rm PACKAGE... workspace Remove packages and rebuild indexes
sow ls workspace List desired packages and where they are built
sow show PACKAGE workspace Inspect one package
sow where PACKAGE workspace Find a package across the workspace
sow status workspace Show repository state and pending changes
sow build workspace Build a Generation from the desired state
sow check workspace Verify a repository before delivery
sow changes [BASE_GENERATION] workspace Compare files in two built Generations
sow publish TARGET workspace Publish a verified Generation to a configured target
sow retain add|ls|rm workspace Protect a Generation’s package files from local GC
sow gc [TARGET] workspace Reclaim unused local packages or maintain a publication target
sow export rpm-leaf workspace Export a standalone RPM repository
sow log [OPERATION] workspace Read, export, and prune operation records

Global syntax

sow [OPTIONS] COMMAND [ARGS]

sow with no arguments prints the command list and exits 0. sow help COMMAND and sow help COMMAND SUBCOMMAND print the usage built into the installed binary; sow version and sow --version print version and build information.

An option works only on the commands that list it. Any other option, including an unknown one, is a usage error (exit 2). A repeated single-value option keeps its last value. Repeat -d or --protect to accumulate names. Boolean switches such as --strict accept =true or =false. --help and --version take no value. Use -- before a positional argument that starts with -.

Signing passwords

Commands that can sign, or recover an interrupted signed operation, accept --passfile PATH: create (only together with -S), init, config check, repo new|migrate|rm, dist new|rm, add, rm, build, publish, gc, export rpm-leaf, and log prune. All other commands reject it, including prune, config show, check, and retain.

For each signing key, SOW uses the first source that is set: --passfile, the key’s configured passfile, the SOW_GPG_PASSFILE environment variable, and finally the existing key/GPG/RPM behavior. No default file is searched. Password files describes the file format, relative-path rules, and legacy passphrase compatibility.

Workspace discovery

Workspace commands look for the nearest directory that contains sow.yml or sow.yaml:

  1. With -C/--workdir DIR, search upward from DIR only, with no fallback to the current directory or SOW_DIR.
  2. Without -C, search upward from the current directory; if that finds nothing and SOW_DIR is set, search upward from SOW_DIR.
  3. Stop at the first directory that contains either file. If both exist there as regular files, exit 2. A legacy repository directory named sow.yaml next to sow.yml is accepted.
  4. If no workspace is found, exit 2.

--workdir moves only the search start. The process working directory does not change, so relative paths in arguments still resolve against the real current directory. sow create and sow prune never search for a workspace.

Repository selection

A command that works on one repository picks it in this order:

  1. -r/--repo NAME;
  2. the repository that contains the discovery start directory;
  3. the only repository in the workspace;
  4. otherwise, exit 2 and list the candidates.

repo new and repo rm take NAME as an argument and reject -r. sow where searches every repository unless -r narrows it. A publication target is bound to one repository, so publish TARGET and gc TARGET reject -r.

Dist selection

add, rm, and ls need a definite set of Dists and pick it in this order:

  1. one or more -d/--dist NAME;
  2. the Dist that contains the discovery start directory (anywhere under REPO/dists/DIST/);
  3. the only Dist in the selected repository;
  4. otherwise, exit 2 and list the candidates.

The other commands default to a wider scope:

  • build, check, and status cover all Dists when -d is absent.
  • show searches the whole selected repository; -d narrows it.
  • where searches all matching Dists in the workspace; -r and -d narrow it.
  • changes always covers the whole repository and rejects -d.

Locking

Locks stop two SOW processes from changing the same tree at once. create and prune briefly lock the parent while opening the target directory. They release the parent before waiting for a busy target and hold the target lock during the run, so sibling repositories can be processed in parallel. Workspace commands that make changes take a workspace lock and per-repository locks.

  • Write commands accept -T/--timeout DUR and -N/--no-wait, except init, which always waits. The default --timeout 0 (or 0s) waits indefinitely; positive Go durations include 500ms, 30s, and 1m30s. --no-wait fails at once when the lock is held and cannot be combined with a positive timeout. A lock that cannot be acquired returns exit 4.
  • Read-only workspace commands take shared locks, wait behind a conflicting writer, and accept no lock options. status normally only probes the repository lock, so it can report on a writer that is still running.
  • Ctrl-C cancels a command that is waiting for a lock.

Parallelism

-j/--jobs N exists only on commands that parse packages, hash bytes, render indexes, or verify state: create, prune, add, rm, build, check, and repo migrate. It defaults to the number of logical CPUs and must be at least 1.

JSON output

Use text output interactively and --json in scripts. With --json, a command prints one versioned envelope on stdout and keeps diagnostics on stderr:

{
  "schema": "sow.cli/v1",
  "command": "add",
  "ok": true,
  "repository": "demo",
  "operation": "1430722512865805553",
  "result": {},
  "errors": []
}

ok is false for every non-zero exit, and a partly successful batch still returns both its committed and its failed items. Two commands differ: config show prints YAML unless you pass --json, and log export writes JSONL directly and does not accept --json. JSON Output documents every result shape.

Exit codes

Code Meaning
0 Success or idempotent no-op
1 Runtime I/O, parser, renderer, signing, or transport error
2 Usage, workspace discovery, or configuration error
3 Partial batch success
4 Write lock unavailable
5 Integrity/recovery failure, or check ruling the tree not deliverable
6 Rejected operation: conflict, protected object, no match, or incompatible architecture
130 Command interrupted by SIGINT or SIGTERM

Each command page lists its own triggers; Exit Codes collects them in one place.

1 - sow create

Turn a directory of RPM and DEB files into a YUM/APT repository: options, scan rules, Pigsty cleanup, RPM signing, and exit codes.

sow create writes YUM and APT indexes next to the packages in one directory, which turns that directory into a simple repository that dnf and apt can install from directly. Reach for it when the directory itself is the repository: an offline bundle, a mirror you fill by other means, or a replacement for a createrepo_c script. It indexes every valid version it finds and keeps no build history; use sow prune to drop superseded RPMs, and a standard repository when you need several Dists, version limits, build history, or publication.

Synopsis

sow create [DIR] [-j N] [--metadata-timestamp SECONDS] [--pigsty] [--strict] [-S KEY [--overwrite] [--passfile PATH]] [-T DUR | -N] [--json]

DIR defaults to the current directory. --passfile requires --sign-with, and SOW_GPG_PASSFILE alone does not turn signing on; see Password files for the file format.

Options

Flag Description Default
-j, --jobs N Parallel package-processing workers logical CPU count
--metadata-timestamp SECONDS Unix seconds from 0 to 253402300799 for RPM repomd data timestamps; leaves DEB, package times and gzip headers unchanged 0
--pigsty Enable Pigsty cleanup and the repo_complete gate off
--strict Fail non-zero on corrupt, unreadable, source, or conflicting packages (or empty non-Pigsty directory) instead of skipping with a warning off
-S, --sign-with KEY Sign unsigned RPMs with a GPG key ID or fingerprint off
--passfile PATH Password file for --sign-with SOW_GPG_PASSFILE, then existing RPM/GPG behavior
--overwrite Re-sign every RPM; requires --sign-with off
-T, --timeout DUR Maximum lock wait; 0 waits indefinitely 0
-N, --no-wait Fail immediately when the lock is held false
--json Output JSON false
-h, --help Show help —

Examples

Index a directory that holds both RPMs and DEBs:

sow create /srv/flat
created /srv/flat: rpm=3 deb=1 signed=0 removed=0 marker=false noop=false recovered=false
ls /srv/flat
centos-release-6-0.el6.centos.5.x86_64.rpm
centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm
epel-release-7-5.noarch.rpm
libpq5_18.3-1_amd64.deb
Packages
Packages.gz
repodata

Run it again whenever packages change. On an unchanged directory it writes nothing:

sow create /srv/flat
created /srv/flat: rpm=3 deb=1 signed=0 removed=0 marker=false noop=true recovered=false

The same result for a script:

sow create /srv/flat --json
{"schema":"sow.cli/v1","command":"create","ok":true,"repository":null,"operation":null,"result":{"dir":"/srv/flat","rpm":3,"deb":1,"kept":["centos-release-6-0.el6.centos.5.x86_64.rpm","centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm","epel-release-7-5.noarch.rpm","libpq5_18.3-1_amd64.deb"],"removed":[],"marker":false,"noop":true,"recovered":false},"errors":[]}

Rebuild a Pigsty offline repository with eight workers and a publication time chosen from its history:

sow create /www/pigsty -j 8 --pigsty --metadata-timestamp "${PUBLISH_TIME:?Set the verified publication time}"

You record PUBLISH_TIME yourself, and sign the resulting repomd.xml if clients require it; see Publication time.

Inputs and outputs

create reads only the top level of DIR: entries ending in .rpm or .deb whose target is a regular file. A symlink to a package file counts; subdirectories and sow.yml are ignored, and create refuses to run inside a workspace. Format and architecture come from each package header, and every architecture found is indexed.

Packages found Indexes written
RPM repodata/
DEB Packages and Packages.gz
Both Both sets

Indexes refer to packages by relative path, the file name for RPM and ./<filename> for DEB, so the directory can be served over HTTP as is or used as a file:// source. The DEB side is a flat APT repository, with no dists/ hierarchy and no Release file, so APT clients list it as deb [trusted=yes] URL ./. Package files stay untouched, except that --pigsty deletes matching packages and --sign-with replaces RPMs with signed copies.

By default, create warns and skips corrupt or unreadable packages and source RPMs (src and nosrc). The --pigsty cleanup rules run before the package coordinate check.

For a given package name, architecture, and version, the index uses the first valid file in basename order. Debian versions 1.0-1 and 1.00-1, for example, compare equal. A subsequent file with a different SHA-256 is skipped with a warning. Byte-identical copies both appear in kept and, with --pigsty, in the completion marker. They share one index entry.

If all candidates of one format fail, SOW keeps that format’s previous index and can still publish the other format. In --pigsty mode, keeping an existing index also requires its entries in the previous repo_complete. If SOW cannot carry them forward, it warns and skips the whole update. A fresh directory has no old index to preserve.

Removing the last package of a format has a different effect. On the next build SOW removes that format’s generated indexes. A fresh empty directory produces only a warning by default. With --pigsty, an empty directory gets an empty repo_complete.

Text output sends warnings to stderr. A successful --json run reports diagnostics on stdout. It includes result.warnings when there are warnings and result.skipped when files were skipped.

Pass --strict to make any skipped package, coordinate conflict, or empty directory (without --pigsty) fail before anything is written. A corrupt or unreadable package then exits 1; a source RPM, a coordinate conflict, or an empty directory exits 6:

sow create /srv/empty --strict
plain: scan /srv/empty: no supported top-level RPM or DEB packages

Deterministic output and idempotence

For the same packages and timestamp, create renders byte-identical metadata, unless --overwrite re-signs the packages. Gzip output is deterministic, and repomd.xml carries <revision>0</revision> and data timestamps of 0 unless --metadata-timestamp sets them. That is why a repeated run on an unchanged directory rewrites nothing and reports noop=true.

Keep the previous RPM indexes

A client that fetched repomd.xml just before an update still needs the checksum-named metadata files it points to. SOW therefore keeps the RPM metadata referenced by the current and the immediately previous repomd.xml; an unchanged run does not advance this window. The hidden file .sow-plain-rpm-history.json records those references, so keep it with the directory when you copy it elsewhere and rebuild. It is a retention record, not a recovery journal.

The window covers one previous index only, and it never keeps removed package files. If client caches span several updates, keep the packages and metadata they need in your publication layer.

Publication time for existing YUM repositories

--metadata-timestamp sets the data timestamps in repomd.xml, and nothing else: package files, compressed XML, and DEB indexes are unchanged. The default is 0; the accepted range is 0..253402300799 Unix seconds.

The value matters when SOW takes over an existing YUM repository, because EL7 YUM rejects metadata whose newest data timestamp is older than its cached copy. Choose a timestamp at least as high as the highest value already published, and advance it by at least one second whenever content changes:

sow create /srv/flat --metadata-timestamp "${PUBLISH_TIME:?Set the publication time}"

Record the time and pass it on every update; omitting the option resets it to 0. Restoring older package content is still a new publication, so keep the value increasing. Use seconds, not milliseconds, and no future dates. create neither signs repomd.xml nor updates or removes an old repomd.xml.asc; if clients verify that signature, regenerate it after each change. Migrate an Existing YUM Repository walks through the full procedure.

Signing RPMs

-S/--sign-with KEY signs RPMs through the local RPM/GPG setup. KEY is a 16-hex-digit key ID or a 40- or 64-hex-digit fingerprint, optionally prefixed with 0x or 0X. rpm and gpg must be on PATH and the private key must be available to them; for a protected key, pass --passfile PATH or set SOW_GPG_PASSFILE.

  • By default SOW signs only RPMs with no parseable embedded OpenPGP signature (native RPM 6 RPMSIGTAG_OPENPGP tag 278, RSA/DSA/ECDSA/EdDSA in signature header tag 267, or legacy PGP tags). Packages that are already signed keep their bytes.
  • --overwrite re-signs every retained RPM with rpm --resign. It requires --sign-with.
  • SOW signs a private copy, verifies the new OpenPGP signature cryptographically (RPM v4, and RPM v6 tag 278 including multi-signed packages), checks that package identity and content are unchanged, and only then replaces the original. The indexes describe the final signed file.
  • An RPM that needs signing but is a symlink or not a regular file is rejected rather than signed in place.
  • If no RPM remains after --pigsty cleanup, --sign-with only prints a warning; with --strict it fails.
sow create /srv/flat --overwrite
usage error: --overwrite requires --sign-with

sow create /srv/flat -S ZZZZ
usage error: --sign-with must be a 16, 40, or 64 hexadecimal GPG key ID/fingerprint

sow create /srv/flat -S 0123456789ABCDEF --overwrite
plain: sign rpm epel-release-7-5.noarch.rpm: rpm executable is required for --sign-with

sow create /srv/deb-only -S 0123456789ABCDEF --strict
plain: sign rpm: --sign-with requires at least one retained top-level RPM package

–pigsty

--pigsty applies Pigsty’s cleanup rules and writes a completion marker:

  1. Delete DEB packages whose parsed architecture is i386. RPMs are not removed merely for carrying an i386/i486/i586/i686 architecture.
  2. Delete RPM/DEB whose binary package name is exactly patroni and whose upstream version is exactly 3.0.4. RPM compares VERSION, ignoring epoch and release; DEB strips epoch and Debian revision first. 3.0.4+foo is not a match.
  3. Write repo_complete with the SHA-256 of each retained package, sorted by basename in byte order, in the form <sha256><two spaces><basename>. Newly skipped inputs stay on disk and have no new entry. When SOW preserves a format’s old index it carries its previous marker entries forward.
sow create /srv/pigsty --pigsty
created /srv/pigsty: rpm=2 deb=0 signed=0 removed=2 marker=true noop=false recovered=false
cat /srv/pigsty/repo_complete
b4111ef2a51542eacc9bd1ebd080da02e53d400f9d172530c75a1e4ac06e7ead  centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm
d6f332ed157de1d42058ec785b392a1cc4b5836c27830af8fbf083cce29ef0ab  epel-release-7-5.noarch.rpm

Cleanup touches only top-level regular package files that parsed successfully and match a rule; documentation packages such as annobin-docs stay unless they match one. SOW removes the old repo_complete before replacing the indexes, deletes the matched packages, and writes the new marker last. A missing marker therefore means the build is not finished: expose the repository only after repo_complete appears.

The repo_complete gate

A directory that contains repo_complete, or the .sow-prune-repo-complete marker that an interrupted sow prune leaves behind, belongs to the Pigsty workflow. Without --pigsty, create refuses to rebuild it, because the marker would then describe an older package set:

sow create /srv/pigsty
plain: marker gate /srv/pigsty/repo_complete: repo_complete exists; use --pigsty or remove it explicitly before rebuilding

Rerun with --pigsty to keep using the marker, or move the marker out of the directory first.

Metadata from other tools

create replaces an existing repomd.xml, and it does not carry over independent metadata that SOW does not generate, such as groups (comps), updateinfo, or modules. It reports the dropped data types as a warning on stderr, or in the dropped_metadata result field with --json. Alternate package-index encodings (*_db, *_zck) are dropped without a report. This keeps existing repositories rebuildable, including EL8/9 repositories that Pigsty v4.4.0 built with legacy module metadata. If clients still need the dropped records, keep maintaining that repository with the tool that produced them; sow prune refuses such an index instead.

Listing the dropped types requires a readable, valid previous index of at most 16 MiB. create still replaces a larger or malformed index, only without the list.

Locking and interrupted runs

create locks the target directory while it updates the indexes. It releases the parent directory’s lock as soon as it has bound the target, before waiting on a busy one, so runs on sibling directories do not block each other. --timeout and --no-wait control the wait.

Keep the directory unchanged while create runs. After scanning, SOW checks the packages again before it replaces the indexes and stops with exit 5 if anything changed.

An interruption can leave the index set partly updated. Rerun sow create with the same options: a simple repository is always rebuilt from its current packages, so the result field recovered stays false. Use a standard repository when you need journaled recovery.

Exit codes

Code Trigger
0 Indexes written, or unchanged input produced a no-op
1 Directory unreadable or missing, renderer failure, signing tool failure (including missing rpm or gpg), a missing/unreadable/malformed password file when signing needs it, or under --strict: a corrupt or unreadable package (including a broken symlink)
2 Usage error — invalid timestamp, --overwrite or --passfile without --sign-with, invalid/empty --passfile, malformed key, --no-wait with a non-zero --timeout
4 Directory write lock held and --no-wait given or --timeout expired
5 Input set/stat changed before publication, or a controlled output path failed an integrity check
6 Directory inside a workspace (a .sow ancestor), repo_complete / .sow-prune-repo-complete gate hit, symlinked or non-regular RPM that needs signing, or under --strict: empty directory, source RPM, coordinate conflict, or --sign-with with no retained RPM

A failed run with --json still prints the envelope, with ok false and the error class:

sow create /srv/empty --strict --json
{"schema":"sow.cli/v1","command":"create","ok":false,"repository":null,"operation":null,"result":null,"errors":[{"code":6,"class":"rejected","message":"operation rejected: plain: scan /srv/empty: no supported top-level RPM or DEB packages"}]}

See also

2 - sow prune

Drop superseded RPM versions from a simple repository and rebuild its index: options, safety checks, and exit codes.

sow prune keeps the newest RPM for each package name and architecture in a simple repository, rebuilds the index, and then deletes the older files. Use it on a directory that collects every release over time, such as a mirror or a Pigsty offline repository, when only the latest versions should ship. “Newest” follows RPM’s Epoch/Version/Release rules, including caret snapshot versions such as 2.0^20250611 < 2.0.1. In a standard repository, set a Dist’s limit instead; prune refuses to run inside a workspace.

Synopsis

sow prune DIR [--dry-run] [--strict] [--protect NAME]... [-j N] [--metadata-timestamp SECONDS] [-T DUR | -N] [--json]

DIR is required. prune reads only the top-level binary RPM files in it (RPM v4 and v6); it does not scan subdirectories, look for a workspace, or read sow.yml.

Options

Option Behavior
--dry-run Preview validated removal candidates without writes
--strict Fail non-zero on corrupt packages, unmatched --protect names, or equal-version conflicts
--protect NAME Keep all versions of an exact package name; repeatable
-j, --jobs N Package inspection workers; defaults to CPU count
--metadata-timestamp SECONDS Index publication time in Unix seconds; defaults to 0, as for create
-T, --timeout DUR Limit the wait for the directory lock
-N, --no-wait Fail immediately if the directory lock is busy
--json Return the standard JSON envelope
-h, --help Show help

--timeout and --no-wait are mutually exclusive. prune signs neither packages nor metadata and rejects --pigsty and --passfile.

Preview and prune

Preview first, then run the same command without --dry-run:

sow prune /srv/candidate --dry-run
would remove centos-release-6-0.el6.centos.5.x86_64.rpm (keep centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm)
preview /srv/candidate: kept=2 candidates=1 removed=0 index_updated=false noop=false

sow prune /srv/candidate
removed centos-release-6-0.el6.centos.5.x86_64.rpm (keep centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm)
pruned /srv/candidate: kept=2 candidates=1 removed=1 index_updated=true noop=false

A second run on this example reports noop=true. --dry-run validates the packages, lists removal candidates, and warns about conditions such as a signed repomd.xml or unsupported metadata. The preview skips index rendering, so a live run can refresh a stale index even when the preview reports noop=true.

To keep several versions of some packages, protect them by exact name. Pass the same --protect options to the preview and the real run:

sow prune /srv/candidate --protect age_18 --protect age_18-llvmjit

--protect NAME keeps every version of that name on every architecture. It is repeatable and does not accept patterns.

Run prune on the local publication source, not on the copy clients read. A client that cached the previous index may still request an RPM that prune just deleted, so let your publication step keep old files until those caches expire.

Skipped packages and –strict

By default a problem with one package does not stop the run. Corrupt packages, --protect names that match nothing, and equal-version conflicts (the same EVR with different content) are reported as warnings and skipped safely; a conflict keeps the whole name/architecture group. If every RPM is skipped, the previous repodata/ and completion marker stay as they were.

Pass --strict to fail before anything is published instead. The exit code then tells you which problem it was: 1 for a corrupt or unreadable package, 2 for an unmatched --protect name, and 6 for a source RPM, an equal-version conflict in an unprotected group, or a directory with no top-level RPMs (including a DEB-only directory). An explicitly protected group keeps all versions and skips the equal-version conflict check.

Text output prints warnings to stderr. A successful --json run puts them in the stdout envelope and leaves stderr empty. The JSON result has dir, dry_run, kept, candidates (each old path with its latest replacement), removed, optional skipped and warnings, index_updated, marker, and noop.

Mixed directories and repo_complete

In a directory that holds DEBs as well, prune updates only the RPM index, leaves the DEB index as it is, and warns that it operates on RPMs only.

If repo_complete exists, prune withdraws it while it works, recording that state in .sow-prune-repo-complete so it survives an interruption, and writes a fresh marker only after completion. DEB entries in the new marker reuse the existing digests for DEBs still present; newly arrived DEBs that are not indexed yet are not hashed. prune never creates a marker that did not exist and never applies the create --pigsty cleanup rules.

Supported repositories

prune refuses directories inside a workspace. On a live run it also refuses a directory with repodata/repomd.xml.asc, an existing repomd.xml that registers metadata SOW does not generate (groups, updateinfo, modules, or an unknown type), and a previous repomd.xml larger than 16 MiB. The error names the file to remove, repodata/repomd.xml.asc or repodata/repomd.xml, if you accept losing what it carries. Alternate package-index encodings such as SQLite and zchunk are accepted: they encode the same package list that prune rebuilds.

Integrity and recovery

prune never deletes an RPM unless its replacement is sound. The replacement must pass its embedded digest and signature header checks, including RPM v6 native RPMSIGTAG_OPENPGP tag 278 and RSA, DSA, ECDSA, and EdDSA packets in header signature tag 267 (RPMSIGTAG_DSA). SOW binds those checks and the indexed bytes to the file’s identity, including change time and link count, and checks the replacement again before each deletion and before completion. If only ctime or nlink changed, as when something adds a hard link, SOW recomputes the SHA-256 on the bound file descriptor, so a harmless hard link passes while an in-place rewrite that restores size and modification time still stops further deletion.

prune locks only the target directory (it releases the parent lock right after binding), so sibling directories can be pruned in parallel. It publishes the filtered index before it deletes any package. If something fails after the index is published or after some files are deleted, the result reports exactly what changed and the command exits 3; an interruption exits 130. Deleted packages are not restored. Fix the reported problem and rerun the same command.

Exit codes

Code Meaning
0 Prune succeeded, or --dry-run / noop completed
1 Nonexistent or unreadable directory, filesystem, digest verification, or metadata rendering error; under --strict, a corrupt or unreadable package
2 Invalid flags, missing DIR argument, or (under --strict) unmatched --protect package name
3 Partial completion: failure after publishing the filtered index or removing at least one RPM
4 Directory lock is held by another process
6 Unsupported repository state (directory inside a workspace, signed repomd.xml, foreign metadata, previous repomd.xml over 16 MiB), or under --strict: a source RPM, equal EVRs with different content, or no top-level RPMs
130 Interrupted by SIGINT or SIGTERM

See also

3 - sow init

Create a workspace for standard repositories, or create the repositories and Dists that sow.yml declares but that do not exist yet.

sow init turns a directory into a workspace, the home of one or more standard repositories: it creates the private .sow/ state directory, reads an existing sow.yml or sow.yaml, and writes a default sow.yml if neither configuration file exists. If the configuration already declares repositories and Dists, it creates the ones that are missing, so you can write sow.yml first (or keep it in version control) and let init build everything it describes. It is safe to rerun at any time. To add one repository or Dist to an existing workspace, sow repo new and sow dist new do the same work for a single object.

Synopsis

sow init [DIR] [--json] [--passfile PATH]

DIR defaults to the current directory. init takes the directory as an argument; it does not accept -C/--workdir. An existing workspace configured with either sow.yml or sow.yaml is accepted.

Options

Flag Description Default
--passfile PATH Password file for this invocation per-key config, then SOW_GPG_PASSFILE
--json Output JSON false
-h, --help Show help —

Examples

Start an empty workspace in the current directory:

sow init .
initialized /srv/repo: config_created=true repositories_initialized=0 dists_initialized=0
cat sow.yml
schema: sow/v3
architectures:
  - x86_64
  - aarch64
ls -a /srv/repo
.  ..  .sow  sow.yml

.sow/ holds private state, locks, and recovery records, with directory mode 0700. Serve the repository directories over HTTP, never .sow/.

Then add repositories and Dists by hand:

sow repo new infra
sow repo new pgsql
sow dist new el9 --format rpm -r pgsql
sow dist new trixie --format deb -r pgsql

Or install a configuration kept under version control, initialize everything it declares, and validate it:

install -m 0644 sow.yml /srv/repo/sow.yml
sow init /srv/repo
sow config check -C /srv/repo

Idempotence rules

A new configuration uses schema: sow/v3, the architectures x86_64 and aarch64, and no repository. An existing configuration is never rewritten: init only creates declared objects that do not exist yet, and reports zero counters when there is nothing left to create. The directory does not have to be empty, as long as no existing file collides with a path SOW reserves.

Apply a declared configuration

When sow.yml describes repositories and Dists, init creates their directory trees, SQLite databases, and empty indexes, and skips objects that already exist. The counters tell you what this run created:

schema: sow/v3
architectures: [x86_64, aarch64]

repos:
  pgsql:
    dists:
      el9:
        format: rpm
        limit: 1
        exclude:
          - kind: [debuginfo, debugsource]
      trixie:
        format: deb
  infra:
    protected: true
    dists:
      el9:
        format: rpm
sow init .
initialized /srv/repo: config_created=false repositories_initialized=2 dists_initialized=3
sow repo ls
NAME	PROTECTED	DISTS	GENERATION	STATUS	PACKAGES	MEMBERSHIPS
infra	true	1	1	clean	0	0
pgsql	false	2	2	clean	0	0

Each new Dist gets valid empty indexes right away, so clients can be pointed at it before it has packages: an RPM Dist gets an empty repodata/ in each architecture view, and a DEB Dist gets empty Packages and Packages.gz, by-hash entries, and a Release file.

A second run changes nothing:

sow init . --json
{"schema":"sow.cli/v1","command":"init","ok":true,"repository":null,"operation":null,"result":{"workspace":"/srv/repo","config_created":false,"repositories_initialized":0,"dists_initialized":0,"existing":["sow.yml"]},"errors":[]}

Locking and recovery

init waits for other workspace writers to finish; it has no timeout option. If an init is interrupted, run it again on the same directory. SOW first completes or rolls back the interrupted operation, recreates any missing per-repository lock files under .sow/repo-locks/, and then initializes the remaining declared objects.

If a populated .sow/ has lost .sow/workspace.lock, init stops with an integrity error rather than guess whether a writer is active. Stop every writer, create an empty .sow/workspace.lock with mode 0600, and rerun sow init.

Exit codes

Code Trigger
0 Workspace initialized, or already initialized (no-op)
1 Runtime I/O error writing the config or state directory
2 Usage error, or an existing sow.yml that fails to parse or validate
3 Partial success — some declared repositories/Dists were committed and at least one failed
5 The workspace journal could not be recovered to a terminal state, or a populated .sow/ lost workspace.lock
6 An existing file collides with a SOW reserved path, or a declared repository database requires sow repo migrate

See also

4 - sow config

Validate sow.yml against the schema and existing state, and print the configuration SOW actually applies.

Run sow config check after every edit to sow.yml and before the next build: it catches typos, invalid names, unusable signing keys, and changes that existing repository state cannot accept, without touching anything. Run sow config show when you need to know what SOW will actually apply to a repository or Dist, with every default and inherited value filled in. Both commands are read-only.

Synopsis

sow config check [-C DIR] [--json] [--passfile PATH]
sow config show [--all] [-C DIR] [-r NAME] [-d NAME]... [--json]

config check accepts --passfile for its signing checks. config show never reads password files and rejects the option.

Examples

Validate before a build in CI:

sow config check -C /srv/repo || exit 1
sow build -C /srv/repo -r pgsql

Compare the effective policy of two Dists:

sow config show -r pgsql -d el9 > /tmp/el9.yml
sow config show -r pgsql -d el9-beta > /tmp/beta.yml
diff -u /tmp/el9.yml /tmp/beta.yml

sow config check

config check parses and validates the whole sow.yml: schema version, names, path collisions, the architecture list, Dist formats, membership policy, and signing key references. It also checks the configuration against existing repository state, and reports the workspace it found and how much it validated:

sow config check
configuration valid: /srv/repo repositories=1 dists=2
sow config check --json
{"schema":"sow.cli/v1","command":"config check","ok":true,"repository":null,"operation":null,"result":{"workspace":"/srv/repo","repositories":1,"dists":2},"errors":[]}

Options

Flag Description Default
-C, --workdir DIR Workspace discovery start directory current directory
--passfile PATH Password file for this invocation per-key config, then SOW_GPG_PASSFILE
--json Output JSON false
-h, --help Show help —

Strict field rejection

An unknown key is an error, not a warning, so a misspelled policy field cannot be silently ignored:

sow config check
configuration error: load config "/srv/repo/sow.yml": parse sow.yml: yaml: construct errors: line 8: field bogus_field not found in type config.DistConfig

Active workspaces must use schema: sow/v3:

sow config check
configuration error: load config "/srv/repo/sow.yml": config schema must be "sow/v3", got "invalid"

A frozen sow/v2 workspace can still be inspected before migration: config check, repo ls, repo show, dist ls, and dist show read it without changing it.

How far the signing check goes depends on the signer:

  • Metadata key files are unlocked and checked for signing suitability. An external GPG metadata key also performs a small non-interactive signing probe.
  • For active RPM package signing, SOW checks the selected password file’s format, rpm/GPG, and that the secret key is available. It does not sign a package, so it cannot prove the password is correct; RPM macros can also affect authentication. The first real package signing, and verification of its output, is the final check.

Removing an architecture from the workspace list fails while anything still uses it. Remove it from Dist configuration, membership, and built state first.

sow config show

config show prints the effective configuration of the selected scope as YAML:

sow config show
schema: sow/v3
architectures:
  - x86_64
  - aarch64
repos:
  pigsty:
    protected: false
    signing:
      rpm:
        packages:
          mode: never
    dists:
      el9:
        format: rpm
        architectures:
          - x86_64
          - aarch64
        limit: 0
        exclude: []
      trixie:
        format: deb
        architectures:
          - x86_64
          - aarch64
        limit: 0
        exclude: []

The file on disk holds only what you wrote:

cat sow.yml
schema: sow/v3
architectures:
  - x86_64
  - aarch64
repos:
  pigsty:
    signing:
      rpm:
        packages:
          mode: never
    dists:
      el9:
        format: rpm
      trixie:
        format: deb

show filled in protected: false, each Dist’s inherited architectures, limit: 0, and an empty exclude list. Architectures appear under their canonical family names, x86_64 and aarch64; the corresponding DEB names are amd64 and arm64.

Options

Flag Description Default
--all Show every repository and Dist in the workspace; ignores -r and -d off
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
-d, --dist NAME Select a distribution; repeatable selection rules
--json Output JSON false
-h, --help Show help —

Select configuration with -r and -d

-r and -d narrow the output to the selected objects, which is the quickest answer to “which policy applies to this Dist”:

sow config show -r pigsty -d el9
schema: sow/v3
architectures:
  - x86_64
  - aarch64
repos:
  pigsty:
    protected: false
    signing:
      rpm:
        packages:
          mode: never
    dists:
      el9:
        format: rpm
        architectures:
          - x86_64
          - aarch64
        limit: 0
        exclude: []

Without --all, the normal repository selection applies, so a workspace with several repositories needs -r. Inside a Dist directory SOW shows that Dist unless you pass -d; otherwise it shows every Dist of the selected repository. --all shows the entire workspace and ignores -r and -d.

Signing references

The output shows key references and resolved fingerprints, never private key material or passphrases. Configured passfile paths are shown as written; the SOW_GPG_PASSFILE fallback is a runtime setting and does not appear.

Exit codes

Code Trigger
0 Configuration valid, or output printed
1 Runtime or key-resolution failure
2 Usage or discovery error, ambiguous selection, invalid YAML, unknown field, or unsupported schema
5 Existing state, controlled paths, or recovery records are inconsistent
6 Unknown selection, unusable signing configuration, or configuration incompatible with existing state

See also

5 - sow repo

Create, list, inspect, migrate, and remove standard repositories, each with its own package pool, indexes, and build history.

A standard repository is one directory tree in the workspace with its own package pool (pool/), indexes (dists/), database, and build history. Its Dists share the pool, so a package used by several Dists is stored once. sow repo creates, lists, inspects, upgrades, and removes these repositories. Put packages in separate repositories when they need separate signing, deletion protection, or publication targets; otherwise add Dists to one repository with sow dist.

Synopsis

sow repo ls [-C DIR] [--json]
sow repo new NAME [-C DIR] [-T DUR | -N] [--json] [--passfile PATH]
sow repo show [NAME] [-C DIR] [-r NAME] [--json]
sow repo migrate [NAME] [--abort] [-j N] [-C DIR] [-r NAME] [-T DUR | -N] [--json] [--passfile PATH]
sow repo rm NAME [-f|--force] [-C DIR] [-T DUR | -N] [--json] [--passfile PATH]

repo new, repo migrate, and repo rm accept --passfile for signing checks, signing, or recovery of an interrupted operation. repo ls and repo show do not read password files.

Examples

Create the repositories for a two-tier layout:

sow repo new infra
sow repo new pgsql

Create a repository without waiting for a held lock:

sow repo new nightly -N

Print each repository’s name, state, and Generation:

sow repo ls --json | jq -r '.result.repositories[] | "\(.name)\t\(.status)\tgen=\(.generation)"'

Naming

A repository name must match [a-z0-9][a-z0-9._-]*. It may not be ., .., .sow, pool, or dists, or collide with a reserved workspace file. SOW creates the repository at <workspace>/<NAME>/.

sow repo new .sow
operation rejected: managed: operation rejected: name ".sow" must match [a-z0-9][a-z0-9._-]*

sow repo ls

Lists every repository in the workspace. Read-only.

sow repo ls
NAME	PROTECTED	DISTS	GENERATION	STATUS	PACKAGES	MEMBERSHIPS
infra	true	1	1	clean	0	0
pgsql	false	2	2	clean	0	0
Flag Description Default
-C, --workdir DIR Workspace discovery start directory current directory
--json Output JSON false

STATUS is clean, dirty, recovering, or error. Transactions & Recovery explains what each means for clients.

sow repo new

Adds the repository to sow.yml, then creates <workspace>/<NAME>/{pool,dists}, its SQLite database, and its private state. A new repository starts at Generation 0, clean.

sow repo new pigsty
created pigsty: path=/srv/repo/pigsty protected=false dists=0 generation=0 status=clean packages=0 memberships=0
Flag Description Default
-C, --workdir DIR Workspace discovery start directory current directory
-T, --timeout DUR Maximum lock wait; 0 waits indefinitely 0
-N, --no-wait Fail immediately when the lock is held false
--passfile PATH Password file for this invocation per-key config, then SOW_GPG_PASSFILE
--json Output JSON false

Running it again for an existing repository prints the current state and creates nothing.

sow repo show

Shows one repository in detail. Read-only. Without NAME, the usual repository selection applies.

sow repo show pigsty
repository pigsty:
  path: /srv/repo/pigsty
  protected: false
  dists: 2
  generation: 6
  desired_revision: 6
  status: clean
  packages: 5
  memberships: 8
  config: {"protected":false,"signing":{"rpm":{"packages":{"mode":"never"}}},"dists":{"el9":{"format":"rpm","architectures":["x86_64","aarch64"],"limit":1,"exclude":[{"kind":["debuginfo","debugsource"]}]},"trixie":{"format":"deb","architectures":["x86_64","aarch64"],"limit":0,"exclude":null}}}
  dirty_reasons: []
  recent_operation: id=4142220455201181493 kind=add state=done error_class= created_at=2026-08-04T04:09:24.995538Z updated_at=2026-08-04T04:09:25.332772Z
Flag Description Default
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select the repository when NAME is omitted selection rules
--json Output JSON false

If you pass both NAME and -r, they must name the same repository:

sow repo show demo -r empty
operation rejected: repo show NAME "demo" and --repo "empty" select different repositories

sow repo rm

Removes a repository completely: its sow.yml entry, database, package files in pool/, indexes in dists/, and private state. Without -f, only an empty repository can be removed, one with no Dists, no memberships, and no package objects:

sow repo rm infra
removed repository infra
sow repo rm pgsql
operation rejected: managed: operation rejected: repository "pgsql" is not empty; use --force

sow repo rm pgsql -f
removed repository pgsql
Flag Description Default
-f, --force Remove a non-empty unprotected repository false
-C, --workdir DIR Workspace discovery start directory current directory
-T, --timeout DUR Maximum lock wait; 0 waits indefinitely 0
-N, --no-wait Fail immediately when the lock is held false
--passfile PATH Password file for this invocation per-key config, then SOW_GPG_PASSFILE
--json Output JSON false

Force removal

-f lifts only the emptiness check. It does not override protected.

protected

protected: true in sow.yml blocks repository deletion outright, -f included:

sow repo rm alpha -f
operation rejected: managed: operation rejected: repository "alpha" is protected

To remove a protected repository, set protected: false in sow.yml, run sow config check, and retry. Protection covers repository deletion only; add, rm, build, and dist rm keep working:

sow dist rm el9 -r alpha -f
removed dist el9 from alpha

sow repo migrate

repo migrate brings a repository’s database and layout up to the current schema (v13) and resumes or abandons an unfinished layout transition. Only workspaces from early releases need it; the upgrade guide says which. In 0.9.0, sow status can inspect schema v12 and returns 5 for v8 or v10. sow build exits 6 and requests migration on all three. See Troubleshooting after an upgrade.

  1. Stop all workspace writers.
  2. Back up the whole workspace, preserving hard links.
  3. Migrate each configured repository.
  4. Run build and check for each repository.
rsync -aH /srv/sow/ /srv/sow.backup-before-0.9.0/
sow repo migrate pigsty -C /srv/sow
sow build -r pigsty -C /srv/sow
sow check -r pigsty -C /srv/sow

Repeat the last three commands for each repository. The result reports the layout and schema before and after (schema_from and schema_to in JSON); on a repository that is already current it is a no-op:

sow repo migrate pigsty -C /srv/sow
migrated repository pigsty: single-payload-v1 -> single-payload-v1 schema=13->13 generation=00000000000000000007 phase=done complete=true

Migration also applies the state and publication repairs that older layouts need. After a C2 layout migration, SOW binds the migration anchor to the newly migrated Generation, so later build, add, check, gc, and repo rm commands do not report an anchor mismatch. To return to a release that uses an older schema, restore the backup.

If a completed migration leaves stage files whose ownership SOW cannot prove, it keeps them under .sow/<repo>/abandoned/ and reports the path. Rerun sow repo migrate NAME to clear that state and unblock local GC, and inspect the retained files before you delete them.

Flag Description Default
-j, --jobs N Parallel verification/render workers logical CPUs
--abort Abandon a maintenance attempt before its commit decision false
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select the repository when NAME is omitted selection rules
-T, --timeout DUR Maximum lock wait; 0 waits indefinitely 0
-N, --no-wait Fail immediately when the lock is held false
--passfile PATH Password file for this invocation per-key config, then SOW_GPG_PASSFILE
--json Output JSON false

Abandon a transition with –abort

--abort abandons an unfinished layout plan before its commit decision; once commit intent is recorded, only forward recovery is possible. It never undoes a completed schema migration, and the public tree stays unchanged. Without a resumable transition it fails with exit 6.

  • For an earlier C2 transition, SOW checks the repository identity and the journal and database control records that exist. Conflicting records stop the abort, and a journal-bound plan also needs its recorded base manifest.
  • An abort can complete before the first journal or base manifest was written, as long as the trusted transition marker exists. SOW keeps that marker so a later sow repo migrate NAME can plan and resume the transition.
  • A non-empty temporary stage is moved intact into .sow/<repo>/abandoned/. Retained paths and cleanup problems are printed to stderr and listed in JSON warnings; a cleanup warning does not prevent the abort. Inspect the reported paths before removing anything.

A fresh development-era C2 repository cannot start a migration. If a previous abort removed the trusted marker, restore a complete matching backup or import the original packages into a new workspace.

Exit codes

Code Trigger
0 Listed, created, shown, migrated, abandoned a pre-commit transition, or removed; or repo new reported an existing repository
1 Runtime I/O error creating or removing the tree
2 Usage error (including -r on repo ls, repo new, or repo rm), workspace not found, or an ambiguous repository selection
4 Workspace lock held and --no-wait given or --timeout expired
5 Integrity or recovery error in the workspace journal
6 Invalid or reserved name, unknown repository, non-empty without -f, protected, NAME conflicting with -r, migration required before a write, or --abort with nothing to abandon

See also

6 - sow dist

Create, list, inspect, and remove Dists, the RPM or DEB package sets that clients install from.

A Dist is the package set that clients see as one distribution, such as el9 or trixie. It is either RPM or DEB, has its own architecture views, policy (limit, exclude), and indexes under dists/, and shares the pool/ of its standard repository with the other Dists. sow dist creates, lists, inspects, and removes Dists. To change a Dist’s architectures or policy, edit sow.yml, then run sow config check and sow build.

Synopsis

sow dist ls [-C DIR] [-r NAME] [--json]
sow dist new NAME --format rpm|deb [-C DIR] [-r NAME] [-T DUR | -N] [--json] [--passfile PATH]
sow dist show NAME [-C DIR] [-r NAME] [--json]
sow dist rm NAME [-f|--force] [-C DIR] [-r NAME] [-T DUR | -N] [--json] [--passfile PATH]

dist new and dist rm accept --passfile for signing checks, signing, or recovery of an interrupted operation. dist ls and dist show do not read password files.

Examples

Create an RPM Dist and a DEB Dist in one repository:

sow dist new el9 --format rpm -r pgsql
sow dist new trixie --format deb -r pgsql

Create a beta Dist, set its package-retention policy in sow.yml, then rebuild it:

sow dist new el9-beta --format rpm -r pgsql
$EDITOR sow.yml          # el9-beta: { limit: 0 }
sow config check
sow build -r pgsql -d el9-beta

List Dists that need a build:

sow dist ls -r pgsql --json | jq -r '.result.dists[] | select(.dirty) | .name'

Naming

Dist names follow the repository rule: [a-z0-9][a-z0-9._-]*, excluding ., .., .sow, pool, and dists. Choose names that identify your distributions or channels, such as el9, trixie, or el9-beta; SOW infers neither format nor policy from the name.

sow dist ls

Lists the selected repository’s Dists. Read-only.

sow dist ls -r pigsty
NAME	FORMAT	ARCHITECTURES	DESIRED	BUILT	GENERATION	DIRTY	DIRTY_REASONS
el9	rpm	x86_64,aarch64	0	0	1	false	[]
trixie	deb	x86_64,aarch64	0	0	2	false	[]

DESIRED and BUILT count memberships. When the desired state has moved ahead of the last build, DIRTY_REASONS says why:

sow dist ls -r demo
NAME	FORMAT	ARCHITECTURES	DESIRED	BUILT	GENERATION	DIRTY	DIRTY_REASONS
el9	rpm	x86_64,aarch64	2	1	4	true	["Desired and Built membership sets differ"]

Pending repository maintenance can also make a Dist dirty while the counts match, so read dirty_reasons and sow status before treating a Dist as ready to deliver.

Flag Description Default
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
--json Output JSON false

The table shows architecture families; JSON adds each package ecosystem’s own name. This architectures field from one entry in result.dists belongs to a DEB Dist, whose view directories are binary-amd64 and binary-arm64:

{
  "architectures": [
    {"family": "x86_64", "ecosystem_arch": "amd64"},
    {"family": "aarch64", "ecosystem_arch": "arm64"}
  ]
}

sow dist new

Creates a Dist with --format rpm or --format deb:

sow dist new el9 --format rpm -r pigsty
created el9: format=rpm architectures=x86_64,aarch64 members=0/0 generation=1 dirty=false
sow dist new trixie --format deb -r pigsty
created trixie: format=deb architectures=x86_64,aarch64 members=0/0 generation=2 dirty=false
Flag Description Default
--format FORMAT Required; rpm or deb —
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
-T, --timeout DUR Maximum lock wait; 0 waits indefinitely 0
-N, --no-wait Fail immediately when the lock is held false
--passfile PATH Password file for this invocation per-key config, then SOW_GPG_PASSFILE
--json Output JSON false

A new Dist inherits the workspace architectures. To use a subset, or to set limit and exclude, edit sow.yml, then run sow config check and sow build.

Running dist new again with the same name and format prints the current state. The same name with a different format is rejected:

sow dist new el9 --format deb -r alpha
operation rejected: managed: operation rejected: dist "el9" already exists with format rpm

--format is required and accepts only rpm or deb:

sow dist new x -r alpha
usage error: dist new requires --format rpm|deb

sow dist new x --format zip -r alpha
usage error: --format must be rpm or deb

Creation and recovery

dist new updates sow.yml and builds the new Dist in one operation, so the Dist has valid empty indexes from the start: an empty repodata/ in each RPM architecture view, or empty Packages and Packages.gz, by-hash/SHA256/ entries, and a Release file for DEB, plus InRelease and Release.gpg when signing is configured. If the command is interrupted, run sow build to recover the operation.

sow dist show

Shows one Dist in detail. Read-only.

sow dist show trixielim -r pgsql
dist trixielim:
  format: deb
  architectures: x86_64,aarch64
  desired_members: 3
  built_members: 3
  generation: 6
  status: clean
  dirty: false
  dirty_reasons: []
Flag Description Default
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
--json Output JSON false

JSON adds effective_config_sha256, a digest of the resolved Dist configuration. Changing limit, exclude, or a signing key changes the digest, and SOW marks the Dist dirty until you rebuild it.

sow dist show el9 -r pgsql --json
{"schema":"sow.cli/v1","command":"dist show","ok":true,"repository":"pgsql","operation":null,"result":{"name":"el9","format":"rpm","architectures":[{"family":"x86_64","ecosystem_arch":"x86_64"},{"family":"aarch64","ecosystem_arch":"aarch64"}],"desired_members":0,"built_members":0,"generation":"00000000000000000001","dirty":false,"status":"clean","effective_config_sha256":"a0b3ae2f943bc4fce951aaadda0fc8fb146ccf7944b0193a0dcc2b86ddc7ce7e","config":{"format":"rpm","architectures":["x86_64","aarch64"],"limit":1,"exclude":[{"kind":["debuginfo","debugsource"]}]}},"errors":[]}
sow dist show nope -r demo
operation rejected: managed: operation rejected: dist "nope" does not exist

sow dist rm

Removes a Dist’s configuration, membership, and indexes. A Dist that still has members needs -f:

sow dist rm el9 -r pgsql
operation rejected: managed: operation rejected: dist "el9" is not empty; use --force

sow dist rm el9 -r pgsql -f
removed dist el9 from pgsql
Flag Description Default
-f, --force Remove membership and indexes but retain pool packages false
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
-T, --timeout DUR Maximum lock wait; 0 waits indefinitely 0
-N, --no-wait Fail immediately when the lock is held false
--passfile PATH Password file for this invocation per-key config, then SOW_GPG_PASSFILE
--json Output JSON false

If a configured target has published this Dist, the removal is rejected; see Removing a published view. A repository’s protected: true blocks only repository deletion, so dist rm works on protected repositories.

Dist removal does not delete Pool bytes

Other Dists and retained Generations may still use the same package files, so dist rm leaves pool/ alone:

sow dist rm el9 -r pgsql -f
removed dist el9 from pgsql

find pgsql -type f
pgsql/pool/e/epel-release/epel-release-7-5.noarch.rpm

Run sow gc to reclaim package files once no current or retained state needs them.

Exit codes

Code Trigger
0 Listed, created, shown or removed; or dist new reported an existing Dist
1 Runtime I/O or renderer error creating the empty indexes
2 Usage error — missing or invalid --format, workspace not found, ambiguous repository
4 Workspace or repository lock held and --no-wait given or --timeout expired
5 Integrity or recovery error in the operation journal
6 Invalid name, unknown Dist, format conflict with an existing name, non-empty without -f, or a Dist that a configured target has published

See also

7 - sow add

Add RPM and DEB packages to Dists: options, per-item results, policy outcomes, partial batches, and exit codes.

sow add is how packages enter a standard repository. It reads each file’s format and architecture from the package header, stores the file once in the repository’s pool, adds it to the selected Dists’ desired membership, applies each Dist’s exclude and limit policy, and then builds those Dists’ local indexes. Use --skip to import several batches and build once at the end, and run sow publish afterwards to update a remote target. To index a directory of packages in place, without a workspace, use sow create.

Synopsis

sow add PATH... [-R|--recursive] [--skip] [-j|--jobs N] [-C|--workdir DIR] [-r|--repo NAME] [-d|--dist NAME]... [-T|--timeout DUR | -N|--no-wait] [--json] [--passfile PATH]

PATH is an RPM or DEB file or a directory. RPM package signing happens during import, so --skip does not avoid it; signing may still need a password file.

Options

Flag Description Default
-R, --recursive Descend into subdirectories of a PATH directory off (top level only)
--skip Update the desired state only; do not build off
-j, --jobs N Parallel workers for parsing, hashing and rendering logical CPU count
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
-d, --dist NAME Select a distribution; repeatable selection rules
-T, --timeout DUR Maximum lock wait; 0 waits indefinitely 0
-N, --no-wait Fail immediately when the lock is held false
--passfile PATH Password file for this invocation per-key config, then SOW_GPG_PASSFILE
--json Output JSON false

Examples

Add two RPMs to el9:

sow add /srv/pkg/centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm /srv/pkg/epel-release-7-5.noarch.rpm -r pigsty -d el9
add repository=pigsty operation=8677129233475584643 accepted=2 failed=0 memberships=+2/-0 revision=3 generation=3 dirty=false
item input="/srv/pkg/centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm" status=accepted format=rpm coordinate="centos-release-0:7-2.1511.el7.centos.2.10.x86_64" sha256:b4111ef2a51542eacc9bd1ebd080da02e53d400f9d172530c75a1e4ac06e7ead dists=el9:accepted
item input="/srv/pkg/epel-release-7-5.noarch.rpm" status=accepted format=rpm coordinate="epel-release-0:7-5.noarch" sha256:d6f332ed157de1d42058ec785b392a1cc4b5836c27830af8fbf083cce29ef0ab dists=el9:accepted

The summary line gives the operation ID, how many inputs entered at least one Dist (accepted) or failed, the membership change, the new desired-state revision and built generation, and whether the repository is still dirty. One item line per input follows, in stable order.

Import a directory tree in one go and build once:

sow add /srv/build/ -R -r pgsql -d el9 --skip
sow status -r pgsql
sow build -r pgsql -j 12
sow check -r pgsql

Inputs and targets

PATH directories are scanned at the top level only unless you pass -R. A recursive scan ignores unreadable non-package files and follows symlinks that you name explicitly or that point to packages.

Select one repository and one or more Dists with -r and -d, or let the directory-based defaults choose. In a mixed RPM/DEB batch, each package goes only to the selected Dists of its own format, and a package with no Dist of its format fails. SOW checks format and architecture but not operating-system or dependency compatibility, so choose Dists that match the distribution the package was built for.

Item statuses

Each item line has an overall status and a per-Dist verdict in dists=.

Status Meaning
accepted New package object created and at least one membership added
reused The content already exists in this repository; only membership references may change
excluded Policy removed it from every target Dist — see the dists= field for excluded vs limited
failed The package was rejected; the error= field says why

reused means content idempotence: adding the same file twice never creates a second object or a duplicate membership, and adding it to a second Dist only adds a membership to the one pool copy. A repeated add still builds the selected Dists. If they are current, the Generation stays the same; if an earlier --skip or a configuration edit left them dirty, the build runs and may advance the Generation:

sow add /srv/pkg/epel-release-7-5.noarch.rpm -r pigsty -d el9
add repository=pigsty operation=656950149626836753 accepted=1 failed=0 memberships=+0/-0 revision=4 generation=4 dirty=false
item input="/srv/pkg/epel-release-7-5.noarch.rpm" status=reused format=rpm coordinate="epel-release-0:7-5.noarch" sha256:d6f332ed157de1d42058ec785b392a1cc4b5836c27830af8fbf083cce29ef0ab dists=el9:accepted

Policy: exclude and limit

After merging the new packages into each target Dist, SOW evaluates exclude and then limit over the Dist’s complete candidate set, not just this batch. A package that policy removes is reported, not treated as a failure. RPM version order follows RPM rules, including caret snapshot versions such as 2.0^20250611 < 2.0.1.

sow add /srv/pkg/debs -r pgsql -d trixielim
add repository=pgsql operation=4142220455201181493 accepted=3 failed=0 memberships=+3/-0 revision=6 generation=6 dirty=false
item input="/srv/pkg/debs/libpq5-dbgsym_18.3-1_amd64.deb" status=excluded format=deb coordinate="libpq5-dbgsym=18.3-1:amd64" sha256:cf491b9d9b218fa49ad2b41b4740d62cd972e1b515bf33677c2c3ead75acc60a dists=trixielim:excluded
item input="/srv/pkg/debs/libpq5_18.2-1_amd64.deb" status=excluded format=deb coordinate="libpq5=18.2-1:amd64" sha256:fa84dc641b7c686be2f9b512311ad0b74eac03e2afc9eff7e9af75b82b68ff41 dists=trixielim:limited
item input="/srv/pkg/debs/libpq5_18.3-1_amd64.deb" status=reused format=deb coordinate="libpq5=18.3-1:amd64" sha256:491992c502113627d44d0d66a2b189cdaa8accff293ebaf84fe10ccbc9da574c dists=trixielim:accepted
item input="/srv/pkg/debs/libpq5_18.3-1_arm64.deb" status=reused format=deb coordinate="libpq5=18.3-1:arm64" sha256:3a2f7ef7cddfa3dc06280ef59eda1dab9724d57499931ee80758b11531c1f40c dists=trixielim:accepted
item input="/srv/pkg/debs/pg-sample_1.17-1_all.deb" status=reused format=deb coordinate="pg-sample=1.17-1:all" sha256:f23581c5164a143e5e902232589adf1d30b73ba3857a692a11da607f246aacc3 dists=trixielim:accepted

Here trixielim has exclude: [{kind: [dbgsym]}] and limit: 1. The dbgsym package matched the exclusion rule, and libpq5 18.2-1 lost to 18.3-1 under the version limit. Both show status=excluded; the dists= verdict (excluded or limited) tells them apart.

limit groups by binary name and canonical architecture, so 18.3-1:amd64 and 18.3-1:arm64 both survive limit: 1. One package can be accepted by one Dist and dropped by another in the same run. Policy applies to desired membership, not to files left in pool/: to bring back a package after relaxing exclude or limit, run sow add for it again.

–skip

--skip commits the change to the desired state and leaves pool/, dists/, and the current Generation alone. New package files wait in private pending storage until a build needs them. The repository becomes dirty when the desired state now differs from the built state; re-adding an unchanged member can leave it clean.

sow add /srv/pkg/tree -R --skip -r pgsql -d trixie
add repository=pgsql operation=8405631664133415270 accepted=6 failed=0 memberships=+4/-0 revision=4 generation=3 dirty=true
sow status -r pgsql
repository=pgsql status=dirty ready_to_copy=false revision=4 generation=3 dirty_dists=trixie pending=4/2326 locked=false

pending=4/2326 means four objects, 2326 bytes in total, are waiting in the private store. They never appear in sow changes; only a successful build moves them into the deliverable tree.

Package architecture

add takes format and native architecture from the package header and checks them against the workspace architecture list. A package with an unknown architecture, or one outside the list, is rejected:

sow add /srv/pkg/centos-release-3.1-1.i386.rpm -r pigsty -d el9
add repository=pigsty operation=2298405058049158821 accepted=0 failed=1 memberships=+0/-0 revision=1 generation=3 dirty=false
item input="/srv/pkg/centos-release-3.1-1.i386.rpm" status=failed error="managed: operation rejected: unknown rpm package architecture \"i386\"; supported rpm package architectures are [x86_64, aarch64, noarch] (canonical families [x86_64, aarch64, neutral]); use a supported package or update only supported architecture families in sow.yml"
operation rejected: managed: operation rejected: no input package was accepted

RPM noarch and DEB all packages are architecture-neutral. Each creates one package object and one membership and appears in every effective architecture view of the target Dist, but only in the Dists you selected.

Partial batches

Valid, conflict-free packages are committed even when other inputs in the same batch fail. Each failed input keeps its own error, and the command exits 3:

sow add /srv/pkg/centos-release-3.1-1.i386.rpm /srv/pkg/centos-release-6-0.el6.centos.5.x86_64.rpm -r pigsty -d el9
add repository=pigsty operation=4623871845694427260 accepted=1 failed=1 memberships=+1/-0 revision=5 generation=5 dirty=false
item input="/srv/pkg/centos-release-3.1-1.i386.rpm" status=failed error="managed: operation rejected: unknown rpm package architecture \"i386\"; ..."
item input="/srv/pkg/centos-release-6-0.el6.centos.5.x86_64.rpm" status=accepted format=rpm coordinate="centos-release-0:6-0.el6.centos.5.x86_64" sha256:ffd9e7bdaa4884831a6c055ada01dac96b84c50a8d518dac409b445af5dadc16 dists=el9:accepted
managed: batch partially succeeded

If every input fails, as in the architecture example above, the command exits 6 and leaves desired membership and public content unchanged; text output still lists each failed input with its reason, and JSON lists them in result.items. Policy-excluded inputs are not failures, so a batch that policy excludes entirely still succeeds, even on an empty Dist.

If you interrupt add with SIGINT or SIGTERM, it exits 130. Rerun it with the same input files; recovery keeps the membership changes that were already committed.

A pool path, once published, stays reserved even after local GC, so changed package content needs a new version and file name. An input whose path conflicts is rejected while the other valid inputs can still succeed. Keep file name capitalization consistent when adding a package again: paths that differ only by case conflict, and on a case-insensitive filesystem source-package directory names must also be distinct; see Workspace filesystem.

Processing order

SOW inspects the packages and signs new RPMs when configured, applies exclude and limit, records the resulting membership, and then builds unless --skip is set. Input files are never modified; signing works on private copies.

RPM signing modes

RPM package signing for a standard repository is set in sow.yml under signing.rpm.packages.mode; there is no command-line override.

Mode Behavior
never Keep the input bytes exactly
fill Sign when unsigned or when the signature is not trusted; keep bytes when a trusted_keys signature verifies. Default when a key is configured
always Ensure the final package is validly signed by the configured key; re-sign a stage copy otherwise

Without a configured key only never is available. Signature verification supports RPM v4 and v6, including native RPMSIGTAG_OPENPGP tag 278 (dual- and multi-signed RPMs included) and RSA, DSA, ECDSA, and EdDSA (Ed25519) OpenPGP packets in header signature tag 267 (RPMSIGTAG_DSA).

A repeated import reuses identical package content. It can also reuse an RPM that differs only in its signature, if the stored package satisfies the current signing policy. A changed payload or an incompatible stored signature is a coordinate conflict. Signing Model explains the matching rules.

Exit codes

Code Trigger
0 Inputs processed, including policy-excluded inputs; build completed or skipped
1 Runtime I/O, parser, renderer or signing failure
2 Usage error, workspace not found, or ambiguous repository/Dist selection
3 Partial batch — at least one item committed and at least one failed
4 Repository lock held and --no-wait given or --timeout expired
5 Integrity or recovery error, including a build that failed after applied
6 Every input failed, or selection/signing/state preconditions reject the operation
130 Interrupted by SIGINT or SIGTERM; rerun with the same inputs

See also

8 - sow rm

Remove packages from Dists, preview the exact file changes first, or stage removals for one later build.

sow rm takes packages out of the selected Dists’ desired membership and rebuilds those Dists' local indexes. Use it to withdraw a broken or unwanted package; preview the result with --check, or stage several removals with --skip and build once. The package files stay in pool/, because other Dists or retained Generations may still use them, until sow gc can reclaim them. To drop a whole Dist, use sow dist rm.

Synopsis

sow rm PACKAGE... [-c|--check] [--skip] [-j|--jobs N] [-C|--workdir DIR] [-r|--repo NAME] [-d|--dist NAME]... [-T|--timeout DUR | -N|--no-wait] [--json] [--passfile PATH]

PACKAGE is a package name, coordinate, file name, or sha256: reference; see Package references. A --check preview can render signed metadata, so it also accepts --passfile.

Options

Flag Description Default
-c, --check Preview only; compute and print the plan without writing anything off
--skip Update the desired state only; do not build off
-j, --jobs N Parallel workers logical CPU count
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
-d, --dist NAME Select a distribution; repeatable selection rules
-T, --timeout DUR Maximum lock wait; 0 waits indefinitely 0
-N, --no-wait Fail immediately when the lock is held false
--passfile PATH Password file for this invocation per-key config, then SOW_GPG_PASSFILE
--json Output JSON false

--check and --skip are mutually exclusive, and --check takes no lock options:

sow rm epel-release -c --skip
usage error: --check and --skip are mutually exclusive

sow rm centos-release -r pigsty -d el9 -c -T 5s
usage error: rm --check does not accept --timeout or --no-wait

Examples

Preview a removal, then apply it:

sow rm patroni -r pgsql -d el9 -c
sow rm patroni -r pgsql -d el9

Remove one exact object from two Dists:

sow rm sha256:d6f332ed157de1d42058ec785b392a1cc4b5836c27830af8fbf083cce29ef0ab -r pgsql -d el9 -d el9-beta

Stage several removals, then build once:

sow rm old-tool legacy-agent -r pgsql -d el9 --skip
sow build -r pgsql -d el9
sow check -r pgsql

Feed the preview plan to another tool:

sow rm patroni -r pgsql -d el9 -c --json | jq -r '.result.changes[] | "\(.phase)\t\(.op)\t\(.path)"'

Package references

PACKAGE accepts five forms. Package References has the full grammar and disambiguation rules.

Form Example
Content hash sha256:d6f332ed157de1d42058ec785b392a1cc4b5836c27830af8fbf083cce29ef0ab
RPM coordinate rpm:epel-release-0:7-5.noarch
DEB coordinate deb:libpq5=18.3-1:amd64
Full filename epel-release-7-5.noarch.rpm
Bare binary name epel-release

A bare name matches every version and architecture of that name in the selected Dists; every other form must identify exactly one object, and an ambiguous one fails with the matching candidates. sow ls prints exact sha256: references and canonical coordinates, so you never have to assemble one by hand. A reference that matches nothing fails the whole command:

sow rm nosuch -r pigsty -d el9
operation rejected: managed: operation rejected: package reference not found: package reference "nosuch" matches no Desired Membership

Preview with –check

-c/--check computes the removal and the local file changes it would make, without modifying the repository or touching .sow/<repo>/stage. It validates the candidate configuration and the existing state, and takes shared locks, so it waits for a running writer.

sow rm centos-release -r pigsty -d el9 -c
preview repository=pigsty operation= dists=el9 memberships=2 revision=3 generation=00000000000000000005 dirty=false changes=8
membership dist=el9 name="centos-release" coordinate="rpm:centos-release-0:6-0.el6.centos.5.x86_64" sha256:ffd9e7bdaa4884831a6c055ada01dac96b84c50a8d518dac409b445af5dadc16
membership dist=el9 name="centos-release" coordinate="rpm:centos-release-0:7-2.1511.el7.centos.2.10.x86_64" sha256:b4111ef2a51542eacc9bd1ebd080da02e53d400f9d172530c75a1e4ac06e7ead
change op=add phase=metadata path="dists/el9/x86_64/repodata/47950aa13d195a32d224ff9bc4c21ff9ef17ff7ff0a5df2e5f081b165efcff51-primary.xml.gz" size=800 sha256:47950aa13d195a32d224ff9bc4c21ff9ef17ff7ff0a5df2e5f081b165efcff51
change op=add phase=metadata path="dists/el9/x86_64/repodata/bd11398342b0976d30b04fc6ddc8cefeb95c71d9b54f3c49abec0525aadf8dc2-filelists.xml.gz" size=374 sha256:bd11398342b0976d30b04fc6ddc8cefeb95c71d9b54f3c49abec0525aadf8dc2
change op=add phase=metadata path="dists/el9/x86_64/repodata/e1ad4e4ee9c9d78e7b39c3dd04f6ae5aded0a935d0ed707a090e7b1227871e54-other.xml.gz" size=620 sha256:e1ad4e4ee9c9d78e7b39c3dd04f6ae5aded0a935d0ed707a090e7b1227871e54
change op=update phase=pointer path="dists/el9/aarch64/repodata/repomd.xml" size=1538 sha256:7ef73230d19b3e145e27d04f604e782c904588250d54c1167be32cfb5068c026
change op=update phase=pointer path="dists/el9/x86_64/repodata/repomd.xml" size=1538 sha256:7ef73230d19b3e145e27d04f604e782c904588250d54c1167be32cfb5068c026
change op=delete phase=delete path="dists/el9/x86_64/repodata/2446439ec26f96463b15e8b47796bb0f8b68400f3b129756d37f942f7f81ba70-other.xml.gz"
change op=delete phase=delete path="dists/el9/x86_64/repodata/67c4c4607c8ea8b41365a948f0a437843b2d5217c6eae5cc1e098e5bfc0ae310-filelists.xml.gz"
change op=delete phase=delete path="dists/el9/x86_64/repodata/70643c948cae2d671dc2935692d33c6dc62d8749f2c983fa992a4e1e5e2ab4b6-primary.xml.gz"

The bare name matched both centos-release versions. membership lines list the memberships your references matched; change lines list the expected local file changes in payload → metadata → pointer → delete order. If current policy would drop further members as a result, their index changes appear among the change lines, and their count appears in sow log after the real run. With --json, read the removed[] and changes[] arrays.

The preview predicts membership removals, policy results, file paths, actions, Generation, and revision exactly, provided the references, selected Dists, repository state, configuration, and signing keys do not change before the real run. Index and signature bytes, hashes, and sizes can still differ: the real build records its own publication time, and non-deterministic signature algorithms such as ECDSA and DSA produce new bytes on every signing. Crash recovery reuses the metadata that the real run staged or installed, not the preview’s.

Default behavior: remove and rebuild

Without --check or --skip, rm commits the change to the desired state and rebuilds every affected Dist before it returns:

sow rm 'rpm:centos-release-0:6-0.el6.centos.5.x86_64' -r pigsty -d el9
removed repository=pigsty operation=6815056191216444844 dists=el9 memberships=1 revision=3 generation=00000000000000000005 dirty=false changes=2
membership dist=el9 name="centos-release" coordinate="rpm:centos-release-0:6-0.el6.centos.5.x86_64" sha256:ffd9e7bdaa4884831a6c055ada01dac96b84c50a8d518dac409b445af5dadc16
change op=update phase=pointer path="dists/el9/aarch64/repodata/repomd.xml" size=1538 sha256:3a73bb4d0c1e10a1d5e6cf8d1e33e8407211c4e4f413297ff04db727efcc17cf
change op=update phase=pointer path="dists/el9/x86_64/repodata/repomd.xml" size=1541 sha256:c94ca3b2d93db245a5ba17a32f795293fb6669079075c3a8530580ea0db27aa4

One change line follows the summary for each affected file. Here only the two repomd.xml pointers changed; the checksum-named metadata files they now reference were already in the tree. --json returns the same result in the standard envelope.

Removing the last member of a Dist is fine: SOW still renders a valid empty index, signed if signing is configured, such as an empty Packages with a verifiable InRelease or an empty repodata/ per architecture.

–skip

--skip commits the change to the desired state and leaves the public tree untouched. The repository becomes dirty when the desired state now differs from the built state; removing an addition that was never built can return it to clean without a build.

sow rm 'rpm:centos-release-0:7-2.1511.el7.centos.2.10.x86_64' --skip -r pigsty -d el9
removed repository=pigsty operation=2095701184059097821 dists=el9 memberships=1 revision=4 generation=00000000000000000005 dirty=true changes=0
membership dist=el9 name="centos-release" coordinate="rpm:centos-release-0:7-2.1511.el7.centos.2.10.x86_64" sha256:b4111ef2a51542eacc9bd1ebd080da02e53d400f9d172530c75a1e4ac06e7ead
sow status -r pigsty
repository=pigsty status=dirty ready_to_copy=false revision=4 generation=5 dirty_dists=el9 pending=0/0 locked=false

changes=0 because nothing was built. Run sow build to apply the pending changes.

Policy interaction

Removal does not bring back packages that policy dropped earlier. SOW re-applies policy to the remaining members, so if you remove libpq5 18.3-1 from a limit: 1 Dist, the previously excluded 18.2-1 stays excluded. Run sow add for it to restore it.

Exit codes

Code Trigger
0 Memberships removed and Dists rebuilt, or a --check preview printed
1 Runtime I/O or renderer failure
2 Usage error — --check with --skip, --check with lock flags, ambiguous selection, workspace not found
4 Repository lock held and --no-wait given or --timeout expired
5 Integrity or recovery error
6 A reference matched nothing, or a non-bare reference was ambiguous; SOW rejects the whole batch and removes no memberships

See also

9 - sow ls

List the packages Dists should contain, with exact references and where each one is built.

sow ls lists the packages in the selected Dists’ desired membership and shows, for each one, which Dists want it and which already contain it in the current Generation. Use it to copy exact references for show or rm, or to spot packages that are waiting for a build. To find a package anywhere in the workspace, use sow where.

Synopsis

sow ls [-C|--workdir DIR] [-r|--repo NAME] [-d|--dist NAME]... [--json]
Flag Meaning Default
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
-d, --dist NAME Select a Dist; repeatable selection rules
--json Output JSON false

Output

sow ls -r pigsty -d el9
repository=pigsty dists=el9 dirty=false
SHA256	COORDINATE	DISTS	BUILT_DISTS	POOL_PATH
sha256:d6f332ed157de1d42058ec785b392a1cc4b5836c27830af8fbf083cce29ef0ab	rpm:epel-release-0:7-5.noarch	el9	el9	pool/e/epel-release/epel-release-7-5.noarch.rpm

The first line says whether the selected Dists are dirty; a configuration change can make them dirty even when membership is unchanged. Each package then appears once:

Column Meaning
SHA256 Immutable content identity; valid input to show and rm
COORDINATE Canonical rpm: or deb: package reference
DISTS Desired membership across the repository
BUILT_DISTS Membership present in the current Generation
POOL_PATH Immutable package path, relative to the repository

-d chooses which packages are listed, by desired membership; the DISTS and BUILT_DISTS columns then show every place in the repository that package appears, comma-separated. An empty BUILT_DISTS means no Dist includes the package in its current build yet. A package removed with rm --skip is already gone from this list, even while the last built index still contains it. An empty Dist succeeds with no package rows. With --json, the rows are in result.packages.

Examples

List exact references for all objects not yet built:

sow ls -r pgsql -d el9 --json |
  jq -r '.result.packages[] | select(.built_dists | length == 0) | "sha256:" + .sha256'

List pool paths in deterministic order:

sow ls -r pgsql -d el9 --json | jq -r '.result.packages[].pool_path' | sort

Selection

ls needs a definite set of Dists. In a repository with several Dists, pass one or more -d values or run it from inside <repo>/dists/<dist>/:

sow ls -r pigsty
workspace discovery error: managed: workspace discovery error: repository "pigsty" has multiple Dists (el9, trixie); select one or more with --dist

Exit codes

Code Trigger
0 Membership printed, including an empty list
1 Runtime I/O failure
2 Usage error, workspace not found, or implicit repository/Dist selection is ambiguous
5 Repository state database unreadable or inconsistent
6 Explicit repository or Dist is not configured

See also

10 - sow show

Look up one package: its exact identity, pool path, and which Dists list it.

sow show prints what SOW knows about one package in a repository: its exact coordinate and SHA-256, where its file lives in the pool, and which Dists list it in desired state and in the current build. Use it to turn a name into an exact reference, or to see why a package is or is not in an index. To search every repository at once, use sow where; to list a whole Dist, use sow ls.

Synopsis

sow show PACKAGE [-C|--workdir DIR] [-r|--repo NAME] [-d|--dist NAME]... [--json]

PACKAGE must resolve to exactly one package; see Package reference.

Flag Meaning Default
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Repository to search selection rules
-d, --dist NAME Only consider desired members of this Dist; repeatable whole repository
--json Print the complete package record false

Without -d, the lookup also finds stored packages that no Dist lists any more, which is how you inspect a package after removing it everywhere. With -d, a candidate must be a desired member of a selected Dist.

Output

sow show centos-release-6-0.el6.centos.5.x86_64.rpm -r demo -d el9
package repository=demo coordinate="centos-release-0:6-0.el6.centos.5.x86_64" sha256:ffd9e7bdaa4884831a6c055ada01dac96b84c50a8d518dac409b445af5dadc16 format=rpm architecture=x86_64 size=19776 storage=pool
pool=pool/c/centos-release/centos-release-6-0.el6.centos.5.x86_64.rpm
dists=el9 built_dists=el9

The lines give the identity, the pool path, and the Dists that list the package in desired state (dists) and in the current Generation (built_dists). Both lists cover the whole repository, even when -d narrowed the lookup.

--json returns the complete package record under result.package in the standard envelope. Besides the header fields, it carries these normalized fields:

Field Meaning
canonical_arch x86_64, aarch64, or neutral for RPM noarch / DEB all
kind Policy class: main, debuginfo, debugsource, llvmjit, dbgsym, or dbg
source Normalized source-package name
payload_sha256 RPM digest that ignores the signature, so re-signing the same package is idempotent
signature_key Key ID of the embedded package signature, when present: RPM v6 native RPMSIGTAG_OPENPGP (tag 278), RSA/DSA/ECDSA/EdDSA in tag 267, or legacy PGP tags
storage pending before the package has been built; pool once it is in the local package pool
dists / built_dists Desired and current built membership

Package reference

PACKAGE accepts a sha256:<hex> content identity, a canonical rpm:<NEVRA> or deb:<name>=<version>:<arch> coordinate, a full package filename, or a bare binary name. See Package References for the exact grammar.

A bare name must match exactly one package in the selected scope. sow rm foo removes every matching version, but show describes one object, so it refuses an ambiguous name and lists the candidates:

sow show libpq5 -r pgsql -d trixie
operation rejected: managed: operation rejected: package reference "libpq5" is ambiguous: deb:libpq5=18.2-1:amd64 sha256:fa84dc64..., deb:libpq5=18.3-1:amd64 sha256:491992c5..., deb:libpq5=18.3-1:arm64 sha256:3a2f7ef7...

Copy an exact coordinate or SHA-256 from the error or from sow ls and retry.

Exit codes

Code Trigger
0 One package printed
1 Runtime I/O failure
2 Usage error, workspace not found, or implicit repository selection is ambiguous
5 Repository state database unreadable or inconsistent
6 Explicit repository or Dist is not configured, or the reference matched nothing or several packages

See also

  • sow ls — exact identities of every member of a Dist
  • sow where — search across repositories
  • sow rm — remove matching desired membership
  • JSON Output — complete result schema

11 - sow where

Find which repositories and Dists include a package across the whole workspace.

sow where answers “which repositories and Dists carry this package?” for the whole workspace. Use it before you remove or replace a package that several repositories share, or to confirm that an add landed where you expected. Unlike sow show, it searches every repository by default and reports locations instead of the full package record.

Synopsis

sow where PACKAGE [-C|--workdir DIR] [-r|--repo NAME] [-d|--dist NAME]... [--json]
Flag Meaning Default
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Search only this repository all repositories
-d, --dist NAME Search only these Dists; repeatable all Dists
--json Output JSON false

Output

The first line echoes the reference and the number of locations; each further line is one repository that contains the package:

sow where 'rpm:centos-release-0:6-0.el6.centos.5.x86_64'
reference="rpm:centos-release-0:6-0.el6.centos.5.x86_64" locations=1
repository=demo coordinate="rpm:centos-release-0:6-0.el6.centos.5.x86_64" sha256:ffd9e7bdaa4884831a6c055ada01dac96b84c50a8d518dac409b445af5dadc16 dists=el9 built_dists=el9

dists lists the Dists of that repository that include the package in desired state; built_dists lists those whose current build includes it.

With --json, the locations are in result.locations. The top-level repository field is the repository named by -r, or null when the search spans the workspace. To list every repository/dists pair in a script:

sow where 'rpm:patroni-0:3.0.4-1.noarch' --json |
  jq -r '.result.locations[] | "\(.repository)/\(.dists | join(","))"'

Reference resolution

PACKAGE uses the same grammar as sow show: SHA-256 identity, canonical RPM/DEB coordinate, full filename, or bare name.

The reference must identify one package, meaning the same format, coordinate, and SHA-256. That one package may sit in several repositories. If the name matches different packages, narrow the search with -r or -d, or pass an exact coordinate or SHA-256.

where finds candidates through desired membership. A package removed from every selected Dist is not found, even if an older build still lists it. To inspect such a stored package, run sow show PACKAGE -r NAME without -d. A reference that matches nothing is rejected:

sow where nosuchpkg
operation rejected: managed: operation rejected: package reference "nosuchpkg" was not found in the selected Workspace scope

Exit codes

Code Trigger
0 One package and its locations printed
1 Runtime I/O failure
2 Usage error or workspace not found
5 A repository state database is unreadable or inconsistent
6 Explicit repository or Dist is not configured, or the reference matched nothing or was ambiguous

See also

12 - sow status

Check from recorded state whether a repository needs a build, holds pending data, or is locked.

sow status tells you whether a repository needs a build, how much data waits in the pending area, and whether a writer holds the lock. It reads only recorded state and never hashes package files, so it is cheap enough to run before every build or from a monitoring loop. To verify the files themselves, use sow check.

Synopsis

sow status [-C|--workdir DIR] [-r|--repo NAME] [-d|--dist NAME]... [--json]
Flag Meaning Default
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
-d, --dist NAME Report dirty and readiness state for these Dists only; repeatable all Dists
--json Output JSON false

Output

After an add --skip, the repository has a change that is not built yet:

sow status
repository=demo status=dirty ready_to_copy=false revision=2 generation=3 dirty_dists=el9 pending=1/23516 locked=false
Field Meaning
status Repository state; see repository states
ready_to_copy true when the recorded state is deliverable; check still has to verify the files
revision Desired revision, which increases with every change to desired state
generation Current Generation (the last completed build)
dirty_dists Dists whose desired and built state differ; empty when clean
pending Count and bytes of packages waiting in the private pending area
locked Whether a writer holds the repository lock

--json adds dirty_reasons, which explains a false ready_to_copy, and the most recent operation. The result object for the same state:

{
  "repository": "demo",
  "status": "dirty",
  "ready_to_copy": false,
  "desired_revision": 2,
  "built_generation": "00000000000000000003",
  "dirty_dists": ["el9"],
  "dirty_reasons": [
    "dist el9 Desired and Built membership sets differ",
    "one or more dists differ from their built projections"
  ],
  "pending": {"count": 1, "bytes": 23516},
  "recent_operation": {
    "id": "8690093128362517253",
    "kind": "add",
    "state": "done_dirty",
    "created_at": "2026-11-27T08:36:31.271314Z",
    "updated_at": "2026-11-27T08:36:31.561629Z"
  },
  "repository_locked": false
}

Repository states

SOW records the package set you asked for as desired state, and each completed build as a Generation whose contents are the built state. status compares the two:

State Meaning Next step
clean Desired state matches built state Run check before copying the repository
dirty Desired and built state differ, commonly after --skip or a config change Run build to apply the changes
recovering A local repository operation was interrupted Run build to recover it
error State, files, or recovery records need attention Read dirty_reasons, then run check and log

Exit behavior

status exits 0 for every readable state, including dirty, recovering, and error. Scripts should read the reported state rather than treat those conditions as command failures.

Code Trigger
0 Repository state is readable
1 Runtime I/O failure
2 Usage error, workspace not found, or implicit repository selection is ambiguous
5 State database unreadable or inconsistent
6 Explicit repository or Dist is not configured

Details

Unfinished operations

An unfinished maintenance operation makes the affected Dists dirty even when their desired and built membership match; dist ls and dist show report the same condition. Read dirty_reasons and the pending operation, then run the recovery command it names. SOW finds the unfinished operation by its pending state, not by timestamp order, so a clock step cannot hide it behind an older completed record.

Reading older workspaces

status never migrates or repairs state. It reads database schemas v6, v12, and the current v13; unsupported or unreadable state exits 5. Before writing to an older workspace, back it up and run sow repo migrate for each repository.

See also

13 - 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

14 - sow check

Verify package bytes, indexes, signatures, and state before you deliver a repository.

sow check is the gate before you copy or publish a standard repository. It hashes every package file again, verifies every declared signature, confirms that each index matches the membership it claims, and compares the current Generation’s manifest with the files on disk. It is read-only and reports ready_to_copy for the scope you checked. Before delivering a whole repository, run sow check -r REPO without -d. For a quick state query that skips package hashing, use sow status.

Synopsis

sow check [-j|--jobs N] [-C|--workdir DIR] [-r|--repo NAME] [-d|--dist NAME]... [--json]
Flag Meaning Default
-j, --jobs N Parallel verification 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 Check membership and indexes for these Dists; repeatable all Dists
--json Output JSON false

With -d, a clean Dist can return 0 and ready_to_copy=true while another Dist is dirty. The database, public tree permissions, and current Generation manifest still receive repository-wide checks.

Output

The first line summarizes the repository state as status does; each further line is one verification layer:

sow check
repository=pigsty status=clean ready_to_copy=true revision=5 generation=5
config	ok=true	checked=5
state	ok=true	checked=1
public-modes	ok=true	checked=67
retained	ok=true	checked=0
package-bytes	ok=true	checked=8
desired-membership	ok=true	checked=8
index	ok=true	checked=2
signature	ok=true	checked=9
generation-manifest	ok=true	checked=1

Verification layers

Layer Verification checked counts
config sow.yml parses and validates for the repository configuration objects
state SQLite quick_check, foreign keys, journal, and recovery evidence one state database
public-modes File and directory permissions across the served tree inspected paths
retained Retained records and their saved Generation manifests retained records
package-bytes SHA-256 of pool and private pending payloads packages
desired-membership Membership rows resolve under current policy memberships
index Rendered indexes match the membership they claim Dists
signature Every declared metadata and package signature verifies signatures
generation-manifest The current Generation manifest matches the files on disk one manifest

If a retained record is damaged, the retained layer names the Generation; see retain rm for how to discard it.

Dirty is not deliverable

A dirty repository fails an unscoped check even when every file is intact. This includes one whose limit or exclude policy in sow.yml changed since the last build. The last Generation and the new desired state can each be internally consistent, but they differ, so the tree on disk is not what you asked for:

sow check
repository=pigsty status=dirty ready_to_copy=false revision=6 generation=5
...
integrity or recovery error: managed: repository is not ready to copy: repository status is dirty

The exit code is 5. Run sow build, then run sow check again.

Details

Package verification

Every run hashes the package files again; checked counts packages, not file reads, and hard links to the same physical file share one hash. Signed RPMs are also signature-verified, including RPM v6 native RPMSIGTAG_OPENPGP (tag 278, with dual- and multi-signed RPMs) and RSA, DSA, ECDSA, and EdDSA packets in header signature tag 267 (RPMSIGTAG_DSA). When copying broke the hard links of APT by-hash files, check verifies them by content digest instead. .DS_Store files under .sow/ are tolerated.

Unfinished layout migration

During an unfinished layout migration, check reports config, state, public-modes, and layout-transition, then stops. Follow the reported repo migrate instruction to complete or abort the migration.

Exit codes

Code Trigger
0 Every layer passes and the selected scope is ready to copy
1 I/O failure during verification
2 Usage error, workspace not found, or implicit repository selection is ambiguous
5 A verification layer failed, or the repository is not deliverable
6 Explicit repository or Dist is not configured

See also

15 - sow changes

List the files that differ between two Generations, in the order a safe update applies them.

sow changes lists the files that differ between two Generations, grouped by phase in the order a safe update applies them: packages, then metadata, then entry points, then deletions. Use it to review what a build changed before you publish, to drive your own sync script, or with base 0 to get a complete delivery manifest. It reads built state only, so run sow build first if pending changes should be included. To deliver the result to a configured target, use sow publish, which applies the same phases for you.

Synopsis

sow changes [BASE_GENERATION] [-C|--workdir DIR] [-r|--repo NAME] [--json]
Flag Meaning Default
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
--json Output JSON false

BASE_GENERATION defaults to the predecessor of the current Generation; see Base Generation. The plan always covers the whole repository, so -d/--dist is rejected.

Before it lists anything, changes runs the full sow check verification on every Dist of the repository, using all CPUs (there is no -j). It costs as much as a check, since it hashes every package file again, and it exits 5 instead of printing a plan when any verification layer fails. Unbuilt desired changes do not count as a failure; see Dirty and recovery states.

Output

sow changes
base=4 generation=5 dirty=false
add	payload	pool/c/centos-release/centos-release-6-0.el6.centos.5.x86_64.rpm	19776	ffd9e7bd...
add	metadata	dists/el9/x86_64/repodata/5bc463cb...-primary.xml.gz	1460	5bc463cb...
update	pointer	dists/el9/x86_64/repodata/repomd.xml	1514	05d3d5bf...
delete	delete	dists/el9/x86_64/repodata/0df96f0b...-primary.xml.gz	0	

The header names both Generations. Each following line has five tab-separated columns: operation, phase, path relative to the repository root, size, and SHA-256.

Field Values
operation add, update, delete
phase payload, metadata, pointer, delete

To deliver a plan without SOW’s publisher, copy the files phase by phase in that order, or stage a complete copy and switch it into service.

Base Generation

BASE_GENERATION is a decimal integer in 0..current, where current is the number of the current Generation.

  • Base 0 lists every file of the current Generation as an addition: the complete delivery manifest, excluding private sow.yml and .sow/.
  • Base equal to the current Generation gives an empty plan. A repository that was never built gives an empty 0 -> 0 plan.
  • A base outside the range is rejected:
sow changes 99
operation rejected: managed: operation rejected: base generation 99 is outside 0..2

Examples

Save a complete manifest of the current Generation:

sow changes 0 -r pgsql --json > pgsql-current.json

Show only the changes under one Dist:

sow changes -r pgsql --json |
  jq '.result.changes[] | select(.path | startswith("dists/el9/"))'

Details

Dirty and recovery states

When desired state has unbuilt changes, the header shows dirty=true, but the plan still ends at the current Generation. Pending payloads are private until a build moves them into the pool, so they never appear in the plan.

changes exits 5 when the repository is recovering or error, when an operation or workspace operation is unfinished, during a layout migration, or when the files on disk differ from the current Generation’s manifest. Recover or repair the repository as the diagnostic says, then rerun. A damaged public file, for example, stops it with the same error check reports:

sow changes
integrity or recovery error: managed: integrity or recovery failure: changes are unavailable because delivery integrity check failed: managed: integrity or recovery failure: public file /srv/sow/demo/dists/el9/x86_64/repodata/repomd.xml mode 0600 is not world-readable or is world-writable

A base inside the valid range whose manifest is no longer stored is rejected with exit 6.

Exit codes

Code Trigger
0 Plan printed, including an empty plan
1 Runtime I/O failure
2 Usage error, -d supplied, workspace not found, or implicit repository selection is ambiguous
5 A verification layer failed, the repository is recovering or error or has an unfinished operation, or state evidence is inconsistent
6 Explicit repository is not configured, or Base Generation is outside the valid range or no longer stored

See also

16 - sow publish

Deliver the current Generation to a filesystem or R2 target in an order that keeps clients working, with resume and abort.

sow publish delivers the current Generation to a target configured under targets: in sow.yml: a directory behind a web server, or an R2 bucket. It sends only what changed since the target’s last publication, in an order that never leaves an index pointing at a file that is not there yet, then reads the result back through the public URL and records a checkpoint. Old files stay on the target until client caches have expired, and an interrupted run resumes where it stopped. Use it for every update to a configured target; to copy a repository to an isolated host instead, see Serve and Publish Repositories.

Synopsis

sow publish TARGET [--abort | --rebind] [-C|--workdir DIR] [-T|--timeout DUR | -N|--no-wait] [--json] [--passfile PATH]

TARGET names a configured filesystem or r2 target. The target already names its repository, so publish takes no -r.

Flag Meaning Default
--abort Abandon an interrupted attempt that has not reached commit intent false
--rebind Accept a changed target name, public_endpoint, or max_cache_ttl, then continue false
-C, --workdir DIR Workspace discovery start directory current directory
-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, needed only if SOW must first recover an interrupted local operation (Password files) —
--json Output JSON false

--abort and --rebind are mutually exclusive.

Before you publish

  1. Configure the target under targets: in sow.yml; see Publication targets. For a filesystem target, create the endpoint directory first.
  2. Make public_endpoint serve the published files (a web server root or bucket access), because SOW verifies every publication through it.
  3. Run sow build and sow check. publish always sends the latest completed Generation, so a dirty repository publishes its last build without the unbuilt changes.

Publication protocol

Clients find everything through the entry points (repomd.xml, InRelease, Release), so SOW changes those last. Each run:

  1. Verifies the source. Local files must match the manifest of the completed Generation.
  2. Uploads packages. New packages reach the target before any index lists them. A package path is immutable there: SOW never replaces it with different bytes.
  3. Uploads immutable metadata. Content-addressed files such as …-primary.xml.gz and APT by-hash indexes get new names, so clients still reading the old entry points see no change.
  4. Records commit intent. From this point the attempt can only roll forward.
  5. Replaces the entry points, one view at a time, each signature before the index it signs. A client that refreshes now sees the new Generation.
  6. Verifies and checkpoints. SOW reads the changed files back through public_endpoint, records the target’s new checkpoint, and starts the cache-grace period for superseded files.

While step 5 runs, different views can briefly serve indexes from different builds, and a detached signature changes in a separate write from its index, so a client may need to retry one refresh. The design record Publication & Recovery gives the per-format order.

sow publish local
published demo generation=00000000000000000005 to local (filesystem): phase=grace objects=14
sow publish local
publication demo generation=00000000000000000005 to local is already current (noop)

objects counts the files the target now holds. phase=grace means the checkpoint is recorded and the files this Generation no longer needs are in their grace period: clients and CDNs may still hold the old entry points for up to max_cache_ttl, and those point at the old files. After grace expires, sow gc TARGET can delete eligible files on a filesystem target. R2 reports candidates by default and requires --delete to remove them. Running publish again with nothing new to send is a no-op.

Resume or abandon an attempt

SOW saves each attempt’s plan and progress. If publish stops on a network error, Ctrl-C, or a crash, fix the cause and run the same command again. The resumed attempt follows its saved plan, so it finishes the Generation it started with even if you have built since; run publish once more to send the newer Generation.

Saved state What to do
Before commit intent Rerun to resume, or run sow publish TARGET --abort to abandon the attempt
After commit intent Rerun to finish; --abort is refused because entry points may already have changed
Checkpoint recorded Rerun to finish the remaining bookkeeping; a current target is a no-op
Conflicting remote file Inspect the named file and the target configuration before retrying

--abort reconciles what the attempt already uploaded and records those objects as abandoned so a later attempt can reuse matching bytes. It deletes nothing on the target; for a filesystem target it removes only private staging files. Without an attempt in progress, --abort exits 6.

Change target settings

The first publication binds the target to its repository and storage location. If you later change the target’s name, public_endpoint, or max_cache_ttl in sow.yml, publish stops with exit 1 until you confirm the change:

sow publish local
bind publication target "local": state object conflicts with existing identity: publication target "local" is already bound with different mutable configuration; rerun publish with --rebind after operator review

Review the change, then rerun with --rebind, using the new name if you renamed the target. SOW records the new settings and continues publishing:

sow publish local --rebind
May change with --rebind Immutable; configure a new target
target name Repository identity
public_endpoint provider, storage endpoint, or region
max_cache_ttl bucket or prefix
  • GC uses the later of the recorded deadline and the checkpoint’s publication time plus the current max_cache_ttl. Raising the TTL can extend protection for an earlier publication. Lowering it preserves the recorded minimum.
  • Finish an interrupted sow gc TARGET before changing max_cache_ttl, and finish an active conditional delete before changing public_endpoint.
  • A target that was never published has nothing to rebind; publish it once without --rebind.

Removing a published view

While a target is configured, SOW refuses any local change that would withdraw an entry point that target has published: a whole Dist, an RPM architecture view, or a signature file. Its clients would otherwise lose an index they use. build, dist rm, and similar commands name the file and exit 6:

sow dist rm el8
operation rejected: managed: operation rejected: mutation would withdraw published pointer "dists/el8/aarch64/repodata/repomd.xml" from configured target "local"; retire or move that target binding/prefix before removing the view, architecture, or signing companion

To remove the view anyway, retire the target first:

  1. Stop publishing to the target and remove its entry from targets: in sow.yml.
  2. Run sow config check.
  3. Remove the view locally, for example with sow dist rm el8.

The old remote files and the publication history stay untouched. To publish the reduced repository, configure a new target with a different storage prefix and move clients to it.

Details

Public visibility checks

Before recording a checkpoint, SOW downloads the changed files and affected entry points through public_endpoint and checks their content. Filesystem targets accept a file:// or HTTP(S) public_endpoint; R2 targets require HTTP(S).

Over HTTP(S), SOW uses ordinary GET requests and follows CDN redirects (up to 10). It refuses a redirect from HTTPS to HTTP, a redirect to a loopback, link-local, or unspecified address (checked again on the address actually connected), and a cross-origin redirect through an HTTP proxy; in that last case, configure the final public URL or reach that host without a proxy. A CDN may still serve a cached copy, so SOW retries stale or missing content for up to max_cache_ttl. Harmless foreign files at the target root outside pool/ and dists/ are ignored.

R2 inventory

Each R2 publication lists the target prefix. An object whose path, size, and ETag match a known immutable object reuses its recorded SHA-256; other objects are checked with HEAD requests, up to eight at a time per listing page. Upload progress resets the idle timeout, so a long upload that is still moving data does not time out.

Filesystem target paths

SOW rejects a filesystem target that overlaps the repository or the private .sow/ directory. It checks only the selected target’s prospective path, so sibling targets that share a parent directory, such as /srv/www/pgsql and /srv/www/pigsty, do not block each other.

Changed content and conflicts

A published package URL stands for fixed content. To ship changed bytes, use a new package version and filename. If a remote file differs from what the attempt recorded, publish stops and names it; see Troubleshooting.

Other preconditions

  • publish first finishes any interrupted local operation in the repository. If that recovery must re-sign metadata, pass --passfile; publishing an existing Generation signs nothing.
  • If an earlier sow gc TARGET stopped with a report in progress, publish exits 5 and asks you to resume that GC first.
  • A repository that was never built, or that is in the middle of a layout migration, cannot be published (exit 5).

Exit behavior

Code Trigger
0 Publication completed, or the target was already current
1 Filesystem, provider, network, or verification failure, or a target binding conflict (including a change that needs --rebind)
2 Usage error, workspace discovery error, or invalid sow.yml
4 Repository write lock unavailable
5 Source is not deliverable, recovery evidence is inconsistent, or an unfinished target GC must be resumed first
6 Target is missing or unsafe, --abort has no eligible attempt, or another safety precondition rejects the request

See also

17 - sow retain

Keep the package files and manifest of a Generation so local GC cannot reclaim them, or release them again.

Each build replaces the current Generation, and once nothing else refers to them, sow gc may delete packages that only the old Generation used. sow retain marks a Generation to keep: it verifies the Generation, saves a frozen copy of its manifest and metadata references in private state, and makes local GC keep every package file it needs. The packages stay in the shared pool, so retention copies nothing. It does not restore or publish the old view; it keeps the bytes and the record of what that Generation contained.

Synopsis

sow retain add GENERATION [-C|--workdir DIR] [-r|--repo NAME] [-T|--timeout DUR | -N|--no-wait] [--json]
sow retain ls             [-C|--workdir DIR] [-r|--repo NAME] [--json]
sow retain rm GENERATION  [-C|--workdir DIR] [-r|--repo NAME] [-T|--timeout DUR | -N|--no-wait] [--json]

GENERATION is a decimal integer greater than zero.

Options

Flag Commands Meaning
-C, --workdir DIR all Workspace discovery start directory
-r, --repo NAME all Select a repository (selection rules)
-T, --timeout DUR add, rm Maximum lock wait; 0 (default) waits indefinitely
-N, --no-wait add, rm Fail immediately when the lock is held
--json all Output JSON

retain add

retain add accepts only the current Generation, so run it right after the build you want to keep and before the next build replaces it. Take the number from sow status or the build output:

sow retain add 12 -r pgsql
retained generation 00000000000000000012: /srv/sow/.sow/pgsql/retained/00000000000000000012

Any other Generation is rejected with exit 6:

sow retain add 5
operation rejected: managed: operation rejected: retained/v1 add requires the current Built Generation

Adding the same Generation again changes nothing, provided its retained record still passes verification.

retain ls

sow retain ls -r pgsql
GENERATION	RECORD_IDENTITY	PATH
00000000000000000012	678beeae...	/srv/sow/.sow/pgsql/retained/00000000000000000012

An empty list is a successful result.

retain rm

retain rm releases a Generation by removing its retained record:

sow retain rm 12 -r pgsql
removed retained generation 00000000000000000012

It deletes no package files. A later local sow gc reclaims them once no other record or operation needs them. Removing a Generation that is not retained is a no-op that succeeds.

Details

Interrupted removal

Before deleting a record, SOW writes a removal plan (.sow/<repo>/stage/retain-remove-<GENERATION>.plan.json) and moves the record to a tombstone (.sow/<repo>/stage/retain-remove-<GENERATION>). If the removal stops halfway, rerun retain rm or run local sow gc; either replays the tombstone and finishes the job. Until then, the retained layer of sow check reports the unfinished removal.

Damaged records

If a retained record is damaged, retain rm, retain ls, local gc, and check report an error, and the retained layer of check names the Generation. To discard the damaged record:

  1. Stop workspace writers.
  2. Move .sow/<repo>/retained/<GENERATION> to a backup location outside the workspace.
  3. Run sow check again.

Moving the record also removes its protection against GC.

Exit behavior

Code Trigger
0 Operation completed, including an empty list or a no-op
1 Filesystem or runtime I/O failure
2 Invalid Generation syntax, discovery error, or implicit repository selection is ambiguous
4 Write lock unavailable for add or rm
5 Generation manifest or repository state is inconsistent
6 Explicit repository is not configured, retain add does not name the current Generation, or another safety rule rejects the request

See also

  • sow gc — reclaim packages that no retained Generation needs
  • sow changes — compare a Generation with an earlier one
  • Repository Layout — where retained records live

18 - sow gc

Reclaim local package files nothing needs any more, and delete superseded target files once client caches have expired.

SOW never deletes a file the moment it stops being current. Old packages stay in the local pool while a build, a retained Generation, a publication, or a recovery record still needs them, and superseded files stay on a target until client caches have expired. sow gc removes what nothing needs any more: without arguments it collects the local package pool; with TARGET it cleans up that publication target.

Synopsis

sow gc          [-C|--workdir DIR] [-r|--repo NAME] [-T|--timeout DUR | -N|--no-wait] [--json] [--passfile PATH]
sow gc TARGET [--delete] [-C|--workdir DIR]         [-T|--timeout DUR | -N|--no-wait] [--json] [--passfile PATH]

sow help gc prints both forms as one line, sow gc [TARGET [--delete]] ....

Flag Meaning Default
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Repository for local GC; a target already names its repository selection rules
--delete Delete eligible objects on an R2 target, or resume an interrupted R2 deletion false
-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, needed only if SOW must first recover an interrupted local operation (Password files) —
--json Output JSON false

gc TARGET -r NAME and --delete without TARGET are usage errors (exit 2). Neither form accepts --dist.

Local GC

Local GC deletes pool files that no record refers to. A package is kept while any of these needs it:

  • current desired or built membership, or the previous built membership kept for clients that still hold the old indexes;
  • an explicit retain record;
  • recovery records and unfinished operations;
  • publication records: attempts in progress and publications that target GC has not finished with;
  • active maintenance work.

Run it on a clean repository whose last build completed. A dirty repository, packages waiting in the pending area, or an unfinished operation make it exit 5; run sow build first.

sow gc
local gc demo: generation=00000000000000000006 objects=1 bytes=19776
sow gc
local gc demo: no unreachable payloads (noop)

objects and bytes count the package files removed. pool/ is part of the served tree, so removing files from it advances the repository to a new Generation. When nothing is eligible, the command changes nothing.

Target GC

Cache grace

Clients and CDNs may still hold an old repomd.xml or InRelease and request the files it lists. When sow publish records a new checkpoint, it sets a grace deadline from the time the publication was verified plus the target’s max_cache_ttl. A later deadline already recorded for the target is carried forward.

Target GC checks the recorded deadline, the current TTL, and live references. Rebinding a target with a longer TTL can extend protection for an earlier publication. With max_cache_ttl: 0s, a superseded object can become a candidate at the next target GC if earlier grace has elapsed and neither the current publication nor any protected publication references it. Filesystem targets delete eligible files. R2 reports candidates by default.

Note

Upgrading a target configured with max_cache_ttl: 0s? Read the upgrade guide first: grace periods recorded from 0.9.0 on follow max_cache_ttl directly, while deadlines recorded earlier stay in force.

What each provider does

Provider Behavior
filesystem After grace, conditionally deletes eligible files, confirms that their public URLs no longer serve them, and records the result
r2 Saves a candidate report by default and deletes nothing. With --delete, deletes the objects that are eligible after grace

R2 deletion can follow a report you reviewed, or run directly. Before each DeleteObject, SOW rechecks the protected publications and the object’s size, SHA-256 metadata, and ETag. It then confirms that the object is gone from storage and that the public URL returns HTTP 404 or 410, and records a deletion receipt tied to the publication that superseded the object. Use a target prefix that only this workspace writes.

sow gc local
target gc demo/local (filesystem): phase=done candidates=3 deleted=3 retained=0 pending=0
sow gc local
target gc demo/local: no due maintenance (noop)
Field Meaning
candidates Objects found eligible in this run
deleted Objects deleted and confirmed absent
retained R2 candidates recorded in a report without --delete
pending Publications whose grace deadline has not passed yet

When every recorded publication is still in grace, the text output also reads no due maintenance (noop); --json shows "phase": "pending_grace" and the pending_grace count.

Details

Interrupted GC

  • Local GC first replays any interrupted retain-remove-* tombstones, then journals the operation and saves its plan to .sow/<repo>/recovery/<operation-id>/plan.json before deleting pool files. A large backlog runs in batches that keep each plan under 64 MiB. If the run stops after deleting some files, the next run replays the saved plan and completes the new Generation.
  • R2 deletion: rerun sow gc TARGET --delete. Without --delete, target GC refuses to touch an unfinished deletion report and exits 5.
  • The R2 identity check and the delete are separate storage requests, not one atomic operation.

Other preconditions

  • Target GC refuses (exit 5) while a publication attempt on that target is in progress; finish it with sow publish TARGET or abandon it with --abort.
  • Filesystem target paths are checked as for publish: sibling targets that share a parent directory, such as /srv/www/pgsql and /srv/www/pigsty, do not block each other.
  • Both forms first finish any interrupted local operation in the repository; pass --passfile if that recovery must re-sign metadata. Collection itself signs nothing.

Exit behavior

Code Trigger
0 GC completed, or nothing was eligible
1 Filesystem, provider, network, or runtime failure
2 Usage error, workspace discovery error, invalid sow.yml, or implicit repository ambiguity
4 Repository write lock unavailable
5 Local GC preconditions not met, a publication or deletion must be finished first, or recovery, state, receipt, or manifest evidence is inconsistent
6 Explicit repository or target is not configured or not safe, or a safety precondition rejects the deletion

See also

19 - sow export

Export one RPM Dist and architecture as a self-contained repository directory.

sow export rpm-leaf writes one RPM Dist and architecture of a standard repository to a directory of its own, with the packages copied under it and metadata rewritten to local pool/... paths. Inside the repository, an architecture view refers to packages in the shared pool through parent-relative paths, which some tools refuse: default dnf reposync, for example, will not write outside one repository directory. Use an export whenever a tool needs a self-contained directory. To serve the repository itself, use sow publish.

Synopsis

sow export rpm-leaf DIST ARCH DIR [--hardlink] [-C|--workdir DIR] [-r|--repo NAME] [--json] [--passfile PATH]
Argument Requirement
DIST Name of a configured RPM Dist
ARCH x86_64 or aarch64
DIR Absent or empty directory, not a symlink, whose parent already exists; it must not overlap the repository, the private .sow/ directory, or a filesystem target
Flag Meaning Default
--hardlink Hard-link packages instead of copying them; same filesystem, read-only use only copy
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
--passfile PATH Signing password file for the exported repomd.xml of a signed view (Password files) —
--json Output JSON false

Output

sow export rpm-leaf el9 x86_64 /srv/export/el9-x86_64
exported RPM leaf el9/x86_64 generation=00000000000000000012 method=copy packages=84 to /srv/export/el9-x86_64

The destination is a complete RPM repository that does not depend on the workspace:

  • /srv/export/el9-x86_64/
    • .sow-export.jsonprovenance: Repository, Generation, Dist, architecture, signer
    • manifest.tsvexport manifest
    • pool/the packages this view lists, e.g. pool/c/<name>/<file>.rpm
    • repodata/metadata with local pool/... package paths
      • <sha256>-primary.xml.gz
      • <sha256>-filelists.xml.gz
      • <sha256>-other.xml.gz
      • repomd.xml
      • repomd.xml.ascsigned views only

Because the export is independent, it does not protect the source packages from sow gc.

Source requirements

The source repository must have a completed Generation, no unfinished operation, and no membership changes waiting for a build (for example after add --skip); otherwise the export exits 5. Edits to sow.yml that only await a build do not block it: sow status reports dirty, and the export uses the last build. The requested view must be part of that Generation.

A Dist that later builds did not touch can still be exported without rebuilding it, because its unchanged view is carried into the current Generation. The export records the current Generation number, signs a signed view with that Generation’s recorded signing identity, and uses the Dist’s recorded build publication time for the metadata signature.

Copying is the default and keeps the export fully separate. --hardlink saves the space and time of the copy when the destination is on the same filesystem, but a hard-linked file is the pool file: editing it changes the package in SOW’s pool. Use it only for read-only output.

Details

  • If an export fails, fix the reported cause and retry into a new or empty directory; the failed destination may hold partial files.
  • An unrelated filesystem target can be unmounted while you export; a destination that overlaps a configured target is still rejected.
  • A destination path that goes through a symlinked parent directory is resolved to the real directory; only DIR itself must not be a symlink.
  • The exported repomd.xml always uses data timestamp 0, and there is no --metadata-timestamp option. If EL7 clients cached a positive timestamp under the same repository ID, this output cannot directly replace that repository, and changing the base URL alone does not help: see Existing EL7 caches.

Exit behavior

Code Trigger
0 Standalone RPM repository exported
1 Filesystem, copy, hard-link, or metadata-write failure
2 Invalid syntax, malformed Dist or architecture, discovery error, or implicit repository ambiguity
5 Source repository has unbuilt membership changes or an unfinished operation, or its Generation or state is inconsistent
6 Explicit repository is not configured, Dist is not RPM, view or signer is unavailable, or DIR is unsafe, non-empty, overlapping, or missing its parent

See also

20 - sow log

Read the record of every repository write, archive it as JSONL, and prune old entries.

SOW records each repository write, such as add, rm, build, dist new, dist rm, local gc, or log prune, as an operation in the repository’s state database: what was asked for, each state it passed through, and the files it changed. sow log reads those records. Use it to find out what changed and when, why a command failed, or how far a long build has got. log export archives completed records as JSONL, and log prune removes old ones from the database.

Synopsis

sow log [OPERATION] [-C|--workdir DIR] [-r|--repo NAME] [-d|--dist NAME] [--json]
sow log export [FILE] [-C|--workdir DIR] [-r|--repo NAME] [-d|--dist NAME]
sow log prune BEFORE [-C|--workdir DIR] [-r|--repo NAME] [-T|--timeout DUR | -N|--no-wait] [--json] [--passfile PATH]
Flag Commands Meaning Default
-C, --workdir DIR all Workspace discovery start directory current directory
-r, --repo NAME all Select a repository selection rules
-d, --dist NAME log, log export Only operations that touched this one Dist all
-T, --timeout DUR log prune Maximum lock wait; 0 waits indefinitely 0
-N, --no-wait log prune Fail immediately when the lock is held false
--passfile PATH log prune Signing password file, needed only if SOW must first recover an interrupted operation (Password files) —
--json log, log prune Output JSON false

log export writes JSONL directly and has no --json. log prune applies to the whole repository and rejects -d.

sow log

With no argument, sow log lists the 50 most recent operations, newest first:

sow log
repository=demo operations=8
ID	KIND	STATE	CREATED	UPDATED
8814556690812580691	build	done	2026-11-27T08:38:00Z	2026-11-27T08:38:00Z
6831294293867956892	add	done_dirty	2026-11-27T08:37:53Z	2026-11-27T08:37:53Z
9208934936037009093	local.gc	done	2026-11-27T08:37:40Z	2026-11-27T08:37:40Z
4595017550548091657	add	done	2026-11-27T08:37:39Z	2026-11-27T08:37:40Z
8495969916600415110	rm	done	2026-11-27T08:37:32Z	2026-11-27T08:37:32Z
1171187774051474049	add	done	2026-11-27T08:37:31Z	2026-11-27T08:37:31Z
3035844290701018943	add	done	2026-11-27T08:37:29Z	2026-11-27T08:37:30Z
3830047518535999110	dist.new	done	2026-11-27T08:37:29Z	2026-11-27T08:37:29Z

With --json, each entry in result.operations carries the request and the outcome:

{
  "id": "4262183287563704350",
  "kind": "build",
  "state": "done",
  "payload_json": "{\"version\":2,\"repository\":\"pigsty\",\"kind\":\"build\",\"config_sha256\":\"37eb6dcf...\",\"skip\":false,\"dists\":[\"el9\"],\"build_dists\":[\"el9\"],\"manifest_sha256\":\"678beeae...\"}",
  "result_json": "{\"dists\":1,\"dropped_pending\":[]}",
  "created_at": "2026-08-04T04:07:40.334787Z",
  "updated_at": "2026-08-04T04:07:40.907125Z"
}

payload_json records the intent, including config_sha256, the digest of the configuration in force, and manifest_sha256 of the resulting Generation. Operations that build metadata also record publication_time, a whole-second UTC timestamp that recovery reuses for metadata and signatures; older journals and layout migrations can lack it. result_json records the outcome. A failed operation also carries error_class and error_message:

{
  "id": "5995346754219751025",
  "kind": "add",
  "state": "failed",
  "result_json": "{\"accepted\":0,\"failed\":1}",
  "error_class": "rejected",
  "error_message": "no input package was accepted"
}

Publication, target GC, and retain keep their own records and do not appear here. Neither do the workspace operations init, repo new, and repo rm, which use separate recovery records.

One operation in detail

Pass an operation ID for its summary:

sow log 8814556690812580691
operation=8814556690812580691 repository=demo kind=build state=done duration_ms=452 created=2026-11-27T08:38:00.520714000Z updated=2026-11-27T08:38:00.972937000Z
events=15 packages=0 memberships=0 files=12

Add --json to read the state transitions, timing, packages, memberships, and files under result.detail. An excerpt:

{
  "duration_ms": 572,
  "events": [
    {"sequence": 0, "state": "planned",  "occurred_at": "2026-08-04T04:07:40.334787Z"},
    {"sequence": 1, "state": "staged",   "occurred_at": "2026-08-04T04:07:40.380963Z"},
    {"sequence": 2, "state": "applied",  "occurred_at": "2026-08-04T04:07:40.386186Z"},
    {"sequence": 3, "state": "built",    "occurred_at": "2026-08-04T04:07:40.904730Z"},
    {"sequence": 4, "state": "done",     "occurred_at": "2026-08-04T04:07:40.907125Z"}
  ],
  "packages": [],
  "memberships": [],
  "files": [
    {"sequence": 0, "action": "update", "phase": "pointer", "path": "dists/el9/aarch64/repodata/repomd.xml", "size": 1511, "sha256": "ef071821e06c9e86ab4f6d2a56906d82bb66df251e79d1086cfd44dc8395513e"},
    {"sequence": 1, "action": "update", "phase": "pointer", "path": "dists/el9/x86_64/repodata/repomd.xml",  "size": 1514, "sha256": "a31e90ec39169f0373b108458908333c96c5f600f3c63a50c44257856f0d2d55"}
  ]
}

The files array uses the same phase values as sow changes: payload, metadata, pointer, delete.

A build also appends progress events. They keep the current state and put a versioned object in detail_json, so you can follow a long build:

{
  "state": "applied",
  "detail_json": "{\"version\":1,\"kind\":\"build_progress\",\"phase\":\"rendering\",\"completed\":1,\"total\":2,\"jobs\":8}"
}

The phases are rendering, promoting_payload, publishing_dists, normalizing_public_tree, and finalizing.

Filtering by Dist

-d keeps only operations that touched one Dist, which helps when a repository serves several distributions. It takes a single Dist; two different -d values exit 6.

sow log -d trixie -r pigsty

Operation lifecycle

The state field shows how far an operation got:

planned → staged → applied → built → done
                        └────────→ done_dirty
   any nonterminal → recovering → built / done / done_dirty / rolled_back / failed
   pre-apply error  → failed
State Meaning
planned Command, arguments, targets, and intended actions are durably recorded
staged New packages and metadata are written to temporary locations and verified
applied Desired state and the private pending payloads it needs are committed
built The complete static Generation has been switched in
done Terminal: the command succeeded
done_dirty Terminal: the command succeeded, but changes still need a build, usually after --skip
failed Terminal: the operation failed before applied, so nothing was committed
rolled_back Terminal: recovery abandoned the operation before it changed desired state, for example a planned operation left by an interrupted command
recovering Not terminal: the next write command must complete or roll it back

sow log export

log export writes terminal operations as JSONL, one complete operation detail record per line, for archiving or for a log pipeline:

sow log export /srv/audit/pigsty-ops.jsonl -r pigsty
exported 12 operations to /srv/audit/pigsty-ops.jsonl

Omit FILE, or pass -, to write to stdout:

sow log export - -r pigsty | gzip > pigsty-ops-$(date +%F).jsonl.gz

Output path

Give a new filename in an existing directory. log export never overwrites: an existing file exits 6, and a missing parent directory exits 1. A symlinked parent directory, such as /tmp on macOS, is resolved to its physical directory before the file is created atomically and the directory synced.

sow log prune

log prune deletes eligible completed operation records older than BEFORE and reclaims the database space. It records its own log.prune operation.

sow log prune 2027-01-01 -r pigsty
pruned log repository=pigsty operation=8150803833883584722 before=2026-12-31T16:00:00.000000000Z operations=1

The text output shows the cutoff in UTC (this example ran at UTC+8) and the number of deleted records as operations; --json reports it as pruned. The operation ID appears both at the top level of the JSON envelope and in result.operation.

If another reader is using the database, the records are still deleted but space reclamation waits. The text output then adds log deletion committed; space reclamation deferred while the database is busy, and --json sets compaction_deferred: true in result. Close the reader and run prune again to reclaim the space.

BEFORE syntax

BEFORE is an ISO 8601 date YYYY-MM-DD, read as local midnight, or an RFC 3339 timestamp with a time zone. Anything else is a usage error:

sow log prune yesterday -r pigsty
usage error: BEFORE must be YYYY-MM-DD or an RFC 3339 timestamp with timezone

Records kept by prune

prune never deletes:

  • an operation that is not terminal;
  • a record still needed for recovery;
  • a record that current package or membership state depends on;
  • a Generation or its changeset.

Examples

Show the most recent write:

sow log -r pgsql --json | jq -r '.result.operations[0] | "\(.id)\t\(.kind)\t\(.state)"'

Find failed operations among the 50 most recent:

sow log -r pgsql --json | jq -r '.result.operations[] | select(.state=="failed") | "\(.id)\t\(.error_class)\t\(.error_message)"'

Archive records, then remove those older than a chosen date:

sow log export /srv/audit/pgsql-$(date +%Y%m).jsonl -r pgsql
sow log prune 2026-05-01 -r pgsql

Find the operation that last touched a Dist:

sow log -d el9 -r pgsql --json | jq -r '.result.operations[0].id'

Exit codes

Command Code Trigger
log 0 Records printed, including an empty log
log 2 Usage error (including a non-numeric operation ID), workspace not found, or ambiguous selection
log 5 State database unreadable
log 6 The given operation ID does not exist, or two different -d values were given
log export 0 Export written
log export 1 I/O failure writing or syncing the file, or the parent directory does not exist
log export 2 Usage error or ambiguous selection
log export 6 The file already exists
log prune 0 Prune completed, including pruning nothing
log prune 2 Malformed BEFORE, -d given, or ambiguous selection
log prune 4 Repository lock held and --no-wait given or --timeout expired
log prune 5 Integrity or recovery error

See also