This is the multi-page printable view of this section.
Commands
- 1: sow create
- 2: sow prune
- 3: sow init
- 4: sow config
- 5: sow repo
- 6: sow dist
- 7: sow add
- 8: sow rm
- 9: sow ls
- 10: sow show
- 11: sow where
- 12: sow status
- 13: sow build
- 14: sow check
- 15: sow changes
- 16: sow publish
- 17: sow retain
- 18: sow gc
- 19: sow export
- 20: sow log
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:
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 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:
- With
-C/--workdir DIR, search upward fromDIRonly, with no fallback to the current directory orSOW_DIR. - Without
-C, search upward from the current directory; if that finds nothing andSOW_DIRis set, search upward fromSOW_DIR. - Stop at the first directory that contains either file. If both exist there as regular files, exit
2. A legacy repository directory namedsow.yamlnext tosow.ymlis accepted. - 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:
-r/--repo NAME;- the repository that contains the discovery start directory;
- the only repository in the workspace;
- otherwise, exit
2and 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:
- one or more
-d/--dist NAME; - the Dist that contains the discovery start directory (anywhere under
REPO/dists/DIST/); - the only Dist in the selected repository;
- otherwise, exit
2and list the candidates.
The other commands default to a wider scope:
build,check, andstatuscover all Dists when-dis absent.showsearches the whole selected repository;-dnarrows it.wheresearches all matching Dists in the workspace;-rand-dnarrow it.changesalways 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 DURand-N/--no-wait, exceptinit, which always waits. The default--timeout 0(or0s) waits indefinitely; positive Go durations include500ms,30s, and1m30s.--no-waitfails at once when the lock is held and cannot be combined with a positive timeout. A lock that cannot be acquired returns exit4. - Read-only workspace commands take shared locks, wait behind a conflicting writer, and accept no
lock options.
statusnormally 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:
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
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
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:
Run it again whenever packages change. On an unchanged directory it writes nothing:
The same result for a script:
Rebuild a Pigsty offline repository with eight workers and a publication time chosen from its history:
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:
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:
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_OPENPGPtag 278, RSA/DSA/ECDSA/EdDSA in signature header tag 267, or legacy PGP tags). Packages that are already signed keep their bytes. --overwritere-signs every retained RPM withrpm --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
--pigstycleanup,--sign-withonly prints a warning; with--strictit fails.
–pigsty
--pigsty applies Pigsty’s cleanup rules and writes a completion marker:
- Delete DEB packages whose parsed architecture is
i386. RPMs are not removed merely for carrying ani386/i486/i586/i686architecture. - Delete RPM/DEB whose binary package name is exactly
patroniand whose upstream version is exactly3.0.4. RPM comparesVERSION, ignoring epoch and release; DEB strips epoch and Debian revision first.3.0.4+foois not a match. - Write
repo_completewith 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.
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:
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:
See also
- Simple Repositories — the design behind
create - Quick Start — a simple repository in five minutes
- Repository Layout — what a simple repository looks like on disk
- Sign Your Repository — generating and using a signing key
- Migrate an Existing YUM Repository — replacing an existing metadata generator
2 - sow prune
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
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:
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:
--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
sow createfor rebuilding a candidate without additional metadata and for metadata timestamp rules- Simple Repositories for how a simple repository behaves
- Migrate an Existing YUM Repository for replacing
createrepo_cand pruning simple RPM repositories
3 - sow init
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
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/ 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:
Or install a configuration kept under version control, initialize everything it declares, and validate it:
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:
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:
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
- First Standard Repository — the ten-minute guided version
- Standard Repositories — the three-layer model
- sow.yml Reference — every configuration key
- sow repo and sow dist
- Repository Layout — what
.sow/contains
4 - sow config
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
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:
Compare the effective policy of two Dists:
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:
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:
Active workspaces must use schema: sow/v3:
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:
The file on disk holds only what you wrote:
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”:
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
- sow.yml Reference — every key, with a complete example file
- Membership Policy — how
excludeandlimitare evaluated - Signing Model — key reference grammar and the two trust chains
- sow init — create objects declared in a hand-written config
- sow check — the runtime counterpart that verifies bytes on disk
5 - sow repo
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
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:
Create a repository without waiting for a held lock:
Print each repository’s name, state, and 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 ls
Lists every repository in the workspace. Read-only.
| 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.
| 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.
| 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 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:
| 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:
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 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.
- Stop all workspace writers.
- Back up the whole workspace, preserving hard links.
- Migrate each configured repository.
- Run
buildandcheckfor each repository.
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:
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 NAMEcan 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 JSONwarnings; 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
- sow dist — the layer below
- Standard Repositories — the three-layer model and discovery rules
- Transactions & Recovery — lock scopes and the
recoveringstate - sow.yml Reference —
protectedand per-repository signing - Repository Layout — the fixed directory structure
6 - sow dist
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
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:
Create a beta Dist, set its package-retention policy in sow.yml, then rebuild it:
List Dists that need a build:
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.
DESIRED and BUILT count memberships. When the desired state has moved ahead of the last build,
DIRTY_REASONS says why:
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:
sow dist new
Creates a Dist with --format rpm or --format deb:
| 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:
--format is required and accepts only 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.
| 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 rm
Removes a Dist’s configuration, membership, and indexes. A Dist that still has members needs -f:
| 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:
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
- sow repo — the layer above
- Pool & Metadata Views — how one Dist becomes several client-visible views
- Membership Policy — configuring
limitandexclude - sow build — rebuild after a policy edit
- Repository Layout — the RPM and DEB
dists/structures
7 - sow add
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
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:
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:
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:
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.
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.
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:
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:
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
- sow rm — the inverse operation
- sow build — build after
--skip - Membership Policy —
excluderules andlimitsemantics in full - Signing Model — the two trust chains and key references
- Package References — the coordinate grammar printed on each item line
8 - sow rm
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
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:
Examples
Preview a removal, then apply it:
Remove one exact object from two Dists:
Stage several removals, then build once:
Feed the preview plan to another tool:
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:
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.
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:
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.
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
- Package References — the full reference grammar
sow ls,show, andwhere— finding the exact reference to remove- sow add — the inverse operation
- sow build — build after
--skip - Membership Policy — why removed members do not come back
sow retainandsow gc— when bytes can be reclaimed
9 - sow ls
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
| 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
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:
List pool paths in deterministic order:
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>/:
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
sow show— inspect one listed objectsow where— locate an object across the workspacesow rm— remove a listed reference from desired membership- Package References — accepted identity forms
10 - sow show
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
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
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:
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 Distsow where— search across repositoriessow rm— remove matching desired membership- JSON Output — complete result schema
11 - sow where
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
| 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:
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:
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:
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
sow show— inspect the resolved packagesow ls— list one Dist- Package References — exact grammar and ambiguity rules
12 - sow status
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
| 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:
| 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 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
sow build— build pending repository changessow check— verify the files before deliverysow log— inspect the operation reported here- Transactions & Recovery — state transitions and recovery
13 - sow build
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
| 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
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:
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; addsrepomd.xml.ascwhen signing is configured. - DEB: always writes
Release; addsInReleaseandRelease.gpgwhen 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 migrateand journals without a recorded publication time keep their earlier timestamp behavior; see Publication times.- An
rm --checkpreview 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
sow status— see whether a build is neededsow check— verify the resulting treesow changes— list the files the build changed- Transactions & Recovery — full commit protocol
14 - sow check
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
| 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:
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:
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
sow status— cheap state querysow build— build indexes from desired state- Exit Codes — why a dirty repository maps to
5 - Observability & Audit — using checks and the log together
15 - sow changes
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
| 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
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
0lists every file of the current Generation as an addition: the complete delivery manifest, excluding privatesow.ymland.sow/. - Base equal to the current Generation gives an empty plan. A repository that was never built gives
an empty
0 -> 0plan. - A base outside the range is rejected:
Examples
Save a complete manifest of the current Generation:
Show only the changes under one Dist:
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:
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
sow build— create the next Generationsow publish— deliver Generations to a configured targetsow log— operation records and their file changes- Repository Layout — public and private path boundaries
16 - sow publish
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
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
- Configure the target under
targets:insow.yml; see Publication targets. For a filesystem target, create the endpoint directory first. - Make
public_endpointserve the published files (a web server root or bucket access), because SOW verifies every publication through it. - Run
sow buildandsow check.publishalways 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:
- Verifies the source. Local files must match the manifest of the completed Generation.
- 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.
- Uploads immutable metadata. Content-addressed files such as
…-primary.xml.gzand APTby-hashindexes get new names, so clients still reading the old entry points see no change. - Records commit intent. From this point the attempt can only roll forward.
- 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.
- 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.
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:
Review the change, then rerun with --rebind, using the new name if you renamed the target. SOW
records the new settings and continues publishing:
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 TARGETbefore changingmax_cache_ttl, and finish an active conditional delete before changingpublic_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:
To remove the view anyway, retire the target first:
- Stop publishing to the target and remove its entry from
targets:insow.yml. - Run
sow config check. - 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
publishfirst 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 TARGETstopped with a report in progress,publishexits5and 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
sow statusandsow check— confirm the current Generation is the one you mean to deliversow gc— remove superseded files from the target after cache gracesow.ymltargets — provider configuration- Publication & Recovery — phases, recovery, and cache grace in depth
17 - sow retain
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
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:
Any other Generation is rejected with exit 6:
Adding the same Generation again changes nothing, provided its retained record still passes verification.
retain ls
An empty list is a successful result.
retain rm
retain rm releases a Generation by removing its retained record:
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:
- Stop workspace writers.
- Move
.sow/<repo>/retained/<GENERATION>to a backup location outside the workspace. - Run
sow checkagain.
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 needssow changes— compare a Generation with an earlier one- Repository Layout — where retained records live
18 - sow gc
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 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
retainrecord; - 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.
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.
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.
| 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.jsonbefore 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 exits5. - 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 withsow publish TARGETor abandon it with--abort. - Filesystem target paths are checked as for
publish: sibling targets that share a parent directory, such as/srv/www/pgsqland/srv/www/pigsty, do not block each other. - Both forms first finish any interrupted local operation in the repository; pass
--passfileif 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
sow retain— protect a Generation’s package files from local GCsow publish— create target checkpoints and grace deadlines- Publication & Recovery — provider guarantees and cache grace
19 - sow export
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
| 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
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.
Copy versus hard link
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
DIRitself must not be a symlink. - The exported
repomd.xmlalways uses data timestamp0, and there is no--metadata-timestampoption. 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
- Platforms & Integrations — client and tool compatibility
- Repository Layout — source tree and export boundaries
sow publish— deliver the whole repository to configured targets
20 - sow log
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
| 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:
With --json, each entry in result.operations carries the request and the outcome:
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:
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:
Add --json to read the state transitions, timing, packages, memberships, and files under
result.detail. An excerpt:
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:
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.
Operation lifecycle
The state field shows how far an operation got:
| 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:
Omit FILE, or pass -, to write to stdout:
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.
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:
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:
Find failed operations among the 50 most recent:
Archive records, then remove those older than a chosen date:
Find the operation that last touched a Dist:
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
- Observability & Audit — how
logfits withstatus,check, andchanges - Transactions & Recovery — the journal behind these records
sow changes— compare files between builds- JSON Output — the full log result schema