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