Skip to content

sow add

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

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

Synopsis

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

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

Options

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

Examples

Add two RPMs to el9:

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

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

Import a directory tree in one go and build once:

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

Inputs and targets

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

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

Item statuses

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

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

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

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

Policy: exclude and limit

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

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

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

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

–skip

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

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

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

Package architecture

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

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

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

Partial batches

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

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

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

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

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

Processing order

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

RPM signing modes

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

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

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

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

Exit codes

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

See also

Table reader