This is the multi-page printable view of this section.
Features
- 1: Simple Repositories
- 2: Standard Repositories
- 3: Pool & Metadata Views
- 4: Membership Policy
- 5: Signing Model
- 6: Transactions & Recovery
- 7: Observability & Audit
Generating an index once is easy. The work is in keeping a repository correct while it
changes: new builds arrive every day, old versions and debug packages pile up, the same
package is needed by several distributions, clients expect signatures, and an update must
never leave dnf or apt reading an index whose packages are missing. Each page in this
section takes one of those problems, explains how SOW handles it, and why it is built that way.
Find the page for your problem
| Problem | Read |
|---|---|
You have a directory of packages and need dnf or apt to install from it, with no configuration or database |
Simple repositories |
| You need to decide what each distribution gets, remove packages safely, and know what clients currently see | Standard repositories |
| The same package is needed by several Dists and architectures, and copies waste space and drift apart | Pool and views |
| Old versions, debug packages, and unwanted builds accumulate | Membership policy |
| Clients must verify packages and indexes, and keys change over time | Signing |
| A command or an upload was interrupted halfway | Transactions and recovery |
| You need to know what changed, prove the tree is intact, and read the history | Observability and audit |
Simple and standard repositories compared
SOW builds two kinds of repository. A simple repository is a directory of packages that
sow create indexes in place, with no configuration or database. A standard repository
is one SOW maintains inside a workspace, with named Dists, recorded builds, signing, and
publication. Read the matrix by row: a dash means that kind of repository does not provide
the capability at all, so if you need a row that has a dash under Simple repository, use
a standard repository. Core concepts explains how
to choose.
| Capability | Simple repository | Standard repository |
|---|---|---|
| RPM and DEB indexes | One directory, either or both formats | One repository, separate Dists |
| Stored membership and Generations | — | Yes |
| Per-architecture views | — | Yes, including neutral packages |
| Package exclusions | Fixed cleanup with --pigsty |
Configurable per Dist |
| Version limits | sow prune removes superseded RPMs |
Configurable per Dist |
| Metadata signing | — | RPM and DEB |
| RPM package signing | --sign-with |
never, fill, always |
| Recovery after interruption | Rerun create or prune |
Recorded operations and publication attempts |
| Operation log and JSONL export | — | Yes |
| Publication targets | — | Filesystem and R2 |
SOW parses packages and writes the indexes itself, so it needs no createrepo_c,
dpkg-scanpackages, or reprepro. Only signing uses host tools: RPM package signing runs
the host rpm command with its GPG environment, and metadata signing calls gpg when a key
reference resolves to a GPG key identifier.
Generated formats
The Simple repository column lists the index files sow create writes into the directory. A
standard repository writes the same index files for every architecture view, plus the
additions in the last column.
| Format | Simple repository | Standard repository adds |
|---|---|---|
| RPM | primary, filelists, other XML and repomd.xml |
Architecture views; optional repomd.xml.asc |
| DEB | Packages, Packages.gz (flat APT repository) |
Release, by-hash indexes; optional InRelease and Release.gpg |
RPM XML is gzip-compressed. SOW does not generate SQLite rpm-md, zchunk, modulemd, or source-package indexes; Platforms and integrations explains what that means for each client. SOW writes files only: serve them with your own HTTP server or object storage.
1 - Simple Repositories
Often the packages already exist in a directory: the output of a CI job, an offline bundle
for hosts without Internet access, or a repository that createrepo_c has maintained for
years. What you need is for dnf and apt to install from it, without adopting a
configuration file, a database, or a new directory layout.
A simple repository gives you exactly that. It is a directory of RPM and DEB files that
sow create indexes in place: SOW reads each package once, writes YUM and APT indexes beside the
packages, and keeps no other state, so the directory is the whole repository. Because the
indexes depend only on the package bytes and the options you pass, running the command
again is always the right move. On an unchanged directory it changes nothing; after you add
or remove files it brings the indexes up to date; after an interruption it rebuilds whatever
was left incomplete. Core concepts compares it with
a standard repository.
Create and update
Point sow create at the directory:
The directory now has repodata/ for its RPMs and Packages and Packages.gz for its DEBs,
next to the package files. Serve it over HTTP or use it as a local file:// source.
To update the repository, change the files and run the same command again. If nothing
changed, the new indexes are byte-for-byte identical to the old ones, so SOW leaves the
existing files in place and reports noop=true:
That determinism is deliberate. By default the indexes carry no build time (repomd.xml
uses revision 0 and data timestamp 0) and gzip output is reproducible, so a rerun with
nothing new gives rsync, mirrors, and CDN caches nothing to transfer.
Each package is read once: the same pass computes the SHA-256 recorded in the index and
parses the package header. --jobs sets the number of parallel workers and defaults to the
logical CPU count. Before replacing any index, SOW checks the package list, file identity,
mode, size, and modification time again. If another program changed a package during the
build, the command stops with exit code 5 and replaces nothing, so keep other writers out
of the directory while sow create runs.
Prune superseded RPMs
A directory that receives every CI build keeps every version, and sow create indexes all
of them. sow prune keeps only the highest version of each RPM
name and architecture, and deletes the rest. Preview first:
Versions compare by RPM’s own rules (epoch, version, release, including ~ pre-releases
and ^ snapshots), for both RPM v4 and v6 packages. --protect NAME keeps every version of
an exact package name. In a mixed directory, prune touches only RPMs and leaves the DEB index
as it is.
prune publishes an index that names the retained packages, then removes superseded files. Clients with the previous index may still request those files. For a live repository, prune the publication source and keep old files on the server until client caches expire.
Prune is stricter than create about what it accepts: a live run refuses a signed
repodata/ or a repomd.xml that registers metadata SOW does not generate, such as group.
See Supported repositories.
Inputs and outputs
SOW reads only top-level files whose names end in .rpm or .deb; a symlink to a package
file counts. It does not descend into subdirectories, and it takes each package’s name, version,
and architecture from the package header, not from the file name. Every valid version is
indexed; use sow prune to keep only the newest.
| Input | Generated files |
|---|---|
| RPM | repodata/repomd.xml and gzip-compressed primary, filelists, and other XML |
| DEB | Packages and Packages.gz |
| Both formats | Both sets of indexes |
Index entries point at packages by relative path: an RPM location is the bare file name and
a DEB Filename is ./<file name>. The directory therefore works at any URL, as long as
indexes and packages stay together. A YUM baseurl names the directory itself; on the APT
side it is a flat APT repository with no dists/ hierarchy, so the source line has the form
deb URL ./.
When the last package of a format leaves the directory, SOW deletes that format’s indexes.
Without options, sow create never touches package files or unrelated files; only --pigsty
deletes packages and only --sign-with replaces RPMs. Generated directories get mode 0755 and
generated files 0644.
Publication time for EL7 clients
The zero timestamp that makes output reproducible matters in one case. EL7 YUM rejects metadata whose data timestamp is older than the copy in its cache. When SOW takes over a repository that EL7 clients have already cached with a positive timestamp, pass a publication time in Unix seconds that is at least the last published value, and advance it with every changed update:
The value changes only repomd.xml; the compressed XML, the package files, and the DEB
indexes stay the same. Pass it on every later run, because omitting it resets the timestamp
to 0. Migrate an existing YUM repository shows how to
choose the starting value.
Pigsty cleanup and completion marker
--pigsty builds the simple repositories that Pigsty uses. It adds a fixed cleanup and a
completion marker that consumers can wait for:
- Cleanup deletes DEB packages whose parsed architecture is
i386, and RPM or DEB packages named exactlypatroniat upstream version exactly3.0.4. An RPM is never removed just for beingi386throughi686, and documentation packages such asannobin-docsstay unless a rule matches them. - Marker: after the indexes are in place, SOW writes
repo_complete, one line per retained package in the form<sha256> <file name>(two spaces), sorted by file name.
SOW deletes the old marker before it replaces any public file and writes the new one last.
A directory without repo_complete is therefore incomplete: consumers should wait for the
marker, and the operator should rerun the same --pigsty command. Once a directory has a
marker, sow create without --pigsty refuses to rebuild it (exit 6), so an ordinary run
cannot silently drop the marker. To stop using it, move the marker out of the directory first.
RPM package signing
Packages built in CI are often unsigned, and clients with gpgcheck=1 refuse them.
--sign-with KEY signs them as part of the build:
By default SOW signs only RPMs that have no parseable embedded signature, so packages signed
upstream keep their bytes; add --overwrite to re-sign every retained RPM. Signing needs the
host rpm command and the private key in the local GPG environment. SOW signs a temporary
copy, verifies the new signature and that the package identity and content are unchanged,
then replaces the original before it writes the indexes, so the index always describes the
signed file. This path reads package bytes more than once.
For a protected key, pass --passfile PATH or set SOW_GPG_PASSFILE; neither enables
signing without --sign-with. See Password files for
the file format.
A simple repository has no metadata signing, and sow create leaves an existing
repodata/repomd.xml.asc untouched. If clients verify that signature, sign the new
repomd.xml yourself after each run. For signed metadata and a package-signing policy, use
a standard repository; see Signing model.
Interrupted builds
SOW renders and checks every index in a staging directory before it touches public files, but it then replaces those files one by one, not in a single transaction across all RPM and DEB indexes. An interruption can leave the indexes mixed or incomplete.
Recovery is the same command: rerun it, and SOW removes its stale temporary files and
rebuilds from the packages currently in the directory. There is no journal, so the
recovered result field is always false. If clients read the directory while you
rebuild, build in a separate directory and switch the finished directory into service. When
you need journaled recovery, recorded membership, and build history, use a
standard repository.
Details
Skipped packages and --strict
By default sow create skips, with a warning, any file it cannot index: corrupt or
unreadable packages, source RPMs (src and nosrc), and coordinate conflicts, including
Debian versions that compare equal, such as 1.0-1 and 1.00-1. The remaining packages are
still indexed. Pass --strict to fail before writing anything instead.
- If every candidate of one format fails,
createpreserves its old index. A--pigstyupdate can proceed with the other format if there is no old index to preserve or its marker entries can be carried forward. Otherwise SOW warns and skips the update. - Removing all packages of a format clears its generated indexes on the next ordinary build. A fresh empty directory produces a warning by default and fails under
--strictunless--pigstyis set. - Text output prints warnings to stderr. A successful
--jsonrun reports diagnostics on stdout, with optionalresult.warningsandresult.skippedfields.
Existing repomd.xml and dropped metadata
sow create replaces an existing repomd.xml, so metadata that SOW does not generate, such
as group (comps), updateinfo, or modules, is dropped from the index. SOW names the
dropped types in a stderr warning, or in the dropped_metadata field with --json. Files SOW
did not generate, including an external repomd.xml.asc, stay on disk and must be refreshed
separately. See sow create before taking over such a repository.
RPM index history
SOW keeps the checksum-named RPM metadata of the current and the immediately previous
repomd.xml, so a client that fetched the previous index can still download its metadata
files after an update; older SOW-generated metadata is deleted. The hidden
.sow-plain-rpm-history.json file records the two sets, so keep it with the directory when
you copy it for further builds. Package files are not retained: keeping old packages for
clients with older cached indexes is up to you. See
Keep the previous RPM indexes.
When sow create refuses to run
Both cases exit with code 6:
- The directory is inside a workspace, that is, it or an ancestor holds
.sow/together withsow.ymlorsow.yaml. - The directory contains
repo_complete, or the.sow-prune-repo-completemarker that an interruptedsow pruneleaves, and--pigstyis not set.
Concurrent commands
sow create and sow prune lock the target directory and hold the parent’s lock only
while binding the target, so runs on sibling directories do not block each other. A second
command on the same directory waits for the lock by default; -N fails at once and -T 30s
waits at most 30 seconds, both with exit code 4.
Every option, result field, and exit code is listed in sow create
and sow prune.
2 - Standard Repositories
In a simple repository, whatever files are present is the only truth. That works while something else decides what belongs there, but it cannot express intent. You cannot say “el9 gets these packages and keeps the two newest versions.” You cannot remove a package without deleting a file that clients with a cached index may still request. And after a change, nothing tells you whether what clients see is what you meant to publish.
A standard repository keeps that intent as data. It is a repository that SOW maintains
inside a workspace: one shared package pool, named package sets called Dists (such as el9
or trixie), recorded builds, signing, and publication. You create one with sow repo new.
For each standard repository, SOW records two states:
- The desired state is what each Dist should contain: the packages you added, after the Dist’s exclusion rules and version limit.
- The built state is what clients see: the last completed build, recorded as a Generation with a manifest of every file it wrote.
sow add and sow rm change the desired state, and a build turns it into a new Generation.
Membership changes made with --skip reach the indexes on the next build. During a build that affects several Dists, their public directories switch one at a time. Removing
a package drops it from the next build’s indexes, while its file stays in the pool until no
built, retained, recovery, or publication record needs it. And because both states are
recorded, sow status can tell you at any time whether the repository needs a build.
Core concepts compares it with a
simple repository.
Workspace, repository, and Dist
A workspace is the directory that sow init creates; it can hold several standard
repositories. Each level is the boundary for one concern:
| Level | Boundary for | Holds |
|---|---|---|
| Workspace | Configuration and locking | sow.yml, private .sow/ state, the allowed architecture families |
| Repository | Storage, history, and publication | One package pool, its Dists, a SQLite database, Generations, publication state |
| Dist | Package selection | A named set of packages in one format, rpm or deb, with its own exclusion rules and version limit |
| Architecture view | What one client reads | The index for one architecture of a Dist |
The standard repository is the unit you serve and the unit of history. Everything clients read,
pool/ plus dists/, sits under one repository directory, and a build of any of its Dists
advances that repository’s Generation. Separate repositories never share package files,
history, or cleanup, so content with a different lifecycle, such as infrastructure tools
and database extensions, belongs in its own repository.
The Dist is the unit of selection. One package can belong to several Dists of the same
repository without another copy of its file. A Dist holds one format because RPM and APT
clients read different indexes, and a repository can hold Dists of both formats. Names such
as el9, trixie, and el9-beta are labels you choose: SOW does not check them against
operating systems or build a promotion workflow between them.
Architecture views are derived from the Dist. Each configured architecture gets its own
index, and a neutral package (RPM noarch, DEB all) has one membership in the Dist but
appears in every applicable view. Pool and views explains how one
file serves them all.
Public files and private state
- /srv/repo/workspace
- sow.ymlconfiguration you edit
- .sow/private: databases, locks, journals, pending packages
- demo.db
- demo/
- demo/repository: serve this directory
- pool/
- dists/
Serve or publish the complete repository directory, here /srv/repo/demo/, and keep
sow.yml and .sow/ out of the web root. The three parts belong together: to back up a
working workspace, copy the configuration, the private state, and the package files at the
same time. Repository layout lists every path.
Create and configure
init writes a configuration with schema: sow/v3 and the architecture families x86_64
and aarch64, and creates no repository. The lifecycle commands then maintain sow.yml for
you; after the commands above it reads:
Everything else, such as architecture restrictions, exclusion rules, version limits,
signing, and publication targets, you set by editing sow.yml. Validate after each edit:
config check rejects unknown fields, compares the file with the initialized state, and
resolves signing references. config show prints the effective settings with defaults
expanded, and --all extends it to the whole workspace. You may write amd64 and arm64
for x86_64 and aarch64; DEB indexes still use the Debian names. The sow.yml reference lists every field.
To guard a repository against deletion, set protected: true on it. That blocks
sow repo rm, even with -f, but leaves package and Dist changes available.
Desired state and built state
add and rm normally update the desired state and build the affected Dists in one command.
For a batch, pass --skip to record the changes only, then build once:
Between those commands the two states visibly differ. status reports the repository as
dirty, with the new package files still pending, and sow where shows a package that is
desired in el9 but not yet built there:
After sow build, built_dists=el9 matches dists=el9 and the status is clean.
While a repository is dirty, its public tree still holds the previous Generation, so clients
keep a consistent index while you prepare the next one. New package files wait in the
private .sow/<repo>/pending/ directory until a build moves them into the pool. Changing a
Dist’s policy, architectures, or signing settings in sow.yml also makes it dirty, so run
sow build after such an edit.
A Dist always has an index. A new Dist gets valid empty indexes for each architecture at
once, signed if metadata signing is configured, and removing its last member leaves empty
indexes rather than none, so a client configured for the Dist sees an empty repository
instead of an error. A removed package’s file stays in pool/ for older Generations,
recovery records, and publication targets; sow gc deletes it once
none of them refers to it.
Find the workspace
Workspace commands other than sow init find the workspace the way Git finds a repository:
they search upward from the current directory for sow.yml (or sow.yaml) and, if that
finds nothing, from $SOW_DIR. -C DIR replaces both starting
points with DIR. It changes only where SOW looks, not the
process directory, so relative package paths still resolve from where you are:
The starting directory also picks the repository and Dist when you omit -r and -d: SOW
uses the one that contains the starting directory, or the only one there is. If the choice
is still ambiguous, the command stops with exit code 2 and lists the candidates instead
of guessing. build, check, and status cover every Dist of the repository unless -d
narrows them. The full rules are in Workspace discovery,
Repository selection, and
Dist selection. The simple-repository commands,
sow create and sow prune, never search for a workspace.
Repeat initialization or upgrade
sow init converges; it does not reset. If you declare repositories or Dists in sow.yml
by hand, run init again: it initializes the missing ones and only checks the existing
ones, never resetting their Generations. If it initializes some objects and then fails, it
exits with code 3 and reports what completed; fix the error and run it again. After you
add an architecture to an existing Dist, run sow build to create the new view.
To upgrade an existing workspace, follow the upgrade steps.
Workspaces created by SOW 0.5.0 through 0.8.0 already use 0.9.0’s database schema (v13). For
a workspace created by 0.2.0 through 0.4.0, back up the complete workspace, then run
sow repo migrate. Never edit the SQLite schema
version by hand.
Details
Discovery edge cases
- SOW uses the first configuration file it finds, even an invalid one; it does not skip it and keep searching.
- With
-C DIR, SOW searches only fromDIRand never falls back to the current directory or$SOW_DIR. - A starting point can be a symlink, but the search climbs the path as given, not the
symlink’s target. A symlink inside the workspace disables implicit repository and Dist
selection (exit
2); use the physical path, or pass-rand-d.
Cached package facts
The repository database also caches parsed package facts, so warm builds reuse them,
together with file fingerprints, instead of parsing every package again. sow check reads
and hashes all package bytes, which makes it the full consistency check.
Removing a published Dist or architecture
SOW rejects removing an architecture from sow.yml while membership or built state still
references it. Once a configured publication target has published a Dist or architecture
view, SOW also rejects a dist rm, an architecture removal, or a build that would withdraw
one of that target’s client entry points, such as repomd.xml or Release (exit 6),
because publication never deletes a live entry point from a target. To retire such a view,
remove the target from targets: first, then remove the view, and publish the reduced
repository to a target with a new prefix; see
Removing a published view.
Next, Membership policy covers exclusion rules and version limits, and Transactions and recovery covers interrupted commands.
3 - Pool & Metadata Views
The same package is often needed in several places. A noarch tool shipped to el8 and el9
on both x86_64 and aarch64 sits in four architecture directories of a conventional layout.
Copying it into each one multiplies storage and upload size, and the copies drift apart as
soon as one is replaced and the others are not.
A standard repository stores each package once, under pool/,
identified by the SHA-256 of its contents. Dists and architecture views contain only metadata: indexes whose entries point
back into the pool. Adding a package to another Dist writes index entries, not another file,
so the pool grows only with distinct packages and a publication uploads each one once.
flowchart LR
subgraph dists["dists/ — metadata only"]
v1["el9/x86_64/repodata"]
v2["el9/aarch64/repodata"]
v3["el8/x86_64/repodata"]
v4["el8/aarch64/repodata"]
end
pkg["pool/e/epel-release/<br/>epel-release-7-5.noarch.rpm"]
v1 --> pkg
v2 --> pkg
v3 --> pkg
v4 --> pkgWhen the pool already holds a package, sow add reports it as reused and stores nothing new:
The pool belongs to one repository. Another repository, or a publication target, holds its own copy of the package. Repository layout explains how pool paths are named.
RPM views
An RPM Dist has one metadata directory per configured architecture:
- demo/
- pool/
- c/centos-release/centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm
- e/epel-release/epel-release-7-5.noarch.rpm
- dists/el9/
- x86_64/repodata/
- <sha256>-primary.xml.gz
- <sha256>-filelists.xml.gz
- <sha256>-other.xml.gz
- repomd.xml
- aarch64/repodata/
- ...
- x86_64/repodata/
- pool/
The x86_64 view lists the x86_64 and noarch packages, and the aarch64 view lists the
aarch64 and noarch packages. Both refer to the same noarch file. Each location is
relative to the architecture directory, so it climbs back to the repository root:
A YUM client uses the architecture directory as its base URL, for example
baseurl=https://repo.example.com/demo/dists/el9/$basearch/. sow check verifies that every
indexed location stays inside the repository and resolves to the expected package object.
APT views
APT indexes use paths relative to the repository root:
Each configured architecture has Packages, Packages.gz, and SHA-256 by-hash entries under
dists/<dist>/main/binary-<arch>/. The Dist root holds Release and, when metadata signing is
configured, InRelease and Release.gpg. An APT source therefore names the repository root as
its URIs value and the Dist as its suite.
Architecture all packages appear in each applicable architecture index while their file
stays one pool object. SOW creates no per-view package copies and no per-architecture
Release files.
Deliver the complete repository
The shared pool imposes one rule: clients must reach pool/ and dists/ at the same
relative positions they have on disk. RPM locations climb out of the architecture directory,
and APT Filename values start at the repository root, so serving or copying only
dists/el9/x86_64/, or only dists/, leaves every package download unresolved. Serve the
repository directory itself, here demo/, and copy it whole.
For live updates, use a configured publication target. sow publish uploads packages and
immutable metadata before it switches the client entry points, and handles the cache grace
for old files; see Serve and publish.
For any other transport, copy the complete, settled pool/ and dists/ tree into a new
staging directory, verify the copy, then switch it into service as a unit. Keep the package
URLs that cached indexes reference reachable until those caches expire. sow changes 0 lists
every file of the current build, each pool package once, then metadata, then client entry
points, so it doubles as the manifest to verify against.
Deliver to an isolated host has the
complete procedure.
Removing a Dist or architecture that a target has already published requires retiring that target first; see Removing a published view.
Export for dnf reposync
dnf and apt follow those relative paths without trouble, but default dnf reposync does
not: it confines downloads to one directory per repository and rejects a location that climbs
above it. For that workflow, sow export rpm-leaf writes a standalone copy of one RPM view,
with its own pool/ and an index that uses local paths. The destination’s parent directory
must already exist:
- /srv/exports/el9-x86_64/
- .sow-export.jsoncompletion marker and provenance
- manifest.tsv
- pool/
- c/centos-release/centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm
- e/epel-release/epel-release-7-5.noarch.rpm
- repodata/locations such as pool/e/epel-release/epel-release-7-5.noarch.rpm
The repository needs a completed Generation, no unfinished operation, and no membership
changes waiting for a build; the export always reads the last build.
An RPM Dist whose last build is older than the current Generation still exports, because SOW
carries an unchanged view forward into each new Generation. The destination must be absent
or empty, and it must lie outside the repository, the private state, and the prospective root
(endpoint + prefix) of every configured filesystem target. sow export
lists every condition and exit code.
Export copies files by default. --hardlink requires the same filesystem and makes the
exported packages share the source inodes, so keep them read-only. An export is a separate
delivery artifact: it creates no Dist membership or retained Generation, does not protect
source packages from gc, and is not input to sow publish.
Every path mentioned here is listed in Repository layout.
4 - Membership Policy
Upstream build output usually contains packages you do not want to ship: -debuginfo and
-debugsource RPMs, PostgreSQL -llvmjit subpackages, Debian -dbgsym packages. And a
repository you keep adding to keeps every version it ever received, so the index every client
downloads grows with each release. In a standard repository,
each Dist, a named package set such as el9, has two settings for this: exclude drops
packages that match a rule, and limit keeps only the newest versions of each package.
With this policy, sow add leaves debug and JIT subpackages out of el9, and adding a third
version of a package drops the oldest one from the index in the same operation.
How SOW applies policy
SOW evaluates policy whenever membership can change. add, rm, and build each take the
complete candidate set of every selected Dist, meaning its current members plus any new
inputs, run exclude over it, and then apply limit to what remains. The result depends
only on that set, not on the order in which packages arrived. So adding an older version to a
group that is already full changes nothing: the older version is limited on arrival.
Editing the policy in sow.yml marks the Dist dirty but changes nothing until the next build:
A build applies policy to the current members only, so a policy edit can remove packages from an index but can never add any. See Relaxing a policy.
Exclude packages
An exclude list holds rules. SOW excludes a package when any rule matches. A rule matches
when all of its fields match, and a field matches when any of its patterns matches.
The first rule drops debug and JIT packages on every architecture. The second drops
aarch64 packages whose names start with test- or end with -experimental.
| Field | Package value |
|---|---|
name |
Binary package name |
source |
Normalized source package name |
arch |
x86_64, aarch64, or neutral |
kind |
Classification in the table below |
format |
rpm or deb |
Patterns are case-sensitive exact strings or shell globs (*, ?, [...]). There are no
regular expressions, version comparisons, or negation. sow config check rejects empty
rules, empty or untrimmed patterns, duplicate patterns within a field, and invalid globs.
SOW derives kind from the suffix of the binary package name:
| Format | Name suffix | kind |
|---|---|---|
| RPM | -debuginfo |
debuginfo |
| RPM | -debugsource |
debugsource |
| RPM | -llvmjit |
llvmjit |
| DEB | -dbgsym |
dbgsym |
| DEB | -dbg |
dbg |
| Either | No matching suffix | main |
SOW does not check kind patterns against this table, so a typo such as kind: [debug] is
valid configuration that matches nothing. sow show PACKAGE --json shows the computed
kind of a stored package.
Limit versions
limit: N keeps the newest N versions of each binary package name per architecture.
x86_64 and aarch64 count separately, and neutral packages (noarch or all) form their
own group even when they share a name with an architecture-specific package. The default 0
keeps every version; a negative value is a configuration error.
“Newest” follows each format’s native version ordering, never string comparison. RPM compares
epoch, version, and release with rpmvercmp, including ~ pre-releases and ^ snapshots
(2.0~rc1 < 2.0 < 2.0^20250611 < 2.0.1). DEB uses Debian version ordering. Epoch is compared
first, which can surprise: CentOS 4’s centos-release package has epoch 6, so it ranks above
CentOS 7’s package, which has epoch 0.
Read policy results
sow add reports one line per input, with a result for each selected Dist. In this example,
el9 has limit: 2 and an exclusion rule for epel-*, and already holds centos-release
0:6 and 0:7:
The epoch-6 package outranks both members, so it is accepted and 0:6 leaves the Dist
(memberships=+1/-1). Adding 0:6 back afterwards does nothing, because it is now older
than both members.
An input that no selected Dist accepts has item status excluded. Its per-Dist result says
why: excluded means an exclusion rule matched, and limited means the package fell outside
the version limit. With --json, read .result.items[].status and .result.items[].dists.
Policy results are not failures: they do not count as failed inputs and do not change the
exit code. When you select several Dists, one can accept a package that another excludes.
A new package that no Dist accepts is not stored in the pool.
Relaxing a policy does not restore packages
Raising limit, deleting an exclusion rule, or removing the newest version of a package does
not bring back versions that policy already removed. Policy only filters the candidate set,
and a removed version is no longer in it: SOW tracks current membership, not the packages
that would be members if the rules allowed them. The benefit is that a configuration edit
never puts packages into an index by itself; only add does that.
To restore a version, add its package file again:
Policy removes membership, not package bytes. If a built or retained Generation still needs
the file, it is still in the pool, and add reports it as reused. sow gc
reclaims package files that nothing references; use sow gc TARGET for a publication target.
Preview removal
The preview lists the memberships your references match and the local file changes the
removal would make, including index changes that policy causes, without changing repository
state. In JSON, check prediction_complete before treating the file list as complete.
See sow rm for the options a preview accepts.
See Configuration for the schema and
sow add for all input results.
5 - Signing Model
A package client can check two different things. With DNF repo_gpgcheck=1 or an APT
Signed-By keyring, it verifies the repository metadata: the signed index lists every
package with its checksum, so a mirror, proxy, or CDN that alters an index or a package is
caught before anything is installed. With DNF gpgcheck=1, it verifies the signature inside
each RPM file, which stays with the package wherever the file is copied. The two checks use
different mechanisms and tools and can use different keys, so SOW configures them separately
for each standard repository.
What gets signed
| Setting | Signed content | Output | Client setting |
|---|---|---|---|
signing.rpm.metadata |
RPM index manifest | repodata/repomd.xml.asc |
DNF repo_gpgcheck=1 |
signing.deb.metadata |
APT release manifest | InRelease, Release.gpg |
APT Signed-By |
signing.rpm.packages |
RPM package | Embedded OpenPGP signature | DNF gpgcheck=1 |
SOW signs metadata each time it builds indexes, and metadata signing leaves package bytes
untouched. An RPM package signature is written into the file, which changes its bytes and
SHA-256, so SOW applies it once, when the package enters the pool. SOW does not sign DEB
files: APT trusts a .deb because its checksum appears in the signed index.
Configure metadata signing
This repository has two Dists, or package sets: el9 for RPM and trixie for DEB. They can
share one key or use different keys. If the private key is protected, add
passfile: /run/secrets/gpg-password next to key; see Key references
for other password sources. Then validate, build, and verify:
config check unlocks each metadata key and confirms it can sign, so a wrong password or an
unsuitable key fails here instead of in the middle of a build. check verifies every
signature in the built tree. Without a configured key, SOW writes unsigned indexes. To set up
clients, see Sign your repository.
Key references
A key setting takes one of four reference forms. The form decides where the private key
lives and which program signs with it:
| Reference | Private key | Metadata signed by | Typical use |
|---|---|---|---|
keys/repo.asc |
OpenPGP key file, relative to the workspace root | SOW, in process | A dedicated repository key kept with the workspace |
file:///secure/repo.asc |
OpenPGP key file at an absolute path | SOW, in process | A key mounted as a secret outside the workspace |
env://SOW_METADATA_KEY |
Variable holding armored key material, a file path, or a GPG key identifier | Depends on the value | A key injected by CI |
agent://KEY_ID_OR_FINGERPRINT |
Local GPG keyring or agent | External gpg |
A key that must not leave GPG, such as one on a hardware token |
A key file needs no GPG installation for metadata signing. Any reference that resolves to a
GPG key identifier (a 16-hex-digit key ID or a 40- or 64-hex-digit fingerprint) runs the
external gpg.
For a protected key, SOW reads the password from a file, not from a command-line argument.
It uses the first source that is set: --passfile PATH on the command line, then the key’s
own passfile, then the SOW_GPG_PASSFILE environment variable. The file holds the password
on one line. If the selected file is missing or malformed, the command fails; SOW does not
fall back to another source or a prompt. See Password files
for the exact format, path rules, and the commands that accept --passfile.
Configure RPM package signing
A package signature lets a client verify an RPM on its own, for example after the file has
been copied out of the repository. SOW signs RPMs with the host rpm tool, so install rpm
and gpg and make the private key available in the GPG environment that rpm uses. The
key reference names the signer; it does not import a private key into that environment.
The mode decides what happens to each incoming RPM:
| Mode | Incoming RPM | Choose it when |
|---|---|---|
never |
Stored with its input bytes unchanged | You ship packages exactly as built, or clients do not use gpgcheck |
fill |
Kept as is if its signature verifies with key or a trusted_keys entry; otherwise signed with key |
You mix trusted upstream packages with your own builds; clients import your key and each trusted upstream key |
always |
Kept as is if already signed by key; otherwise re-signed with key |
Every package must verify with your one key |
Without a key the default mode is never; with a key it is fill. Both fill and always
require a key. sow repo new writes mode: never into sow.yml, so when you add a key, also
set mode or delete that line.
Signing happens when a package enters the pool, during add. SOW signs a private copy, so
your input file stays unchanged, and accepts the result only if it carries a valid signature
from key and the package identity and contents, apart from the signature, are unchanged. From then on
the pool object is immutable. A build checks stored RPMs against the current policy but never
re-signs them, because a published package URL must keep serving the same bytes: clients and
caches that hold the previous index expect the previous checksum. So configure package signing
before you import RPMs; enabling it later requires every RPM already in a Dist to satisfy the
new policy.
Change keys
Changing a key reference, or the key it resolves to, marks the affected Dists dirty, so the
next build re-signs their metadata. Changing only a passfile path does not.
For a metadata key, clients reject metadata signed by a key they do not trust, so the order
matters: distribute the new public key to clients, change key in sow.yml, then run
sow build, sow check, and sow publish TARGET.
Package signatures cannot be updated in place, because stored packages are immutable. Rotate a package key in stages:
- Set the new key as
keyand usemode: fill. - Keep the old public key in
trusted_keyswhile packages signed by it remain members. - Add new package releases;
fillsigns the unsigned ones with the new key. - Remove the old key from
trusted_keysafter you withdraw or replace the old packages.
Switching straight to always with a new key works only if every RPM already in a Dist
verifies with that key; otherwise the build is rejected. If a new signature would put
different bytes behind an existing package URL, publish a new release with a new filename.
Renewing a certificate does not invalidate old package signatures. RPM verification checks certificate and subkey validity at each package’s signature time, so keep the historical self-signatures and subkey bindings when you export the renewed public key.
Sign a simple repository
sow create can sign the RPM files of a simple repository, but it does
not sign metadata. KEY_ID is a 16-, 40-, or 64-hex-digit key ID or fingerprint, with an
optional 0x prefix:
By default SOW signs only RPMs with no parseable signature. --overwrite re-signs every
retained RPM. See sow create for the full rules.
Details
Key material. Key files can be ASCII-armored, with human-readable comment lines outside the
armor tolerated, or binary OpenPGP data. Metadata signing accepts RSA, EdDSA (Ed25519 and
Ed448), ECDSA, and DSA keys. A key reference must resolve to exactly one primary key. A
trusted_keys file can hold several complete public keys, including consecutive armored
blocks; SOW reads the whole bundle and rejects malformed or truncated input instead of using
only the first key.
Passwords. All three signing settings accept passfile, including agent:// keys. With an
explicit password file, external GPG unlocks the key non-interactively in loopback mode.
Legacy metadata passphrase references still work at the same priority as passfile, but one
key cannot set both. A password file may be a regular file, a symlink, or a named pipe whose
writer has two seconds to supply the line; SOW removes an optional UTF-8 BOM and one final LF
or CRLF and keeps spaces and tabs. SOW never stores password values in journals, so recovery
selects the source again from the current command and configuration.
What the checks prove. config show displays references and resolved public identities,
never private keys or passwords. config check unlocks metadata key files and checks that
they can sign; external GPG metadata keys also run a signing probe. For RPM package signing it
checks the password file format, the tools, and secret-key availability, but it does not sign
a package or prove the password correct; the first add that signs does. See
config check.
Metadata signatures. New metadata signatures use SHA-256, and the signing key must be valid
both at the publication time and at the current time; historical verification uses the
retained certificate. A new publication requires SHA-256, SHA-384, or SHA-512 in InRelease,
Release.gpg, and repomd.xml.asc, so a workspace upgraded with SHA-1 metadata signatures
needs a build before its next publication; an existing publication attempt resumes with its
recorded files. Signed empty Dists receive the same signature files as populated ones, and the
signed body of InRelease matches Release.
Package reuse. When an import matches an existing package object in coordinate and in the
digest of its contents without the signature, and that object satisfies the current policy, SOW reuses
the stored signed bytes. In never mode, reuse requires an exact byte match.
RPM signature formats. SOW signs with rpm --addsign, or rpm --resign for a package that
already has a signature, and passes --define "_gpg_path $GNUPGHOME" when GNUPGHOME is set.
It verifies RPM v4 and v6 signatures: native v6 RPMSIGTAG_OPENPGP tag 278 (OpenPGP v4 and
v6 signature arrays, including dual- and multi-signed RPMs), RSA, DSA, ECDSA, and EdDSA
signatures in tag 267 (RPMSIGTAG_DSA), and legacy PGP tags, including historical CentOS
OpenPGP v3 and v4 signatures. When tag 278 is present, it is authoritative. See
RPM signatures.
See Sign your repository for an end-to-end setup and Configuration for every signing field.
6 - Transactions & Recovery
A repository update rewrites many files: package files, per-architecture indexes, signatures,
and the pointer files (repomd.xml, InRelease) that clients read first. If an update stops
halfway, through Ctrl-C, a crash, or a full disk, or if two writers run at once, a copy-and-index
script can leave indexes that name packages that are not there, and nobody knows what state the
repository is in. In a standard repository, SOW
journals a change before applying it and allows one writer at a time per repository. A build stages the package files and switches each complete Dist directory atomically. After an
interruption, recovery is usually a single command.
Recover an interrupted operation
Start with the recorded state:
status |
Meaning | Next step |
|---|---|---|
clean |
The built state matches the desired state; nothing is pending | Run sow check before delivery |
dirty |
Committed membership or configuration changes wait for a build | Run sow build |
recovering |
An operation stopped before it finished | Run the recovery command for that operation, listed below |
error |
Recorded state or files need attention | Read the diagnostic, then inspect sow check and sow log |
| Interrupted operation | Recovery command |
|---|---|
add, rm, dist new, dist rm, or build |
sow build -r demo |
init, repo new, or repo rm |
Rerun the same lifecycle command |
| Publication | sow publish TARGET |
| Local or target garbage collection | sow gc -r demo or sow gc TARGET; an interrupted R2 conditional delete resumes with sow gc TARGET --delete |
| Retained Generation removal | sow retain rm GENERATION -r demo |
sow create or sow prune on a simple repository |
Rerun it with the original options |
Repository writers such as add, rm, build, and gc first settle whatever the journal
left pending, so the recovery command is usually what you would run next anyway. An operation
stopped while it was only planned is rolled back; once its inputs are staged, recovery
completes it. Local or target gc and retain rm keep their frozen plan, so rerunning them
finishes the cleanup. Afterwards sow log shows which way it went. Here an add was killed
right after it was planned:
A rolled_back or failed operation committed nothing, so run it again. done or
done_dirty means it took effect; for done_dirty, run sow build.
First correct whatever stopped the command, such as a bad input, a configuration error, or a
full disk, and keep the workspace configuration, database, and .sow/ state together. If
recovery has to sign metadata, it needs the key’s password again, because SOW never stores
passwords in its journals: pass --passfile PATH, rely on the key’s configured passfile, or
set SOW_GPG_PASSFILE (see Password files). For a pending
init, repo new, or repo rm, supply the password through the command line or the
environment and leave sow.yml as it is, because recovery compares it with the journal.
After a local recovery, run sow check -r demo. See Troubleshooting
for common causes and publish for publication recovery.
How a local build switches Dists
Clients read an entry point first, then fetch the metadata and packages it names. A local build makes each new file available before clients can discover it through a new entry point.
- Prepare each affected Dist on the same filesystem. The staged tree includes all architecture views, indexes, client entry points, and configured signatures. It also carries the preceding build’s checksum-named RPM metadata and APT by-hash indexes.
- Install new package files in the public
pool/. The old Dist directories are still available. - Atomically exchange each staged tree with its live
dists/<dist>/directory. All views, indexes, entry points, and signatures for that Dist switch together. - After every affected Dist has switched and the public tree has been checked, record the repository Generation.
A reader can see Dists from different builds while a multi-Dist build is switching them. Clients that just read the old entry point can still fetch the preceding metadata by digest. To keep older builds, see sow retain.
sow build updates the local tree. To deliver a checked build to a live target, use sow publish. It transfers objects in phases, sending packages and metadata before updating client entry points.
What SOW records
| Record | Location | Purpose |
|---|---|---|
| Workspace lifecycle journal | .sow/workspace-ops/active.json |
Coordinates configuration with repository creation or removal |
| Repository operation journal | .sow/<repo>.db |
Records local membership changes, builds, and maintenance |
| Publication state | .sow/<repo>.db |
Records target bindings, frozen publication plans, and progress |
Each repository operation writes its intended scope to the journal before touching anything,
then records its progress as it moves through planned → staged → applied → built → done.
That record is what lets recovery decide between rolling back and finishing, and it is what
sow log shows. Read one operation’s transitions and timestamps with
sow log OPERATION -r demo.
Locks and waiting
Two writers on one repository would interleave their files, so SOW lets only one writer at a time change a repository; a second writer waits for the lock. The wait is unbounded by default, which scripts usually want to limit:
| Option | Behavior |
|---|---|
-T 30s |
Wait up to 30 seconds for a write lock |
-T 0 |
Wait until the lock is available; default |
-N |
Try once; exit immediately if another writer holds the lock |
A failed lock attempt exits 4. Combining -N with a nonzero -T exits 2. Only write
commands accept these options. Read commands that need a consistent snapshot take a shared lock
and wait for the writer; status instead reports locked=true without waiting. See
Exit codes for scripted responses to interruption, lock
contention, and integrity errors.
Details
Operation states
| State | Meaning |
|---|---|
planned |
SOW recorded the operation and its intended scope |
staged |
SOW prepared the inputs for the next stage |
applied |
SOW committed the desired state; the previous Generation can still be the public one |
built |
SOW installed the generated public tree |
done |
The operation is complete |
done_dirty |
SOW committed the desired state and left a build pending |
Other outcomes are rolled_back and failed, and an operation that recovery is finishing shows
recovering; Operation lifecycle defines each one.
--skip normally ends at done_dirty. A recognized signing-policy change, a configuration
change before a build plan freezes, or a supported contract upgrade can also leave a committed
operation dirty; the log records the reason. Correct the configuration if needed, then run
build again. SOW finds the active operation by its pending state, not its timestamp, so a
clock adjustment cannot hide an unfinished operation behind an older completed one.
Errors after a committed change
Database commit and later maintenance are separate steps, so a checkpoint or cleanup error can
occur after package membership or a build has committed. SOW keeps the committed result in the
command output and does not report those items as rolled back. Read the result and
sow status, inspect the operation with sow log, and resume the command named in the
diagnostic. Keep the original input files until you have confirmed the result.
Workspace lifecycle recovery
Recovery of init, repo new, or repo rm compares the current sow.yml digest with the old
and new configurations recorded in the journal. Which one matches decides whether SOW rolls the
change back or finishes it. A digest that matches neither is an integrity error.
Lock files
Workspace lifecycle commands use .sow/workspace.lock, and repository writes use
.sow/repo-locks/<repo>.lock. A command that needs both acquires the workspace lock first.
sow create and sow prune lock the simple repository’s directory and release the parent
directory’s lock as soon as that lock is held, so simple repositories in sibling directories
do not block each other.
Filesystem requirements
The ordering above relies on advisory locks, fsync, and atomic rename, so use a local POSIX
filesystem that provides them; on macOS, use APFS. Do not place a workspace on a network
filesystem. Keep public files and private staging on the same filesystem. SOW rejects
symlinked control paths, unexpected file types, and path escapes, and checks file identity
before it replaces or removes a controlled object.
7 - Observability & Audit
Before you ship a repository you want to know whether it is consistent, what changed since the last delivery, and what happened when. Sometimes you also need an old build’s packages to stay on disk after newer builds stop using them. For a standard repository, SOW answers each question with its own command, from a cheap state lookup to a full re-hash of every file:
| Question | Command | Cost | When to run it |
|---|---|---|---|
| Does the repository need a build or recovery? Is a writer active? | status |
Reads recorded state; hashes nothing | Any time, including before writes and from monitoring |
| Are package bytes, indexes, and signatures consistent and ready for delivery? | check |
Reads and hashes every package file | After a build, before you publish or copy |
| Which local files changed between two builds? | changes |
Verifies the current tree like check, then compares recorded manifests |
When you review a delivery or feed another sync tool |
| Which operations ran, when, and what did they change? | log |
Reads the operation journal | When you investigate a change or archive history |
| Which Generations (completed builds) are explicitly retained? | retain ls |
Reads retention records | Before you collect unused packages |
These commands do not modify repository contents.
In a normal workflow
check is the delivery gate. Exit 0 means every layer passed and the repository is ready to
copy; exit 5 means it is not, and the diagnostic names the failed layer or the pending state.
log is for afterwards, when you need to know which operation changed what.
Inspect state
status reports the desired-state revision, the built Generation, the Dists (package sets such
as el9) that need a build, the count and bytes of pending packages, whether a writer holds the lock, and ready_to_copy, which is true only
when the state is clean and no writer is active.
| State | Meaning |
|---|---|
clean |
The built state matches the desired state |
dirty |
Membership or configuration needs a build |
recovering |
Recorded work needs recovery or cleanup |
error |
Recorded state or file evidence has an unresolved error |
For dirty, run build. For recovering or error, follow the diagnostic and the
recovery procedure. status
exits 0 for every state it can read, so scripts should read the state rather than the exit
code. Because it hashes nothing, ready_to_copy describes the recorded state, not the files;
run check before delivery.
Verify the repository
check ignores cached fingerprints: it reads and hashes each unique package file, checks
every index against the membership it claims, verifies the configured metadata and RPM package
signatures, and compares the public tree with the build’s file manifest. It repairs nothing.
A dirty or recovering repository fails even if its last built tree is intact, because that tree
is not what you asked for; run build and check again. sow check
describes each layer.
Compare Generations
Each row gives the action, the phase, the repository-relative path, and, where applicable, the
size and SHA-256. Phases follow the build order:
payload, metadata, pointer, delete. Because changes verifies the current tree first,
it fails with exit 5 while the repository is recovering or damaged.
changes compares local builds and does not inspect a publication target. Run
sow publish TARGET to update a target and resume interrupted transfers, and target GC to
reclaim remote objects.
Retain Generations and collect unused packages
Package files stay in the pool after they leave the index: clients of the previous build may
still download them, and nothing is deleted until you run sow gc, which removes only files
that nothing needs any more. If you need a particular build’s exact package files and metadata
kept, for example a release you shipped to customers, retain it. SOW verifies the Generation,
saves its metadata and file manifest under .sow/<repo>/retained/, and keeps its package files
out of gc. Retention does
not serve or publish that build; it keeps the material on disk.
retain add accepts only the current built Generation, so retain a build before the next build
replaces it. If status shows generation=42:
When you no longer need it, remove the record with sow retain rm 42 -r demo, then run
sow gc -r demo to collect unused bytes. If retain rm or gc stops partway, rerun the same
command to finish its recorded plan.
Local gc requires a clean repository, so build pending changes first. It keeps every package
still needed by desired or built membership, the membership kept for clients of the previous
build, a retained Generation, recovery, or publication state; see gc
for the complete rules. The previous build’s metadata that ordinary builds keep is separate
from explicit retention. For a publication target, run sow gc TARGET: filesystem targets
delete eligible objects conditionally after the cache grace period, and on R2 the default run
writes a candidate report and sow gc TARGET --delete reclaims eligible objects.
Read and export the log
The log is the operation journal, kept after operations finish. It records each operation’s state and times and, where applicable, its package results, membership changes, and file changes; an operation’s detail can also include build-progress events.
log export writes completed operations as JSON Lines to a new file, or to stdout. log prune
accepts a date or an RFC 3339 timestamp and removes eligible terminal records older than it.
Records that recovery needs and Generation manifests remain, so changes against an older
Generation keeps working.
See JSON output for scripts.