Skip to content

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

Return to the regular view of this page

SOW Docs

Build and maintain YUM and APT repositories from RPM and DEB files with one self-contained binary.

SOW builds YUM and APT repositories from RPM and DEB files. Point it at a directory of packages and you get a repository that dnf and apt can install from. Or let SOW maintain the repository for you over time: which packages each distribution gets, how many versions to keep, signatures, build history, and incremental publication to a web server or object storage.

These docs cover SOW 0.9.0. See the release notes for what changed and the upgrade guide for an existing workspace.

Why SOW

Running your own package repository usually means one tool per format, such as createrepo_c for RPM and reprepro or aptly for DEB, held together by scripts that copy files, prune old versions, sign indexes, and upload the result. Those scripts tend to break in the same three places:

  • Duplicated packages. A noarch or all package is copied into every architecture directory of every distribution that needs it. Storage grows and the copies drift apart.
  • Broken updates. Upload a new index before its packages arrive, or delete old packages while clients still cache the old index, and dnf or apt fails with 404s or checksum errors.
  • No history. When an update breaks clients, nobody can say what the repository contained before, or which change caused it.

SOW replaces that toolchain with one executable for Linux and macOS:

  • It parses RPM and DEB packages and writes YUM and APT metadata itself. It does not need createrepo_c, dpkg-scanpackages, or reprepro.
  • It stores each package once per repository. Each distribution and architecture gets its own index, and all of them point at that one copy.
  • It records every build, so you can list what changed, verify the whole tree, and publish only the changed files: packages first, indexes last, old files kept until client caches expire.

Two kinds of repository

A simple repository is a directory you already have. sow create DIR writes indexes next to the packages, with no configuration file and no database. Use it to replace a createrepo_c script or to make an offline package bundle installable.

sow create /srv/repo

A standard repository is one that SOW maintains for you. You create it in a workspace, declare package sets (Dists) such as el9 or bookworm, and add packages to them; SOW applies filters and version limits, builds and signs the indexes, records each build, and publishes updates. Use it for a repository you maintain for months.

sow init /srv/sow && cd /srv/sow
sow repo new local
sow dist new el9 --format rpm
sow add /path/to/packages/*.rpm
sow check

You can start with a simple repository and move to a standard one later; Core concepts compares the two in detail.

Start here

You want to Read
Make a directory of packages installable now Quick start
Replace an existing createrepo_c workflow Migrate an existing YUM repository
Maintain a repository with several distributions Your first standard repository
Serve a repository to other hosts or a CDN Serve and publish
Fix an error or an interrupted command Troubleshooting

How the docs are organized

  • Get Started — Install SOW, build a repository in five minutes, and learn the model.
  • Tutorials — Complete walkthroughs for YUM, APT, signing, serving, and migration.
  • Features — How each mechanism works and why it is built that way.
  • Commands — Every command’s options, output, and exit codes.
  • Reference — sow.yml fields, file layout, JSON output, and compatibility.
  • Design Records — Architecture decisions and their history.

1 - Get Started

Install SOW, turn a directory into a simple repository in five minutes, then build a standard repository.

This section takes you from nothing to a repository that dnf and apt can install from. SOW is a single executable with no service to run, so installation takes a minute. After that, pick the path that matches what you have:

  • You have a directory of packages and want it installable. Follow the Quick start to make it a simple repository: one command, no configuration, about five minutes.

  • You maintain a repository that changes over time, serves several distributions, or needs signing and publication. Follow Your first standard repository, then read Core concepts.

  • Installation — Install from the Pigsty repository, a release package, an archive, or source.

  • Quick start — Index a directory of RPM and DEB files and install from it.

  • Your first standard repository — Serve EL9 and Debian clients from one repository.

  • Core concepts — Simple or standard repository, and the model behind Dists, the pool, and Generations.

1.1 - Installation

Install SOW from the Pigsty repository, a release package, an archive, or source, and upgrade an existing workspace.

SOW is a single executable. It needs no daemon, no database server, and no language runtime, and it parses packages and writes metadata itself, so there is no createrepo_c or dpkg to install either. Choose a channel:

Channel Platforms Choose it when
Pigsty repository Linux, amd64 / arm64 You want apt or dnf to install and update SOW
RPM or DEB package Linux, amd64 / arm64 You need a specific version, or an offline host
Archive Linux and macOS, amd64 / arm64 You are on macOS, or don’t want a system package
Source Linux or macOS (amd64 or arm64) You build your own binaries

Release packages, archives, and SHA256SUMS for SOW 0.9.0 are on the Download page.

From the Pigsty repository

SOW ships in the Pigsty infra repository. This channel is rolling: it installs the SOW version available in the configured repository. Use a tagged release asset when you need an exact version.

# Debian / Ubuntu
sudo tee /etc/apt/sources.list.d/pigsty-infra.list > /dev/null <<'EOF'
deb [trusted=yes] https://repo.pigsty.io/apt/infra generic main
EOF
sudo apt update && sudo apt install -y sow
# RHEL / Rocky / Alma and compatible
sudo tee /etc/yum.repos.d/pigsty-infra.repo > /dev/null <<'EOF'
[pigsty-infra]
name=Pigsty Infra for $basearch
baseurl=https://repo.pigsty.io/yum/infra/$basearch
enabled=1
gpgcheck=0
module_hotfixes=1
EOF
sudo dnf makecache && sudo dnf install -y sow

These examples skip signature checks for the Pigsty source (trusted=yes, gpgcheck=0). In mainland China, replace repo.pigsty.io with the repo.pigsty.cc mirror.

Install a Linux package

Download the package for your architecture and SHA256SUMS, check the package against its line in SHA256SUMS, then install it:

# RPM, x86_64
sudo rpm -Uvh ./sow-0.9.0-1PGSTY.x86_64.rpm

# Debian or Ubuntu, amd64
sudo apt install ./sow_0.9.0-1PGSTY_amd64.deb

For ARM64, use the RPM ending in .aarch64.rpm or the DEB ending in _arm64.deb. The packages install the executable at /usr/bin/sow.

Install an archive

Download the archive and SHA256SUMS into an empty directory. For Linux amd64:

set -euo pipefail
grep -F '  sow_0.9.0_linux_amd64.tar.gz' SHA256SUMS | sha256sum -c -
tar -xzf sow_0.9.0_linux_amd64.tar.gz
sudo install -m 0755 sow /usr/local/bin/sow

On macOS, use darwin_amd64 or darwin_arm64 in the archive name and shasum -a 256 -c - for the checksum. Without root access, install into your home directory instead:

mkdir -p "$HOME/.local/bin"
install -m 0755 sow "$HOME/.local/bin/sow"
export PATH="$HOME/.local/bin:$PATH"   # also add this line to your shell profile

Build from source

You need Go 1.27.4 or newer and Git. SOW builds with CGO_ENABLED=0, so no C compiler is involved.

set -euo pipefail
git clone --branch v0.9.0 https://github.com/pgsty/sow.git
cd sow
SOW_BUILD_DIR="$(mktemp -d)"
CGO_ENABLED=0 go build -trimpath \
  -ldflags='-s -w -X github.com/pgsty/sow/internal/v2cli.Version=0.9.0' \
  -o "$SOW_BUILD_DIR/sow" ./cmd/sow
sudo install -m 0755 "$SOW_BUILD_DIR/sow" /usr/local/bin/sow

Verify the installation

sow version
sow help

sow version prints the version, platform, and Go toolchain, for example sow 0.9.0 linux/amd64 go1.27.4. sow help lists the commands, and sow help COMMAND shows one command’s options as implemented by the binary you have.

Storage and optional tools

The user running SOW needs read access to the input packages and write access to the repository. Put a workspace on a local POSIX filesystem (APFS on macOS); SOW relies on file locks, fsync, and atomic rename, which network filesystems do not reliably provide.

Signing is optional. Depending on how you sign, you may need host tools:

Signing method Required tools
Metadata signing with an OpenPGP key file or key material None
Metadata signing with a GPG key ID or fingerprint gpg and gpg-agent
RPM package signing rpm with a working GPG signing setup

Next: the Quick start for a simple repository, or Your first standard repository.

Upgrade to 0.9.0

Workspaces created by SOW 0.5.0 through 0.8.0 already use database schema v13, so there is no migration: install the new binary, rebuild, and check. Your sow/v3 configuration and public URLs stay as they are.

Warning

Check targets with max_cache_ttl: 0s first. Before 0.9.0, target GC kept superseded files for at least 30 days whatever the TTL. 0.9.0 uses max_cache_ttl as the grace period directly. With 0s, a filesystem target may delete eligible files at its next sow gc TARGET. R2 reports candidates unless you pass --delete. Recorded deadlines still protect older publications.

  1. Stop everything that writes to the workspace.
  2. Back up the complete workspace with a tool that preserves hard links, such as rsync -aH or tar.
  3. For each target with max_cache_ttl: 0s, decide whether clients need a longer window; set the required lifetime in sow.yml before the next publication.
  4. Install SOW 0.9.0.
  5. Build and check each repository listed in sow.yml:
sow version
sow build -r REPOSITORY -C /srv/sow
sow check -r REPOSITORY -C /srv/sow

REPOSITORY is the repository name from sow.yml. A repository with no pending changes produces a no-op build that keeps its Generation number and metadata timestamps, so clients see nothing new.

If you changed the TTL of an already published target, use sow publish TARGET --rebind when you are ready to deliver the checked build. A target that has never been published gets its settings on its first sow publish TARGET.

Local GC plans that were interrupted under 0.7.1 with an empty manifest array resume directly under 0.9.0. Before a downgrade, check the configuration against the target version. Versions through 0.8.0 require the name sow.yml. Versions through 0.6.1 also reject the passfile field.

Workspaces from 0.2, 0.3, or 0.4

Repositories created by 0.2.0, 0.3.0, and 0.4.0 use SQLite schemas v8, v10, and v12 respectively. SOW 0.9.0 can migrate each directly to v13. Stop writers and back up the complete workspace with hard links preserved. After installing 0.9.0, run these commands for each repository.

sow repo migrate REPOSITORY -C /srv/sow
sow build -r REPOSITORY -C /srv/sow
sow check -r REPOSITORY -C /srv/sow

repo migrate reports the old and new schema versions. build refreshes views that need rebuilding and may report noop=true if they are current. Finish by checking the whole repository. To go back to a version that uses the older schema, restore the backup. See sow repo migrate and the 0.9.0 release notes.

Upgrade instructions for earlier releases

Target version Upgrade notes
0.8.0 Finish interrupted 0.7.1 local GC before upgrading.
0.7.1 Existing schema v13 workspaces need no migration.
0.7.0 Check passfile compatibility before downgrading.
0.6.1 No migration from 0.5.0 or 0.6.0.
0.6.0 Check the publication time of simple YUM repositories.
0.5.0 Migrate standard repositories to schema v13.
0.4.0 Migrate a 0.3 workspace.
0.3.0 Migrate a 0.2.0 workspace from schema v8 to v10.

Upgrade a simple repository

A simple repository keeps no database, so upgrading is just installing the new binary. If you are switching an existing YUM repository from another generator to SOW, follow Migrate an existing YUM repository: --metadata-timestamp still defaults to 0, and clients with cached metadata need a timestamp derived from the repository’s publication history.

1.2 - Quick Start

Turn a directory of RPM and DEB files into a repository, serve it, and install a package from it in about five minutes.

In about five minutes you will turn a directory of package files into a repository, serve it over HTTP, and install a package from it with dnf or apt. The result is a simple repository: no workspace, no configuration file, no database. The directory is the repository.

You need:

  • SOW, from Installation;
  • at least one RPM or DEB file;
  • Python 3, for a throwaway web server;
  • a Linux host with dnf or apt for the final install step (on macOS you can still build and check the repository).

Prepare a directory

Copy your packages into a new directory. Use whichever formats you have; one RPM or one DEB is enough.

mkdir -p "$HOME/sow-quickstart"
cp /path/to/example.rpm "$HOME/sow-quickstart/"
cp /path/to/example.deb "$HOME/sow-quickstart/"

Keep the files at the top level: sow create does not look into subdirectories.

Generate metadata

sow create "$HOME/sow-quickstart"

SOW reads every package, then writes the indexes for the formats it found. With one RPM and one DEB:

created /home/you/sow-quickstart: rpm=1 deb=1 signed=0 removed=0 marker=false noop=false recovered=false

The indexes now sit next to your packages, which SOW leaves untouched:

  • sow-quickstart/
    • example.rpm
    • example.deb
    • repodata/YUM/DNF metadata, read through repomd.xml
    • Packagesflat APT index
    • Packages.gz

This is a complete repository. For DEBs it is a flat APT repository: Packages only, without the Release file that signed APT repositories need. Use a standard repository when you want signed APT metadata.

Start a local server

Run this in a separate terminal and leave it running:

python3 -m http.server --bind 127.0.0.1 --directory "$HOME/sow-quickstart" 8080

Check that the entry point for each format you added is reachable:

# RPM
curl --fail http://127.0.0.1:8080/repodata/repomd.xml >/dev/null

# DEB
curl --fail http://127.0.0.1:8080/Packages.gz >/dev/null

This server only listens on the local host. Serve and publish covers a real web server for other machines.

Configure a local client

On the Linux host running the server, add the repository to your package manager. The repository is unsigned, so these examples turn signature checks off; Sign your repository shows how to turn them on.

Replace PACKAGE_NAME with an uninstalled package from your test repository that matches the client architecture. The commands enable only that repository, so its dependencies must already be installed or available there.

Save this as /etc/yum.repos.d/sow-quickstart.repo:

[sow-quickstart]
name=SOW Quick Start
baseurl=http://127.0.0.1:8080/
enabled=1
gpgcheck=0
repo_gpgcheck=0

Load the index and install one of your packages:

sudo dnf --disablerepo='*' --enablerepo=sow-quickstart makecache
sudo dnf --disablerepo='*' --enablerepo=sow-quickstart install PACKAGE_NAME

Save this as /etc/apt/sources.list.d/sow-quickstart.list:

deb [trusted=yes] http://127.0.0.1:8080/ ./

The trailing ./ tells APT this is a flat repository. Load the index and install one of your packages:

sudo apt-get -o Dir::Etc::sourcelist=/etc/apt/sources.list.d/sow-quickstart.list \
  -o Dir::Etc::sourceparts=- update
sudo apt-get -o Dir::Etc::sourcelist=/etc/apt/sources.list.d/sow-quickstart.list \
  -o Dir::Etc::sourceparts=- install PACKAGE_NAME

A successful download and install verifies that the client can use the repository.

Update the repository

To change the repository, change the files and run sow create again:

sow create "$HOME/sow-quickstart"

The output depends only on the package files and options. If nothing changed, SOW reports noop=true and leaves the metadata as it was, so the command is safe to run from cron or CI.

A directory you keep adding RPMs to will collect old versions. sow prune keeps the newest version of each RPM name and architecture, rewrites repodata/, and only then deletes the superseded files. Preview first:

sow prune "$HOME/sow-quickstart" --dry-run
sow prune "$HOME/sow-quickstart"

DEB files and indexes are left alone.

When you’re done, stop the server with Ctrl+C and delete the source file you added to the client.

Note

Replacing a repository that createrepo_c built and clients already use? Read Migrate an existing YUM repository first: clients with cached metadata need a metadata timestamp that never goes backwards.

Next

A simple repository is enough as long as the directory is the whole story. When you need several distributions from one set of files, version limits, signed metadata, build history, or publication to a remote target, continue with Your first standard repository. All options for simple repositories are in sow create and sow prune.

1.3 - Your First Standard Repository

Build a standard repository that serves EL9 and Debian clients from one tree, then check it.

This walkthrough builds one standard repository that serves two kinds of clients: EL9 hosts through a YUM index and Debian hosts through an APT index. Along the way you will meet what a standard repository adds over a simple one: named package sets (Dists), a shared package pool, and a recorded build that you can verify before anyone downloads from it.

You need SOW, some RPM or DEB files (one of each format is enough), and an empty writable directory. The examples use /srv/sow; substitute a path under your home directory if you don’t have write access to /srv.

Initialize the workspace

sow init /srv/sow
cd /srv/sow

init creates the configuration file and the private state directory:

  • /srv/sow/
    • sow.ymlconfiguration you edit (schema: sow/v3)
    • .sow/databases, locks, and recovery records, managed by SOW

Running init again initializes newly declared repositories and Dists and can recreate a missing per-repository lock. If a populated workspace has lost .sow/workspace.lock, follow offline lock recovery.

Create a repository and two Dists

sow repo new local
sow dist new el9 --format rpm
sow dist new bookworm --format deb

local is the repository, the directory you will serve. el9 and bookworm are Dists: named package sets of one format each. The names are labels you choose; for APT clients, bookworm will also be the suite name. These commands record both Dists in sow.yml for you.

Each Dist starts with valid, empty indexes for x86_64 and aarch64, so a client can already point at it:

  • /srv/sow/local/
    • pool/package files, shared by every Dist
    • dists/
      • el9/
        • x86_64/repodata/
        • aarch64/repodata/
      • bookworm/
        • Release
        • main/
          • binary-amd64/Packages, Packages.gz, by-hash/
          • binary-arm64/

Add packages

Tell add which Dist each batch belongs to:

sow add /path/to/packages/*.rpm -d el9
sow add /path/to/packages/*.deb -d bookworm

For each file, SOW reads the name, version, and architecture from the package header, copies the file into local/pool/ once, adds it to the Dist, and rebuilds that Dist’s indexes. The summary line tells you how it went, followed by one item line per input:

add repository=local operation=3572843618681363018 accepted=2 failed=0 memberships=+2/-0 revision=1 generation=3 dirty=false

From now on SOW works from its pool; you can delete or move the original files.

Inspect and verify

sow status
sow ls -d el9
sow check

status should report status=clean ready_to_copy=true: membership and the built files agree, and the tree is ready to serve. ls lists each Dist’s packages with their pool paths. check re-reads every package and index, compares them with the recorded build, and exits 0 only if everything matches. Run it before you ship a build.

Serve the repository

Serve the repository directory /srv/sow/local, never the workspace root: sow.yml and .sow/ must not be reachable over HTTP. Clients need both dists/ and pool/, because the indexes point into the pool.

Serve and publish sets this up with Nginx. The YUM and APT tutorials show the client configuration.

Batch later updates

Each add rebuilds the affected Dists. When you import several batches, skip the build on each one and build once at the end:

sow add /path/to/more/*.rpm -d el9 --skip
sow add /path/to/more/*.deb -d bookworm --skip
sow build

Between the --skip imports and the build, sow status reports dirty and ready_to_copy=false, while the served tree still holds the previous build.

Selection rules

The commands above did not name a workspace or repository because SOW found them: it looks for sow.yml or sow.yaml in the current directory and its parents, and a workspace with a single repository selects it automatically. From another directory, add -C /srv/sow. Once a workspace holds several repositories, add -r local. -d NAME selects a Dist and can be repeated. The full rules are in Commands.

Next

1.4 - Core Concepts

Choose between a simple and a standard repository, and learn the model behind workspaces, Dists, the package pool, and Generations.

SOW builds two kinds of repository and uses a handful of concepts. The first section is enough to choose between them; the rest explains how a standard repository is put together, and why.

Simple or standard repository

The two kinds differ in where the truth about the repository lives.

A simple repository is a directory of package files, and the directory is the state. sow create indexes whatever packages are in it. To change the repository, change the files and run the command again. SOW keeps nothing else, so there is nothing to back up, migrate, or recover except the directory itself.

A standard repository is one that SOW maintains inside a workspace. SOW records what each package set should contain, separately from the files it serves. That record is what lets it enforce version limits, sign indexes, compare builds, recover from interruptions, and publish only what changed.

Need Simple repository Standard repository
Build indexes from packages sow create DIR sow add, which builds automatically
Where the state lives The directory contents sow.yml and private SQLite databases
Organize packages One flat directory; RPM and DEB can coexist Named Dists, one format each
Per-architecture indexes No Yes
Filters and version limits sow prune DIR keeps the newest RPM per name and architecture; --pigsty cleanup exclude and limit per Dist
Sign RPM packages Yes Yes
Sign repository metadata Outside SOW Configured in sow.yml
Build history and publication Outside SOW Built in

Choose a simple repository when something else, such as a CI job or a build script, already decides which files belong in the directory. Choose a standard repository when you want SOW to make and remember those decisions: several distributions, version limits, signed metadata, build history, or publication to a remote target. Switching later is cheap, because sow add takes the same package files.

The CLI uses its own internal names for the two: sow help calls what sow create builds a flat repository, errors from create and prune start with plain:, and most errors from workspace commands contain managed:.

Workspace, repository, and Dist

Standard repositories live in a workspace. Using the names from Your first standard repository:

  • /srv/sow/workspace
    • sow.ymlconfiguration you edit
    • .sow/databases, locks, recovery records (private)
    • local/standard repository: the tree clients read
      • pool/package files, one copy each
      • dists/
        • el9/an RPM Dist
          • x86_64/repodata/
          • aarch64/repodata/
        • bookworm/a DEB Dist
          • main/binary-amd64/ ...

A workspace is the directory that sow init creates: it holds sow.yml and the private .sow/ directory. One workspace usually serves one host or team and can hold several repositories. Commands that operate on standard repositories find it by looking for sow.yml or sow.yaml, which is why this docs site calls them workspace commands.

A repository is what clients see: pool/ plus dists/, served as one tree. It is also the boundary for storage, history, and publication. Each repository has its own pool, its own build history, and its own publication targets, so retention and cleanup in one never affect another. Use separate repositories for content with separate lifecycles, such as infrastructure tools and database extensions.

A Dist is a named set of packages in one format, such as el9 for RPMs or bookworm for DEBs. The name is your label: SOW checks each package’s format and architecture, not whether it suits the operating system the name suggests. APT clients use the Dist name as the suite.

An architecture view is the index that clients of one architecture read, for example dists/el9/x86_64/repodata/. Architecture-neutral packages, RPM noarch and DEB all, appear in every view of their Dist.

Serve the repository directory only. sow.yml and .sow/ must stay outside the web root.

Store each package once

When several Dists or architectures need the same package, a standard repository still stores one file. SOW identifies it by the SHA-256 of its contents and reads its name, version, and architecture from the package header. Every view that includes it gets index entries that point back to that one file under pool/. A noarch package shared by three EL Dists on two architectures is one file, not six, and a publication uploads it once.

Two consequences follow:

  • Serve or copy the complete repository root. RPM indexes reach the pool through relative paths such as ../../../pool/…, and APT Filename entries are relative to the repository root. A single view directory on its own cannot resolve them.
  • Some mirror tools need an export. Default dnf reposync rejects parent-relative paths. sow export rpm-leaf writes a standalone copy of one RPM view for it.

Separate repositories never share a pool. Pool and views covers the layout in depth.

Desired and built state

A standard repository separates deciding what a Dist should contain from producing the files that clients read.

  • Desired membership is the package set selected for each Dist, after filters and version limits.
  • A Generation is one completed build of the repository, with a manifest of every file it produced. The latest one is the built state, the state clients see.
flowchart LR
  input["sow add / sow rm"] --> desired["Desired membership"]
  desired -- "sow build" --> built["Built Generation<br/>pool/ + dists/"]
  built -- "sow publish TARGET" --> target["Publication target<br/>directory or R2"]

add and rm normally update membership and trigger a build. For a batch, pass --skip on each change and run sow build once at the end. Clients keep reading the old indexes until the build switches each affected Dist. Also run sow build after editing filters, architectures, or signing in sow.yml.

A build writes new metadata; packages stay in the shared pool, so keeping history is cheap. These commands work with built state:

Command Use
sow status See whether a build is pending, and whether the tree is ready_to_copy
sow check Verify package bytes, indexes, signatures, and the recorded manifest, without changing anything
sow changes [BASE_GENERATION] List the files that changed between a recorded Generation and the current one
sow publish TARGET Upload the current build to a configured target, changed files only

Repository state

sow status sums up a standard repository in one word:

State Meaning Next action
clean Desired membership and configuration match the built output sow check, then publish
dirty Membership or configuration changed since the last build sow build, then sow check
recovering An interrupted operation is waiting to be finished Run the command the error names; see recovery
error Recorded state and files disagree Read the error and sow log

A dirty repository still serves its previous build, so clients are never left without a working index while you prepare the next one. SOW records each change before applying it, which is why recovery is usually a matter of rerunning a command; see Transactions and recovery.

Continue

2 - Tutorials

Find the walkthrough for your situation: a new YUM or APT repository, a createrepo_c migration, signing, serving, or a multi-channel repository.

Each tutorial is a complete procedure. It starts from package files or an existing repository and ends with a client installing a package from the result. Pick the one that matches what you have and what you need. If SOW is not installed yet, start with Installation.

SOW builds two kinds of repository; Core concepts compares them. A simple repository is a directory of packages that sow create indexes in place. A standard repository lives in a workspace, where SOW maintains its package pool, Dists, recorded builds, and publication. The migration tutorial uses a simple repository; the others build standard repositories.

Which tutorial do I need

Your situation Tutorial
You have RPMs and want a repository that dnf hosts install from and that you keep updating Build a YUM repository
You have DEBs and want the same for apt hosts Build an APT repository
A createrepo_c script maintains your RPM repository, and SOW should take over without breaking clients that cached the old index Migrate an existing YUM repository
Clients must reject indexes or packages that you did not sign Sign your repository
A web server, object storage, or an offline network must receive the repository Serve and publish
You ship both formats for two architectures and need latest, stable, and monthly snapshot channels Build the pigsty-infra repository

If you are new to SOW

Follow this order. Each step assumes what the one before it taught, and the first two take a few minutes:

  1. Quick start: turn a directory of packages into a simple repository.
  2. Your first standard repository: a workspace, a shared package pool, and Dists.
  3. YUM or APT: membership policy, updates, and a real client.
  4. Signing, then serving: what you need before other hosts depend on the repository.
  5. pigsty-infra: a production-shaped repository with several channels.

The migration tutorial stands apart: it needs no workspace.

Follow the examples

Run commands in order. Replace uppercase placeholders and /path/to/ inputs with your own values. Examples under /srv need a directory your user can write to; a path under your home directory works as well.

A Dist is a named package set in a standard repository. Names such as el9, trixie, or rpm are labels you choose: a Dist name becomes the index directory under dists/ and, for APT, the Suites value clients configure. It does not change which operating systems the packages are built for.

The YUM and APT tutorials each start a new workspace. To keep both formats in one repository, create the second Dist in the existing pigsty repository instead of running sow init again, and merge its policy into sow.yml so both Dist definitions remain.

Each tutorial ends with a check that proves the result. For a command error or an interrupted operation, see Troubleshooting.

2.1 - Build a YUM Repository

Build a standard YUM repository with a version policy, install from it with dnf, and keep it updated.

You build or collect RPMs for EL hosts and want dnf install to work against your own repository, today and after every later update. This tutorial builds a YUM standard repository, which SOW maintains in a workspace: one package set, el9, with x86_64 and aarch64 indexes that share a single package pool, a policy that keeps only the newest version and drops debug packages, and a dnf client that installs from it.

You need:

  • SOW 0.9.0 (Installation) and Python 3 for the preview server.
  • RPM files built for your clients, here /path/to/packages/.
  • An empty /srv/sow directory your user can create and write to, or another path.
  • For step 5, an EL host with dnf. The preview listens on 127.0.0.1 only, so run the client on the same host or publish the repository first.

Create the workspace

mkdir -p /srv/sow
cd /srv/sow
sow init .
sow repo new pigsty
sow dist new el9 --format rpm -r pigsty

sow init makes /srv/sow a workspace: sow.yml plus private state. pigsty is the standard repository inside it, the directory tree you will serve. el9 is a Dist: one RPM package set with its own index for each architecture.

Set membership policy

Policy decides which of the packages you add each Dist actually publishes. Edit the generated sow.yml; this example keeps one version per package name and architecture and excludes debug and LLVM JIT packages:

schema: sow/v3
architectures: [x86_64, aarch64]
repos:
  pigsty:
    dists:
      el9:
        format: rpm
        limit: 1
        exclude:
          - kind: [debuginfo, debugsource, llvmjit]
targets: {}

Check the configuration:

sow config check

exclude runs before limit. noarch packages enter every enabled architecture view, and architectures takes CPU architecture names only. See Membership policy for the other filters.

Add RPMs

sow add /path/to/packages/*.rpm -r pigsty -d el9
sow check -r pigsty

add stores each accepted package once in the pool, updates membership, and builds the indexes. It reports one line per package: a file that the policy filters out is reported as excluded without failing the whole command.

The public tree has this shape:

  • /srv/sow/pigsty/
    • pool/
    • dists/el9/
      • x86_64/repodata/
      • aarch64/repodata/

Each repodata/ reaches the packages in pool/ through relative paths, so serve or copy the complete pigsty/ tree, never a single dists/ directory.

Preview over HTTP

Run this in a separate terminal and leave it running:

python3 -m http.server --bind 127.0.0.1 --directory /srv/sow/pigsty 8080

The preview serves the repository root to the same host only. For a persistent service or clients on other hosts, use Serve and publish.

Configure dnf

On the host running the preview, save this as /etc/yum.repos.d/pigsty.repo. For a remote client, publish the repository first and use its public base URL:

# /etc/yum.repos.d/pigsty.repo
[pigsty-el9]
name=Pigsty EL9
baseurl=http://127.0.0.1:8080/dists/el9/$basearch/
enabled=1
gpgcheck=0
repo_gpgcheck=0

dnf expands $basearch to x86_64 or aarch64, so the same file works on both architectures. Signature checks are off because nothing is signed yet.

Refresh and query the repository:

sudo dnf --disablerepo='*' --enablerepo=pigsty-el9 makecache --refresh
dnf --disablerepo='*' --enablerepo=pigsty-el9 list available

The repository works when makecache succeeds and list available shows the packages you added. After the preview, remove the source file and stop the Python server.

Publish or export

To give other hosts access, use sow publish with a filesystem or R2 target. It uploads packages and metadata in the order clients need. The same tutorial covers manual delivery to isolated hosts.

Some mirroring tools, including default dnf reposync, reject rpm-md package locations that climb to the shared pool. For those consumers, export a self-contained RPM leaf for one Dist and architecture:

mkdir -p /srv/export
sow export rpm-leaf el9 x86_64 /srv/export/pigsty-el9-x86_64 -r pigsty

The destination must be absent or empty, and its parent directory must already exist. Export reads the latest build, so run sow build first if membership changes are pending; otherwise it exits 5. sow export lists the full requirements. Export copies package files by default. --hardlink works only on the same filesystem, and the exported files then share storage with the pool, so keep them read-only.

Update the repository

sow add /path/to/new.rpm -r pigsty -d el9
sow check -r pigsty

add builds the update itself. With limit: 1, the newest version replaces the previous member for each package name and architecture. After you change sow.yml, run sow build -r pigsty to apply the new policy.

To withdraw a package, preview the selection with sow rm PACKAGE_NAME -r pigsty -d el9 --check, then repeat without --check. A package name selects all its versions and architectures; use a SHA-256 reference to select one package object.

Next

2.2 - Migrate an Existing YUM Repository

Move a createrepo_c repository to SOW as a simple repository without breaking clients that cached the old index or verify its signature.

Replacing the tool that writes repodata/ looks like a one-line change, but your clients already hold state from the old repository. They have cached its index, they may verify its signature, and they reach it through a fixed URL and repository ID. A new generator that ignores that state works on a fresh test host and fails on every existing one.

This tutorial covers a repository that is one directory of RPMs plus repodata/, as createrepo_c builds it. sow create indexes that directory in place, which makes it a simple repository: no workspace, no configuration file, no database. You choose a publication timestamp newer than anything clients have seen, build and sign a candidate copy, test it against an existing client cache, and then switch over.

You need:

  • SOW 0.9.0 on the build host, plus GPG and Python 3.
  • The live repository, here /srv/yum, and a backup of its packages and metadata.
  • The metadata signing key, if clients use repo_gpgcheck=1.
  • A test client that already has the old repository cached, with its existing .repo file.

What existing clients expect

Client state What fails after a careless switch What this procedure does
A cached repomd.xml EL7 YUM rejects an index whose largest data timestamp is older than the cached one, and sow create writes 0 by default Pass --metadata-timestamp newer than any published value
repo_gpgcheck=1 sow create rewrites repomd.xml but leaves the old repomd.xml.asc in place, so the signature no longer matches Sign repomd.xml after the final create run
gpgcheck=1 Packages must carry signatures the client trusts Keep valid upstream signatures, or deliberately re-sign with your key
A fixed URL and repository ID Changing either discards the cache you need to test against Test the candidate through the original URL and ID

sow create also writes less than createrepo_c in a few places. Check these before you start:

  • It indexes top-level regular RPM files only. Plan nested package layouts separately.
  • It writes primary, filelists, and other XML, with no SQLite databases and no module streams or profiles. Clients that rely on modular filtering keep their existing module_hotfixes=1 setting.
  • If the current repomd.xml lists independent metadata such as comps, updateinfo, or modules, sow create replaces the index without it and reports the dropped types as a warning on stderr, or in dropped_metadata with --json. If clients still need those records, keep that repository on the tool that produces them.

1. Prepare a working copy

Build the migration in a separate working copy, here /srv/yum.candidate, so the live repository stays untouched until you switch. Copy the RPM files rather than hard-linking them if you plan to re-sign them. Then check the binary:

cp -a /srv/yum /srv/yum.candidate
SOW="$(command -v sow)"
"$SOW" version

The version must be 0.9.0.

2. Choose the publication timestamp

Find the largest data timestamp clients may have seen. Read <data><timestamp> from the live repomd.xml and from any retained copies; for one file:

grep -o '<timestamp>[0-9]*</timestamp>' /srv/yum/repodata/repomd.xml |
  tr -cd '0-9\n' | sort -n | tail -1

Use data timestamps, not <revision> or file modification times. If a previous run reset the live index to 0, recover the value from older copies or publication records.

For changed content, the next publication time is:

next time = max(current Unix second, largest known publication time + 1)

EL7 also accepts an equal timestamp; the +1 makes each publication distinguishable. Have your maintenance script serialize updates and save the greatest published timestamp outside the served tree. Save the chosen value before switching the public index: a failed publication then leaves only a harmless gap in the sequence. Keep this record when you restore old content or move the repository to another directory.

For unchanged content, reuse the saved timestamp. create then reports a no-op and the existing signature stays valid. Passing the current time on every run changes repomd.xml each time, so nothing is ever a no-op and every run needs a new signature. The exception is a zero or regressed timestamp: replace it even when content is unchanged.

3. Build and sign a candidate

Set HISTORICAL_MAX to the verified maximum from step 2 and SIGN_KEY to the full fingerprint of your metadata signing key. The Python one-liner picks a strictly newer time:

set -euo pipefail
: "${SOW:?Set the path to the tested SOW binary}"
: "${HISTORICAL_MAX:?Set the verified historical maximum Unix second}"
: "${SIGN_KEY:?Set the full metadata signing fingerprint}"
PUBLISH_TIME=$(python3 -c 'import sys,time; h=int(sys.argv[1]); assert 0 <= h < 253402300799; print(max(int(time.time()), h+1))' "$HISTORICAL_MAX")

"$SOW" create /srv/yum.candidate --metadata-timestamp "$PUBLISH_TIME"
gpg --batch --yes --armor --detach-sign --local-user "$SIGN_KEY" \
  --output /srv/yum.candidate/repodata/repomd.xml.asc \
  /srv/yum.candidate/repodata/repomd.xml
gpg --verify /srv/yum.candidate/repodata/repomd.xml.asc \
  /srv/yum.candidate/repodata/repomd.xml

Record PUBLISH_TIME in your maintenance system before publishing the candidate, and check that the fingerprint gpg --verify reports is the key clients trust.

To sign packages as well, add --sign-with KEY to the create command. It signs unsigned RPMs and keeps existing signatures, including vendor signatures. Add --overwrite to replace every package signature with your key; this changes package bytes, so do it only in the candidate copy. create indexes the signed result, so always generate the detached repomd.xml.asc after the last create run.

For a protected package-signing key, pass --passfile PATH or set SOW_GPG_PASSFILE; see Password files. Those settings do not reach the separate gpg command. For unattended metadata signing, add --pinentry-mode loopback --passphrase-file PATH next to --batch, or use a key the GPG agent has already unlocked.

4. Test the candidate

Point the test client’s original repository URL at the candidate directory. Keep its old cache, repository ID, and signature settings. Refresh the index, then download and install a package. The test passes when the refresh reports no timestamp or signature error and the package installs: that proves cache compatibility, package paths, and signatures together.

If you are migrating an automated update script, also check two cases:

  1. With the same inputs, options, and timestamp, a repeat build reports noop=true, and the existing detached signature still verifies.
  2. After package content changes, the script advances the timestamp and the same client fetches the new package.

When you compare output with createrepo_c, compare dependency meaning and client behavior; XML formatting can differ. See Platforms & Integrations.

5. Publish the repository

sow create replaces several files in place; it cannot switch a whole directory atomically. Let your publication layer switch the tested candidate as a unit, packages and detached signature included, for example with the release-directory switch in Deliver to an isolated host.

SOW keeps the current and the immediately previous checksum-named RPM metadata sets, so a client that read the previous repomd.xml can still fetch its XML. Unchanged runs keep the same previous set. Keep .sow-plain-rpm-history.json when you copy the directory for further builds, because it records those sets. If clients cache indexes across several updates, retain the older metadata and packages they need in your publication layer.

Keep the original backup and the saved maximum publication time. To roll back package content, rebuild and sign it as a newer publication. Restoring an old repomd.xml beside changed RPMs brings the checksum and timestamp failures back.

After the migration

Later updates repeat steps 2 to 5: pick the next timestamp, run create on a candidate copy, sign, test, and switch.

To remove superseded RPM versions, run sow prune with the same --metadata-timestamp rule before signing. It refuses an index that still carries foreign metadata types, and a live run refuses repodata/ that contains repomd.xml.asc. Delete the old signature in the candidate copy, prune, then sign again.

A simple repository relies on the client checks above; sow check works only for standard repositories. Next, see sow create for every option and Sign your repository for how metadata and package signatures fit together. When one directory becomes hard to manage, Your first standard repository shows the alternative.

2.3 - Build an APT Repository

Build a standard APT repository with by-hash indexes, install from it with apt, and keep it updated.

You have DEBs for Debian or Ubuntu hosts and want apt install to work against your own repository, with the same update behavior clients expect from a public archive. This tutorial builds an APT standard repository, which SOW maintains in a workspace: one suite, trixie, with amd64 and arm64 indexes over a single package pool, and an apt client that installs from it.

You need:

  • SOW 0.9.0 (Installation) and Python 3 for the preview server.
  • DEB files built for your clients, here /path/to/packages/.
  • An empty /srv/sow directory your user can create and write to, or another path.
  • For step 5, a Debian or Ubuntu host with apt. The preview listens on 127.0.0.1 only, so run the client on the same host or publish the repository first.

Create the workspace

mkdir -p /srv/sow
cd /srv/sow
sow init .
sow repo new pigsty
sow dist new trixie --format deb -r pigsty

sow init makes /srv/sow a workspace: sow.yml plus private state. pigsty is the standard repository inside it, the directory tree you will serve. trixie is a Dist, one named package set; its name becomes the Suites value in the client’s source configuration.

Set membership policy

If you need filtering or version limits, edit the generated sow.yml. This example keeps one version per package name and architecture and excludes debug symbol packages:

schema: sow/v3
architectures: [x86_64, aarch64]
repos:
  pigsty:
    dists:
      trixie:
        format: deb
        limit: 1
        exclude:
          - kind: [dbgsym, dbg]
targets: {}

Then validate it:

sow config check

Configuration uses the canonical names x86_64 and aarch64 (amd64 and arm64 are accepted as aliases), and SOW writes the Debian amd64 and arm64 indexes from them. Architecture-independent all packages enter both views.

Add DEBs

sow add /path/to/packages/*.deb -r pigsty -d trixie
sow check -r pigsty

add stores each accepted package once in the pool and builds the indexes. The public tree is:

  • /srv/sow/pigsty/
    • pool/
    • dists/trixie/
      • Release
      • main/
        • binary-amd64/
          • Packages
          • Packages.gz
          • by-hash/SHA256/
        • binary-arm64/

The Filename paths in Packages are relative to the repository root, so serve the complete pigsty/ directory. Release declares Acquire-By-Hash: yes, and each index is also stored under by-hash/SHA256/. During an update, a client that already fetched the previous Release still downloads the Packages file that matches it.

Preview over HTTP

Run this in a separate terminal and leave it running:

python3 -m http.server --bind 127.0.0.1 --directory /srv/sow/pigsty 8080

The preview serves the repository root to the same host only. For a persistent service or clients on other hosts, use Serve and publish.

Configure APT

On the host running the preview, save this as /etc/apt/sources.list.d/pigsty.sources. Use arm64 in Architectures on ARM64 clients. For a remote client, publish the repository first and use its public URL:

# /etc/apt/sources.list.d/pigsty.sources
Types: deb
URIs: http://127.0.0.1:8080
Suites: trixie
Components: main
Architectures: amd64
Trusted: yes

URIs points at the repository root, not at dists/. Trusted: yes accepts this unsigned example; Sign your repository replaces it with Signed-By.

Refresh and query it:

sudo apt update
apt-cache policy

The repository works when apt update completes and apt-cache policy lists trixie/main as a package source. After the preview, remove the test source file and stop the Python server.

Publish the repository

To give other hosts access, use sow publish with a filesystem or R2 target. It uploads packages and indexes before it updates Release and its signatures. The same tutorial covers manual delivery to isolated hosts.

Update the repository

sow add /path/to/new.deb -r pigsty -d trixie
sow check -r pigsty

add builds the update itself. With limit: 1, the newest version replaces the previous member for each package name and architecture. After you change sow.yml, run sow build -r pigsty to apply the new policy.

To withdraw a package, preview the selection with sow rm PACKAGE_NAME -r pigsty -d trixie --check, then repeat without --check. A package name selects all its versions and architectures; use a SHA-256 reference to select one package object.

Next

2.4 - Sign Your Repository

Sign repository metadata and, optionally, RPM packages, then make dnf and apt reject anything you did not sign.

An unsigned repository trusts whoever controls the web server or the network path: a modified index or package installs without complaint. Clients close that gap with two independent checks, and you enable each one on its own:

  • Metadata signatures prove that the index came from you. The index records the checksum of every package, so a verified index also exposes a package that was swapped on the server. dnf checks repomd.xml.asc when repo_gpgcheck=1; apt checks InRelease or Release.gpg against the key named in Signed-By.
  • RPM package signatures live inside each RPM. dnf checks them when gpgcheck=1, and they still hold after the file leaves your repository. DEBs have no counterpart: APT trusts package hashes through the signed Release, so DEBs need no package signature.
What is signed SOW output Client setting
RPM metadata repodata/repomd.xml.asc repo_gpgcheck=1
APT metadata InRelease and Release.gpg Signed-By
RPM package Embedded RPM signature gpgcheck=1

In this tutorial you create a dedicated signing key, sign the metadata of the pigsty repository, optionally sign its RPMs, and turn on verification in dnf and apt. Start with metadata signing, which covers both formats; add package signing when clients require gpgcheck=1. Signing model explains the mechanism.

You need:

  • The pigsty standard repository in the /srv/sow workspace, from the YUM or APT tutorial. Run only the commands for the formats and Dists you created.
  • GPG, plus rpm if you sign RPM packages.
  • A client host and a way to publish the repository to it; see Serve and publish.

1. Create a dedicated key

These commands create an unencrypted test key and export it to a private directory outside the public repository tree. For a protected key, see the password note in step 2.

SIGNING_UID='SOW Repository <repo@example.com>'
gpg --batch --pinentry-mode loopback --passphrase '' \
  --quick-generate-key "$SIGNING_UID" rsa3072 sign 2y

FPR="$(gpg --batch --with-colons --list-secret-keys "$SIGNING_UID" \
  | awk -F: '$1 == "fpr" {print $10; exit}')"
test -n "$FPR"

sudo install -d -m 0700 /srv/sow-secrets
sudo chown "$(id -u):$(id -g)" /srv/sow-secrets
gpg --batch --pinentry-mode loopback --passphrase '' --armor \
  --export-secret-keys "$FPR" > /srv/sow-secrets/repo-signing.asc
gpg --armor --export "$FPR" > /srv/sow-secrets/repo-signing.pub
chmod 600 /srv/sow-secrets/repo-signing.asc

SOW reads the private key from /srv/sow-secrets. If SOW runs under a different service account, give that account access to the directory. repo-signing.pub is what you distribute to clients.

2. Configure metadata signing

In /srv/sow/sow.yml, merge these entries into the repository’s existing signing block. Keep its package policy and Dist definitions, and include only the formats you use:

repos:
  pigsty:
    signing:
      rpm:
        metadata:
          key: file:///srv/sow-secrets/repo-signing.asc
      deb:
        metadata:
          key: file:///srv/sow-secrets/repo-signing.asc
    dists:
      # existing Dist definitions remain here

A protected key needs a password source before you check or build. Add passfile: /run/secrets/gpg-password next to key, run export SOW_GPG_PASSFILE=/run/secrets/gpg-password, or pass it for one invocation, as in sow build -r pigsty --passfile /run/secrets/gpg-password. The same works for agent://FINGERPRINT keys. The file holds the password itself on one line; keep it outside the repository, normally with mode 0600. sow.yml stores only the reference, never the secret. Password files gives the priority order and exact format; existing passphrase references keep working.

Validate, rebuild, and check:

cd /srv/sow
sow config check
sow build -r pigsty
sow check -r pigsty

A new key marks the affected Dists dirty, so build signs their metadata again. Metadata signing is in place when sow check passes: it verifies every metadata signature.

3. Optional: inspect the metadata signer

To see the signer with GPG, run the commands for your Dists:

gpg --verify \
  pigsty/dists/el9/x86_64/repodata/repomd.xml.asc \
  pigsty/dists/el9/x86_64/repodata/repomd.xml

gpg --verify pigsty/dists/trixie/InRelease
gpg --verify \
  pigsty/dists/trixie/Release.gpg \
  pigsty/dists/trixie/Release

The fingerprint shown must match the public key you distribute to clients.

4. Optional: sign RPM package bodies

SOW signs an RPM while add imports it and never re-signs packages already in the pool: build only checks stored RPMs against the policy. So in a new repository, configure package signing before you import RPMs. Add this block under the existing signing.rpm configuration:

repos:
  pigsty:
    signing:
      rpm:
        packages:
          mode: fill
          key: agent://REPLACE_WITH_THE_FINGERPRINT
        metadata:
          key: file:///srv/sow-secrets/repo-signing.asc

Replace the placeholder with the 40-hex fingerprint in $FPR. SOW signs through the host rpm command, so install rpm and gpg and make the secret key available in the GPG keyring that rpm uses.

fill signs each newly imported package unless its signature already verifies against the configured key or a key in trusted_keys. SOW verifies both RPM v4 and RPM v6 signatures; Signing model lists the formats, and the configuration reference describes the other modes. SOW signs a private copy, so your input file stays unchanged.

For a protected package-signing key, set passfile under signing.rpm.packages or use SOW_GPG_PASSFILE; a passfile under metadata applies only to the metadata key. config check validates the package-signing prerequisites but does not sign anything, so the password is first tested when an add actually signs a package.

If the pool already holds RPMs, check their signatures before you enable fill, and put trusted upstream public keys in trusted_keys. Unsigned or untrusted stored packages stay as they are: replace them with correctly signed packages that have new versions and file names, or configure signing in a new repository and import the originals there.

Import a new package and check the result:

sow config check
sow add /path/to/new.rpm -r pigsty -d el9
sow check -r pigsty

To inspect a signed package independently, run rpmkeys --checksig on its file in pigsty/pool/.

5. Enable DNF verification

First publish the signed repository. Then transfer the public key to the client through a trusted channel and import it:

sudo install -m 0644 /path/to/repo-signing.pub /etc/pki/rpm-gpg/RPM-GPG-KEY-pigsty
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-pigsty

Enable the checks that match what you signed:

[pigsty-el9]
name=Pigsty EL9
baseurl=https://repo.example.com/pigsty/dists/el9/$basearch/
enabled=1
repo_gpgcheck=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-pigsty

If you signed only metadata, use repo_gpgcheck=1 and gpgcheck=0. With package checks on, install the key of every upstream vendor whose signatures you kept, as well as your own. Then run sudo dnf makecache --refresh and install a package; both succeed only if the signatures verify.

6. Enable APT verification

After publishing the signed repository, install its public key on the client as a dedicated keyring:

sudo gpg --dearmor --yes \
  --output /usr/share/keyrings/pigsty-archive-keyring.gpg /path/to/repo-signing.pub
sudo chmod 0644 /usr/share/keyrings/pigsty-archive-keyring.gpg

Reference it from the deb822 source and remove Trusted: yes:

Types: deb
URIs: https://repo.example.com/pigsty
Suites: trixie
Components: main
Architectures: amd64
Signed-By: /usr/share/keyrings/pigsty-archive-keyring.gpg

On ARM64 clients, set Architectures to arm64. Run sudo apt update and install a package. If verification fails, compare the fingerprint of the client keyring with the signer gpg --verify reports.

RPM signing in a simple repository

In a simple repository, sow create can sign the RPM package bodies, but not the metadata, and a simple repository has no APT Release to sign:

sow create /srv/flat --sign-with 0123456789ABCDEF

Replace 0123456789ABCDEF with your key ID or fingerprint; the matching private key must be available to rpm and GPG. SOW keeps existing signatures, including upstream ones. To replace every signature with your key, add --overwrite on a separate working copy. For a protected key, add --passfile /run/secrets/gpg-password or set SOW_GPG_PASSFILE; a separate gpg command still needs its own credentials. See sow create for key formats.

For an existing YUM repository, the migration guide shows how to keep the publication timestamp and sign repomd.xml after the final create run.

Key changes

To rotate a metadata key, distribute the new public key to clients first, then update the key reference and run build, check, and publish. The changed key marks the affected Dists dirty.

For RPM package keys, use fill and keep the old public key in trusted_keys until the packages it signed are withdrawn or replaced; clients need the old key for that period too. Existing package objects never change. Signing model has the full rotation sequence.

Next

Test the final repository with the dnf and apt versions your users run; see Platforms & Integrations for what is covered automatically. Then serve and publish it.

2.5 - Serve and Publish Repositories

Publish a standard repository to a filesystem target in client-safe order, serve it with Nginx, and deliver updates or offline copies.

Putting a repository on a web server is more than copying a directory. While an update is in flight, a client can read the new index before its packages arrive, or keep using a cached index after you deleted the packages it names. Both show up as 404 or checksum errors in dnf and apt. A hand-written copy script also cannot resume a half-finished upload or tell you what the server actually holds.

For a standard repository, sow publish handles this for you:

  • Client-safe order. It copies package files first, then metadata with content-specific file names, and replaces the entry points that clients read first, repomd.xml and Release, last.
  • Resumable. It records progress, so rerunning the same command finishes an interrupted publication. Rerunning it after success is a no-op.
  • Cache grace before deletion. Files that the new build no longer needs stay on the target for the cache lifetime you declare, so clients holding an old index can still download what it names. Only then can sow gc remove them.
  • Verified delivery. It reads the published files back through the public endpoint before it records the publication.

In this tutorial you publish the local repository to a directory, serve that directory with Nginx, check it from a client, and publish an update. A final section covers hosts that SOW cannot reach.

You need:

  • The local repository and its el9 and bookworm Dists from Your first standard repository, in the /srv/sow workspace.
  • Nginx on the serving host, and sudo to create /srv/repo-public.
  • A dnf or apt client that can reach the server.

The source tree is /srv/sow/local; the public copy will be /srv/repo-public/local. Both hold the complete pool/ and dists/ tree. sow.yml and the private .sow/ state stay outside the server root.

1. Build and check

cd /srv/sow
sow build -r local
sow check -r local

publish delivers the last completed build, so build pending changes first. Continue when check succeeds.

2. Add a filesystem target

Create the target’s parent directory and give the account that runs sow publish, here your own, write access to it:

sudo install -d -m 0755 /srv/repo-public
sudo chown "$(id -u):$(id -g)" /srv/repo-public

The endpoint must already exist as a real directory; SOW rejects a path with a symlink component. Add the target to /srv/sow/sow.yml:

targets:
  public:
    repository: local
    provider: filesystem
    endpoint: file:///srv/repo-public
    prefix: local
    public_endpoint: file:///srv/repo-public/local/
    max_cache_ttl: 0s
    authoritative_workspace: true
    single_writer: true
    exclusive_write_authority: true

SOW creates /srv/repo-public/local from endpoint and prefix. The three authority fields declare that this workspace is the source of truth and the only writer for that path. They default to true when omitted, and an explicit false is rejected. Give other tools their own prefix; sibling targets with distinct prefixes under the same parent directory do not block each other.

public_endpoint and max_cache_ttl tell SOW where clients read the files and how long they may cache them. This example checks the files through file:// and declares no cache, so superseded files get no grace period. Once clients cache older indexes, or you put a proxy or CDN in front, set public_endpoint to the public repository URL and max_cache_ttl to the longest cache lifetime, then apply the change with sow publish public --rebind.

Publish the repository:

sow publish public

For the sample repository, the first run and a repeat print:

published local generation=00000000000000000004 to public (filesystem): phase=grace objects=28
publication local generation=00000000000000000004 to public is already current (noop)

The Generation number and object count depend on your repository. Exit status 0 means the target holds the current build.

3. Configure Nginx

Install Nginx and add a server block like this one, with your hostname in place of repo.example.com:

server {
    listen 80;
    server_name repo.example.com;

    root /srv/repo-public;
    autoindex off;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ (^|/)\. {
        deny all;
    }
}

The last location keeps hidden files, including temporary files, private. Check and reload the configuration:

sudo nginx -t
sudo nginx -s reload

reload assumes Nginx is already running. On a new installation, start it through your service manager once nginx -t succeeds.

Clients use these addresses:

Client Address
DNF baseurl http://repo.example.com/local/dists/el9/$basearch/
APT URIs http://repo.example.com/local
APT Suites / Components bookworm / main

The YUM and APT tutorials show the full source configuration. To verify signatures, distribute the public key as described in Sign your repository.

4. Check client access

Configure a client with the addresses above, refresh its indexes, and install a package. Success proves that both dists/ and pool/ are reachable over HTTP; if only the refresh works, the server treats the two directories differently. Give them the same access rules.

Publish an update

After you change membership or configuration, build and publish again:

sow build -r local
sow check -r local
sow publish public

If publication stops partway, rerun sow publish public to resume it. Once the cache grace period has passed, remove the files that no current build needs from the target:

sow gc public

See sow publish for abort, recovery, and target changes, and target GC for what gc keeps.

Deliver to an isolated host

When SOW cannot reach the destination, you take over the ordering that publish normally provides. Never copy over the live tree: build a complete new release directory and switch to it in one step. Stop all writes to the source repository while you create and check the copy.

  1. Run sow check on the source.
  2. Copy the complete repository to a new release directory on the destination. Preserve hard links, for example with rsync -aH or tar.
  3. Verify the transferred files against sow changes 0, which lists every file of the current build with its size and SHA-256, or against an archive checksum manifest.
  4. Switch the server’s path to the new release directory.
  5. Keep package and immutable metadata URLs that old indexes reference reachable until the longest client cache lifetime has passed, then remove the old release.

During that interval, the HTTP server can fall back to the previous release directory for paths missing from the new one.

Warning

Copying directly over a live tree can expose indexes before their package files arrive. Prepare the new directory first and switch it as a unit.

Serve a simple repository

For a simple repository, serve the directory you passed to sow create, with the same dotfile rule so temporary hidden files stay private. sow publish works only for standard repositories, so switch updates to a simple repository as a unit, as described above.

Publish to R2

For Cloudflare R2, use provider: r2 and configure its endpoint, bucket, credential reference, public URL, and cache lifetime; see the target configuration reference. Publish to a test prefix first and check it from your package clients.

On R2, sow gc TARGET only reports candidates after the cache grace period. If this workspace is the sole writer to the prefix, run sow gc TARGET --delete to reclaim them. See target GC.

Next steps

2.6 - Build the pigsty-infra Repository

Turn an existing dual-architecture RPM and DEB package pool into an infra repository, then validate installs, roll updates, promote to Stable, and take monthly snapshots.

pgsty/infra-pkg builds the Pigsty Infra packages as RPMs and DEBs for x86-64 and ARM64. Users of those packages want three kinds of channel: a rolling latest that gets every new version, a stable channel that moves only when you promote a release, and monthly snapshots that stay fixed. This tutorial builds that infra repository as a standard repository from already-built packages. Each channel is a pair of Dists, one per format; a Dist is a named package set with its own indexes, and all Dists share one package pool. Real dnf and apt clients in containers check each stage.

You need:

  • SOW 0.9.0, jq, and Docker. The client tests run rockylinux:9, ubuntu:24.04, and nginx:alpine containers.
  • Built RPMs and DEBs for both architectures in an infra-pkg checkout at ~/pgsty/infra-pkg/dist/. The install tests use pg-exporter, so include it and any dependencies the client images lack.
  • A new, empty ~/repo directory for the workspace.

1. Put the packages under ~/repo

Copy packages from your infra-pkg checkout into two input directories:

mkdir -p ~/repo/packages/rpm ~/repo/packages/deb
cp ~/pgsty/infra-pkg/dist/rpm/*.rpm ~/repo/packages/rpm/
cp ~/pgsty/infra-pkg/dist/deb/*.deb ~/repo/packages/deb/

Include both x86-64 and ARM64 packages. Step 3 checks their formats and architectures from package metadata.

2. Create the infra repository and two Dists

Initialize a workspace and create the repository named infra:

sow init ~/repo
cd ~/repo
sow repo new infra
sow dist new rpm --format rpm -r infra
sow dist new deb --format deb -r infra

Set limit: 1 for both Dists in ~/repo/sow.yml:

schema: sow/v3
architectures: [x86_64, aarch64]
repos:
  infra:
    dists:
      rpm:
        format: rpm
        limit: 1
      deb:
        format: deb
        limit: 1

limit: 1 keeps only the newest version for each package name and native architecture, so the rpm and deb Dists become rolling latest channels that still carry both x86-64 and ARM64. “Newest” follows native RPM (rpmvercmp, including ~ and ^) and Debian version ordering, so a post-release snapshot such as 2.0^20250611 sorts below 2.0.1.

sow config check

3. Ingest once and build once

Import both package formats, then build their indexes together:

cd ~/repo
sow add ~/repo/packages/rpm --recursive -r infra -d rpm --skip
sow add ~/repo/packages/deb --recursive -r infra -d deb --skip
sow build -r infra -d rpm -d deb
sow check -r infra

After sow check succeeds, list the formats and architectures read from package metadata:

sow ls -r infra -d rpm -d deb --json |
  jq -r '.result.packages | group_by(.format + "/" + .canonical_arch)[] |
    "\(.[0].format)\t\(.[0].canonical_arch)\t\(length) packages"'

The output must include at least:

deb     aarch64   ... packages
deb     x86_64    ... packages
rpm     aarch64   ... packages
rpm     x86_64    ... packages

SOW reports canonical architecture names, so DEB amd64/arm64 appear here as x86_64/aarch64.

4. Read the generated filesystem tree

The important structure is:

  • ~/repo/
    • sow.ymlconfiguration; never serve it
    • .sow/database, locks, recovery; never serve it
    • packages/original input pool; archive as desired
      • rpm/
      • deb/
    • infra/complete public repository root
      • pool/one shared payload pool for RPM and DEB
      • dists/
        • rpm/
          • x86_64/repodata/
          • aarch64/repodata/
        • deb/
          • Release
          • main/
            • binary-amd64/
            • binary-arm64/

SOW places all Dists under dists/ and packages under pool/. Publish or mount the complete ~/repo/infra tree so every Dist can reach its package files.

5. Serve the repository read-only with Nginx

Use the official nginx:alpine image and mount the repository root read-only at /infra:

docker network create --internal infra-lab
docker run --detach \
  --name infra-nginx \
  --network infra-lab \
  --publish 127.0.0.1:8080:80 \
  --volume "$HOME/repo/infra:/usr/share/nginx/html/infra:ro" \
  nginx:alpine

Nginx can see only ~/repo/infra; it cannot see sow.yml or .sow/, and it cannot modify the repository.

6. Install an RPM from only infra on EL9

The Rocky Linux 9 container below connects to the --internal network. The script removes every preconfigured repository and enables only infra, so a successful installation cannot fall back to a public mirror.

docker run --rm --interactive --network infra-lab rockylinux:9 bash -s <<'ROCKY'
set -euxo pipefail

rm -f /etc/yum.repos.d/*.repo
cat >/etc/yum.repos.d/infra.repo <<'REPO'
[infra]
name=Pigsty Infra RPM
baseurl=http://infra-nginx/infra/dists/rpm/$basearch/
enabled=1
gpgcheck=0
repo_gpgcheck=0
REPO

dnf clean all
dnf --disablerepo='*' --enablerepo=infra makecache
dnf --disablerepo='*' --enablerepo=infra install -y pg-exporter
rpm -q --qf '%{NAME}\t%{VERSION}-%{RELEASE}\t%{ARCH}\n' pg-exporter
command -v pg_exporter
ROCKY

An RPM baseurl must point to a concrete architecture view. dnf expands $basearch to x86_64 or aarch64.

7. Install a DEB from only infra on Ubuntu 24.04

APT points URIs at the repository root and uses the Dist name deb as Suites:

docker run --rm --interactive --network infra-lab ubuntu:24.04 bash -s <<'UBUNTU'
set -euxo pipefail

rm -f /etc/apt/sources.list
rm -f /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources
cat >/etc/apt/sources.list.d/infra.sources <<'SOURCE'
Types: deb
URIs: http://infra-nginx/infra
Suites: deb
Components: main
Trusted: yes
SOURCE

apt-get clean
apt-get update
apt-get install -y --no-install-recommends pg-exporter
dpkg-query -W -f='${Package}\t${Version}\t${Architecture}\n' pg-exporter
command -v pg_exporter
UBUNTU

The lab uses unsigned repositories. Follow Sign Your Repository to enable repo_gpgcheck=1 for RPM metadata and Signed-By for APT. Use gpgcheck=1 when RPM package signatures are also available. Remove Trusted: yes from the signed APT source.

Docker containers use the host architecture by default. To test the other architecture, add --platform linux/amd64 or --platform linux/arm64 to the corresponding docker run. Cross-architecture execution requires binfmt/QEMU support.

8. Routine maintenance: add a new version

To update the repository, run add with the new packages. Suppose the four new pg-exporter payloads are ready:

cp ~/pgsty/infra-pkg/dist/rpm/pg-exporter-*.rpm ~/repo/packages/rpm/
cp ~/pgsty/infra-pkg/dist/deb/pg-exporter_*.deb ~/repo/packages/deb/

cd ~/repo
sow add ~/repo/packages/rpm/pg-exporter-*.rpm -r infra -d rpm --skip
sow add ~/repo/packages/deb/pg-exporter_*.deb -r infra -d deb --skip
sow build -r infra -d rpm -d deb
sow check -r infra

Because the latest Dists have limit: 1, the new version wins and the old version leaves that Dist’s desired membership automatically. SOW does not delete the old bytes immediately. Relaxing policy later does not restore the old membership automatically.

Rerun the EL9 and Ubuntu clients from sections 6 and 7, refresh metadata, then install or upgrade to complete the update acceptance test.

To withdraw a bad package, use sow ls -r infra -d rpm --json to find its SHA-256. Preview with sow rm sha256:DIGEST -r infra -d rpm --check, then repeat without --check. Use -d deb for DEBs. A SHA-256 reference selects one package object; a bare name selects all its versions and architectures. sow gc handles unused pool files separately.

9. Two retention layers: latest and stable

limit: 1 makes rpm and deb good rolling channels, but it cannot express “keep every formally released version.” Create two more Dists for that purpose:

cd ~/repo
sow dist new rpm-stable --format rpm -r infra
sow dist new deb-stable --format deb -r infra
sow config show -r infra -d rpm-stable -d deb-stable

The new Dists default to limit: 0, which means retain every version. The resulting policy is:

Dist Format limit Role
rpm RPM 1 RPM latest
deb DEB 1 DEB latest
rpm-stable RPM 0 Accumulate promoted RPMs
deb-stable DEB 0 Accumulate promoted DEBs

Stable accumulates the versions you explicitly promote after creating the Dists.

10. Promote latest into stable

Promote packages by adding the source Dist’s pool files to the target Dist. SOW verifies and reuses the existing package objects, so promotion adds no second copy. Pause other repository writers before exporting the manifests. Resume them after promotion finishes.

First require clean source state and save the promotion manifests:

set -euo pipefail
cd ~/repo
sow check -r infra
mkdir -p ~/repo/manifests

sow ls -r infra -d rpm --json |
  jq -r '.result.packages[].pool_path' > ~/repo/manifests/rpm-latest-202608.list
sow ls -r infra -d deb --json |
  jq -r '.result.packages[].pool_path' > ~/repo/manifests/deb-latest-202608.list

Add the recorded pool objects to the stable Dists:

cd ~/repo
(
  set -euo pipefail
  while IFS= read -r pool_path; do
    sow add "$HOME/repo/infra/$pool_path" -r infra -d rpm-stable --skip
  done < ~/repo/manifests/rpm-latest-202608.list

  while IFS= read -r pool_path; do
    sow add "$HOME/repo/infra/$pool_path" -r infra -d deb-stable --skip
  done < ~/repo/manifests/deb-latest-202608.list

  sow build -r infra -d rpm-stable -d deb-stable
  sow check -r infra
)

Each add should report reused. If the loop stops midway, the source Dists stay unchanged. Fix the failure and rerun the same manifest. Over subsequent promotions, rpm/deb retain only the latest version while rpm-stable/deb-stable accumulate release history.

11. Take the 2026-08 snapshot from stable

A client-visible monthly snapshot is another pair of Dists:

cd ~/repo
sow dist new rpm-202608 --format rpm -r infra
sow dist new deb-202608 --format deb -r infra
sow config show -r infra -d rpm-202608 -d deb-202608

Pause other repository writers while creating the snapshot. First save the stable package lists:

set -euo pipefail
sow check -r infra
sow ls -r infra -d rpm-stable --json |
  jq -r '.result.packages[].pool_path' > ~/repo/manifests/rpm-stable-202608.list
sow ls -r infra -d deb-stable --json |
  jq -r '.result.packages[].pool_path' > ~/repo/manifests/deb-stable-202608.list

Add those manifests to the corresponding snapshot Dists:

cd ~/repo
(
  set -euo pipefail
  while IFS= read -r pool_path; do
    sow add "$HOME/repo/infra/$pool_path" -r infra -d rpm-202608 --skip
  done < ~/repo/manifests/rpm-stable-202608.list

  while IFS= read -r pool_path; do
    sow add "$HOME/repo/infra/$pool_path" -r infra -d deb-202608 --skip
  done < ~/repo/manifests/deb-stable-202608.list

  sow build -r infra -d rpm-202608 -d deb-202608
  sow check -r infra
)

To keep this build after you eventually remove the snapshot Dists, also retain the current Generation of the repository:

sow retain add "$(sow status -r infra --json | jq -r '.result.built_generation')" -r infra
sow retain ls -r infra

retain stores this build’s metadata and protects its package files from garbage collection. Clients still use the snapshot Dists. SOW does not make these Dists read-only; keep their membership and effective configuration unchanged to preserve their contents.

12. Client address map

One Nginx service and one shared infra/pool support every channel:

Channel dnf baseurl APT URIs / Suites
latest http://infra-nginx/infra/dists/rpm/$basearch/ http://infra-nginx/infra / deb
stable http://infra-nginx/infra/dists/rpm-stable/$basearch/ http://infra-nginx/infra / deb-stable
2026-08 http://infra-nginx/infra/dists/rpm-202608/$basearch/ http://infra-nginx/infra / deb-202608

Use sow dist ls -r infra to see all six Dists.

The rolling Dists keep the latest packages, stable Dists accumulate promoted releases, and monthly Dists keep the selected snapshot. All views share the same package pool.

Stop the temporary service when the lab is complete:

docker rm --force infra-nginx
docker network rm infra-lab

Next

The lab serves the repository through a read-only bind mount. For real clients, publish it to a filesystem or R2 target with Serve and publish, which keeps old files available while clients still cache older indexes, and add signatures with Sign your repository.

3 - Features

The repository-maintenance problems SOW solves, what simple and standard repositories each provide, and which page explains each mechanism.

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.

3.1 - Simple Repositories

A simple repository is a directory of RPM and DEB files that sow create indexes in place, with no configuration or database: create it, keep it current by rerunning one command, and prune or sign RPMs.

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:

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

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:

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

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:

sow prune /srv/offline --dry-run
would remove centos-release-6-0.el6.centos.5.x86_64.rpm (keep centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm)
preview /srv/offline: kept=2 candidates=1 removed=0 index_updated=false noop=false
warning: directory also contains DEB packages; prune operates on RPM packages only

sow prune /srv/offline
removed centos-release-6-0.el6.centos.5.x86_64.rpm (keep centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm)
pruned /srv/offline: kept=2 candidates=1 removed=1 index_updated=true noop=false
warning: directory also contains DEB packages; prune operates on RPM packages only

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:

sow create /srv/offline --metadata-timestamp 1791849600

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:

sow create /srv/offline --pigsty
  • Cleanup deletes DEB packages whose parsed architecture is i386, and RPM or DEB packages named exactly patroni at upstream version exactly 3.0.4. An RPM is never removed just for being i386 through i686, and documentation packages such as annobin-docs stay 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:

sow create /srv/offline --sign-with 6D5C5A26C36B1F73

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, create preserves its old index. A --pigsty update 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 --strict unless --pigsty is set.
  • Text output prints warnings to stderr. A successful --json run reports diagnostics on stdout, with optional result.warnings and result.skipped fields.

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 with sow.yml or sow.yaml.
  • The directory contains repo_complete, or the .sow-prune-repo-complete marker that an interrupted sow prune leaves, and --pigsty is 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.

3.2 - Standard Repositories

A standard repository is one that SOW maintains inside a workspace: why it records what each Dist should contain separately from what clients see, how workspaces, repositories, and Dists fit together, and the add, rm, and build workflow.

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

Workspace
└── Repository
    └── Dist
        └── Architecture view

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

sow init /srv/repo
sow repo new demo -C /srv/repo
sow dist new el9 --format rpm -r demo -C /srv/repo
sow dist new trixie --format deb -r demo -C /srv/repo

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:

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

Everything else, such as architecture restrictions, exclusion rules, version limits, signing, and publication targets, you set by editing sow.yml. Validate after each edit:

sow config check -C /srv/repo
sow config show --all -C /srv/repo

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:

sow add ./incoming/ -C /srv/repo -r demo -d el9 --skip
sow status -C /srv/repo -r demo
sow build -C /srv/repo -r demo
sow check -C /srv/repo -r demo

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:

sow status -C /srv/repo -r demo
repository=demo status=dirty ready_to_copy=false revision=1 generation=2 dirty_dists=el9 pending=2/38040 locked=false

sow where epel-release -C /srv/repo
reference="epel-release" locations=1
repository=demo coordinate="rpm:epel-release-0:7-5.noarch" sha256:d6f332ed157de1d42058ec785b392a1cc4b5836c27830af8fbf083cce29ef0ab dists=el9 built_dists=

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:

sow add ./build/example.rpm -C /srv/repo -r demo -d el9

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 from DIR and 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 -r and -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.3 - Pool & Metadata Views

How a standard repository stores each package once and still gives every Dist and architecture its own index, and what that means for serving, copying, and dnf reposync.

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

When the pool already holds a package, sow add reports it as reused and stores nothing new:

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

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/
        • ...

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:

<location href="../../../pool/e/epel-release/epel-release-7-5.noarch.rpm"/>

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:

Filename: pool/libp/libpqtypes/libpqtypes0_1.5.1-9.pgdg22.04+1_arm64.deb

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:

mkdir -p /srv/exports
sow export rpm-leaf el9 x86_64 /srv/exports/el9-x86_64 -r demo
exported RPM leaf el9/x86_64 generation=00000000000000000005 method=copy packages=2 to /srv/exports/el9-x86_64
  • /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.

Warning

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.

3.4 - Membership Policy

Keep debug and JIT subpackages out of your indexes and cap how many versions of each package a Dist keeps.

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.

repos:
  demo:
    dists:
      el9:
        format: rpm
        limit: 2
        exclude:
          - kind: [debuginfo, debugsource, llvmjit]

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:

sow config check
sow status -r demo    # status=dirty dirty_dists=el9
sow build -r demo     # applies the new policy to existing members

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.

exclude:
  - kind: [debuginfo, debugsource, dbgsym, dbg, llvmjit]
  - name: ["test-*", "*-experimental"]
    arch: [aarch64]

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:

sow add rpms/centos-release-4-0.1.x86_64.rpm rpms/epel-release-7-5.noarch.rpm -r demo
add repository=demo operation=6919779572306201678 accepted=1 failed=0 memberships=+1/-1 revision=2 generation=4 dirty=false
item input="rpms/centos-release-4-0.1.x86_64.rpm" status=accepted format=rpm coordinate="centos-release-6:4-0.1.x86_64" sha256:7886102c... dists=el9:accepted
item input="rpms/epel-release-7-5.noarch.rpm" status=excluded format=rpm coordinate="epel-release-0:7-5.noarch" sha256:d6f332ed... dists=el9:excluded

sow add rpms/centos-release-6-0.el6.centos.5.x86_64.rpm -r demo
add repository=demo operation=2344830323726248547 accepted=0 failed=0 memberships=+0/-0 revision=2 generation=4 dirty=false
item input="rpms/centos-release-6-0.el6.centos.5.x86_64.rpm" status=excluded format=rpm coordinate="centos-release-0:6-0.el6.centos.5.x86_64" sha256:ffd9e7bd... dists=el9:limited

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:

sow add ./archive/example-1.0-1.x86_64.rpm -r demo -d el9

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

sow rm example -r demo -d el9 --check

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.

3.5 - Signing Model

Sign repository metadata so clients catch a tampered mirror, sign RPM files so each package carries its own proof, and rotate keys safely.

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

repos:
  demo:
    signing:
      rpm:
        metadata:
          key: file:///secure/repo-signing.asc
      deb:
        metadata:
          key: file:///secure/repo-signing.asc
    dists:
      el9:
        format: rpm
      trixie:
        format: deb

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:

sow config check
sow build -r demo
sow check -r demo

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.

signing:
  rpm:
    packages:
      mode: fill
      key: agent://7F721C4AD40F4A9D8CA578BFAC7E4690B50CCF3B
      trusted_keys: [keys/upstream.asc]

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:

  1. Set the new key as key and use mode: fill.
  2. Keep the old public key in trusted_keys while packages signed by it remain members.
  3. Add new package releases; fill signs the unsigned ones with the new key.
  4. Remove the old key from trusted_keys after 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:

sow create /srv/offline --sign-with KEY_ID --passfile /run/secrets/gpg-password

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.

3.6 - Transactions & Recovery

Inspect an interrupted repository operation, resume it, and see how local builds switch each Dist.

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:

sow status -r demo
sow log -r demo
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:

sow status -r demo
repository=demo status=recovering ready_to_copy=false revision=3 generation=5 dirty_dists= pending=0/0 locked=false

sow build -r demo
build repository=demo dists=el9 already current (noop) revision=3 generation=00000000000000000005 dirty=false

sow log -r demo
repository=demo operations=7
ID	KIND	STATE	CREATED	UPDATED
7292569097943274424	build	done	2026-11-27T08:38:25Z	2026-11-27T08:38:25Z
5457885375845821029	add	rolled_back	2026-11-27T08:38:20Z	2026-11-27T08:38:25Z
...

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.

stage and validate Dists → install packages in pool/ → switch each Dist directory → record the Generation
  1. 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.
  2. Install new package files in the public pool/. The old Dist directories are still available.
  3. Atomically exchange each staged tree with its live dists/<dist>/ directory. All views, indexes, entry points, and signatures for that Dist switch together.
  4. 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

planned → staged → applied → built → done
                       └────────────→ done_dirty
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.

3.7 - Observability & Audit

Find out whether a repository is ready to ship, what changed between builds, and what happened when, and keep an old build’s packages from being collected.

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

sow add ./incoming/*.rpm -r demo -d el9    # import and build
sow status -r demo                          # status=clean: nothing pending
sow check -r demo                           # exit 0: ready to deliver
sow changes -r demo                         # what this build changed
sow publish TARGET

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

sow status -r demo

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

sow check -r demo
repository=demo status=clean ready_to_copy=true revision=4 generation=6
config	ok=true	checked=3
state	ok=true	checked=1
public-modes	ok=true	checked=25
retained	ok=true	checked=0
package-bytes	ok=true	checked=4
desired-membership	ok=true	checked=4
index	ok=true	checked=1
signature	ok=true	checked=10
generation-manifest	ok=true	checked=1

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

sow changes -r demo               # current build against its predecessor
sow changes 0 -r demo             # the complete current tree
sow changes 42 -r demo --json     # recorded Generation 42 against the current build
sow changes -r demo
base=5 generation=6 dirty=false
add	payload	pool/c/centos-release/centos-release-7-2.1511.el7.centos.2.10.x86_64.rpm	23516	b4111ef2...
add	metadata	dists/el9/x86_64/repodata/fbf323c7...-primary.xml.gz	1607	fbf323c7...
update	pointer	dists/el9/x86_64/repodata/repomd.xml	1541	8fef2510...
delete	delete	dists/el9/x86_64/repodata/b71da59c...-primary.xml.gz	0

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:

sow retain add 42 -r demo
sow retain ls -r demo

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

sow log -r demo
sow log OPERATION -r demo
sow log export operations.jsonl -r demo
sow log prune 2026-01-01 -r demo

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.

4 - Reference

Look up sow.yml fields, package references, file paths, exit codes, JSON fields, platform support, and fixes for common errors.

These pages hold the exact facts that the tutorials and feature pages summarize: every sow.yml field and its default, every path SOW writes, every exit code and JSON field a script can rely on, and what to do when a command fails. Come here when you need a precise answer rather than an explanation. For a command’s flags and output, see Commands or run sow help COMMAND.

Example conventions

Command blocks omit the shell prompt so you can copy them. In syntax descriptions, uppercase words such as NAME and DIR are placeholders, square brackets mark optional arguments, ... marks a repeatable argument, and | separates alternatives.

Paths, IDs, hashes, timestamps, and counts in sample output depend on the workspace. Treat operation and Generation IDs as strings; see JSON output.

4.1 - Troubleshooting

Match an error message, status value, exit code, or client failure to its cause and the commands that fix it.

Find what you are seeing in the table below and jump to its section; each one names the likely cause and the commands that fix it. The examples use /srv/sow for the workspace, pgsql for the repository, and prod for the publication target; replace them with yours.

Collect the state before changing anything. status says whether the repository is clean, dirty, recovering, or in error; log shows recent operations and which one failed. Error messages keep SOW’s internal names: most errors from workspace commands (those that work on standard repositories) carry managed: after the error category, as in operation rejected: managed: operation rejected: …, and errors from create and prune, which work on simple repositories, start with plain:.

sow version
sow status -C /srv/sow -r pgsql
sow log -C /srv/sow -r pgsql
What you see Go to
configuration error, or config check exits 2 or 6 The configuration is rejected
status shows dirty; check exits 5 without naming a damaged file Status shows pending changes
status shows recovering, a command exited 130, or a process was killed A command was interrupted
A nonzero exit, but the output lists committed packages or a new Generation Errors after a committed change
publish says the target is already bound Target configuration changed
Exit 5 with a target publication must roll forward, write-active publication attempt, or unfinished ... report Publication and target GC wait for each other
Exit 6 with mutation would withdraw published pointer A change would withdraw a published file
A write command hangs, or exits 4 A command waits for a lock
A password prompt, signing credential is unavailable, or a key unusable for signing A signing key asks for a password or cannot unlock
add, build, or check rejects a package file, signature, or path Other validation failures
dnf, yum, or apt cannot sync, install, or sees old content Client errors
repository schema migration required, or trouble right after an upgrade After upgrading

The configuration is rejected

Every workspace command reads sow.yml first, so one mistake there stops all of them. Run the check alone to see the first problem and the field it names:

sow config check -C /srv/sow

Exit 2 means the file itself is invalid: a YAML error, an unknown field (often a typo or wrong indentation), a bad name, or a value outside its rule. Exit 6 means the file is valid but contradicts recorded state or cannot resolve a signing key. The usual cause is a repository or Dist deleted from the file by hand, or an architecture removed while packages or built Generations still use it. Put the entry back; remove a repository or Dist with sow repo rm or sow dist rm instead. A changed Dist format exits 5; a Dist’s format is fixed once it exists. The configuration reference lists every field’s rule.

Status shows pending changes

status reports dirty and lists dirty_dists, and check exits 5 although nothing is damaged. add --skip, rm --skip, or a configuration edit committed a desired state that has not been built yet. Clients still get the last built indexes, which are consistent but are not what you declared. Build and check:

sow build -C /srv/sow -r pgsql
sow check -C /srv/sow -r pgsql

A local build updates the workspace only. To update a configured target as well, run sow publish prod -C /srv/sow. See sow status for each field.

A command was interrupted

A command exited 130, was killed, or lost power, and status may show recovering. A standard repository journals each change before applying it, so an interrupted operation stays pending until a later command finishes it or rolls it back. First fix whatever the diagnostic reports (a full disk, a missing input, unreachable storage), then run the command that recovers that operation:

Interrupted Run
sow create (simple repository) The same command, with the same --pigsty, --metadata-timestamp, and signing options
sow prune (simple repository) The same command, with the same --protect and --metadata-timestamp options
add, rm, a Dist change, or build sow build -C /srv/sow -r pgsql; committed desired-state changes stay part of the pending build
init, repo new, or repo rm The same lifecycle command again
Local gc or retain rm sow gc or sow retain rm GENERATION again
R2 target deletion sow gc prod --delete
publish sow publish prod, described below

If recovery has to sign metadata with a protected key, supply the password again: journals never store it. Use --passfile PATH or SOW_GPG_PASSFILE on the recovery command; per-key passfile settings still apply. Do not edit sow.yml while an init, repo new, or repo rm is pending, because recovery compares the file with the journal and stops with an integrity error if it matches neither the old nor the new version. See Password files.

For an interrupted publication, restore access to the storage and the public endpoint, then run the same target again. SOW resumes the saved attempt rather than starting over:

sow publish prod -C /srv/sow

Before the attempt records its commit intent, you can abandon it with sow publish prod --abort -C /srv/sow. After commit intent, only rerunning publish finishes it, and --abort exits 6, as it does when there is no attempt to abandon. Until the publication finishes, local changes and target GC wait for it; see Publication and target GC wait for each other, publish, and Transactions and recovery.

Errors after a committed change

A command exits nonzero, yet its output lists accepted packages or a new Generation. Database commit and the maintenance that follows (a checkpoint, a cleanup) are separate steps, so the second can fail after the first succeeded. SOW reports the committed items as committed, not rolled back. Read the result and sow status, inspect the operation with sow log, and run the command the diagnostic names. Keep the original input files until you have confirmed the result.

Target configuration changed

sow publish exits 1 with one of these messages:

  • already bound with different mutable configuration; rerun publish with --rebind after operator review
  • already bound to different storage or prefix; configure a new target name

The first publish recorded the target’s binding, and sow.yml no longer matches it. Compare the file with what you intended. If you meant to change the target name, public_endpoint, or max_cache_ttl, accept the change:

sow publish prod --rebind -C /srv/sow

A different repository, provider, endpoint, region, bucket, or prefix cannot be rebound; configure a new target under a new name. Finish pending target maintenance before changing the TTL. See Changing a target.

Publication and target GC wait for each other

A publication works from a frozen plan of the local tree, and publication and target GC both change what the target holds. So an unfinished publication blocks local changes and target GC, and an unfinished target GC report blocks publication. Each case exits 5 and names the command that finishes the pending work:

Message Reported by Run
a target publication must roll forward before Repository bytes can change add, rm, build, dist new/rm, repo rm, init sow publish prod, or sow publish prod --abort before commit intent
target "prod" has write-active publication attempt ... gc prod sow publish prod, or --abort before commit intent
target "prod" has an unfinished candidate report; resume with gc prod publish prod sow gc prod
target "prod" has an unfinished conditional-delete report; resume with gc prod --delete gc prod (R2) sow gc prod --delete

Then rerun the command that was blocked.

A change would withdraw a published file

dist rm, or a build that would remove a published RPM architecture view or metadata signature, exits 6 with mutation would withdraw published pointer "dists/..." from configured target "prod". The target’s published Generation protects the paths of repository entry points and their signature companions. Content-addressed indexes can rotate normally. To go ahead, first retire the target (remove it from sow.yml) or move it to a new target and prefix, then repeat the change. To undo instead, restore the previous settings; the repository returns to its built state.

A command waits for a lock

A write command hangs, or exits 4 when run with --no-wait or --timeout. Another SOW process holds the workspace or repository write lock, and writers wait without a limit by default. sow status reports locked=true without waiting for that writer. Let the other command finish, or stop it through its normal process controls, then retry.

In scripts, use --no-wait (-N) to return at once or --timeout 30s (-T 30s) to bound the wait. These options apply to write commands only, not to init or read commands. A read that needs a consistent snapshot waits for the writer until you cancel it.

Leave the lock files in place: SOW coordinates processes through their fixed paths. If a populated workspace has lost .sow/workspace.lock:

  1. Stop every SOW process and scheduled job for the workspace.
  2. As the workspace owner, exclusively create an empty .sow/workspace.lock with mode 0600.
  3. Run sow init /srv/sow, then restart the jobs.

See Transactions and recovery for the lock model.

A package, signature, or path fails validation

A signing key asks for a password or cannot unlock

Signing prompts for a password, or fails with signing credential is unavailable, passfile ... is empty, or a metadata key that is unusable for signing. The last one is also what a wrong or missing password for an encrypted key file looks like. SOW takes the password from --passfile PATH, then the key’s passfile, then SOW_GPG_PASSFILE; check the source that actually applies:

  • Path. Command-line and environment paths are relative to the process working directory, regardless of -C; sow.yml paths are relative to the workspace root. An empty SOW_GPG_PASSFILE is an error, not the same as an unset one.
  • Content. One nonempty line; an optional UTF-8 BOM and one final LF or CRLF are removed, and spaces and tabs count. It is not a shell script or a NAME=value line. Regular files, symlinks, and named pipes (with a 2-second writer deadline) work.
  • No fallback. A broken selected source fails without trying another one or prompting. External GPG needs an agent that allows loopback mode, and a hardware key can still ask for its own confirmation.
  • Simple repositories. sow create signs only with --sign-with; the environment variable alone does not enable signing.

config check unlocks metadata keys and probes external GPG metadata signing, so it catches a wrong metadata password. For RPM package keys it checks only format, tools, and key availability; confirm the password with a real package-signing build. check verifies public signatures and never reads passwords. The full contract is in Password files.

Other validation failures

Use the file and check stage named in the error:

Error Cause and fix
Same pool path, different bytes A different package already uses this file name. Compare the two; give changed content a new version and file name. Moving the file to another input directory does not change its pool URL.
File name differs only by case Case aliases cannot create a second pool URL. Use the spelling already recorded.
Missing or altered pool file Restore the original bytes from a matching backup, then rerun sow check.
Signing key unavailable Check the configured key, secret-key access, the GPG agent, and the key’s validity, then rebuild.
RPM does not match the trust policy Check the package signature against key and trusted_keys. See Sign your repository.

sow check reports integrity errors but never rewrites damaged data. Keep the reported path and operation ID while you investigate. Repository layout shows which files belong to the pool, the generated indexes, and private state.

Client errors

What the client does Cause and fix
Gets old content or 404s from the public URL Check the HTTP root, URL prefix, cache settings, and max_cache_ttl, then publish again.
dnf reposync refuses the package locations A standard repository’s RPM views point to ../../../pool/, outside the directory reposync allows. Generate a self-contained copy with sow export rpm-leaf.
EL7 yum keeps the old package list after you switch generators EL7 compares metadata timestamps with its cache. Use a new repository ID or clear its cache; see Existing EL7 caches.
Modular packages are filtered, or dnf module install fails SOW writes no module metadata. Set module_hotfixes=1 for ordinary installs, or keep a tool that provides modules; see XML and SQLite RPM metadata.
A tool requires primary_db SOW writes XML metadata only. YUM falls back to XML; other tools need an XML input or a conversion.

Test the actual client configuration before switching hosts; Serve and publish has client setup for both formats.

After upgrading

These problems come only from workspaces created by older SOW releases. Follow the upgrade guide first; it covers backups and the max_cache_ttl: 0s review.

The database needs migration

Repositories created by 0.5.0 through 0.8.0 already use the same schema v13 as 0.9.0. Releases 0.2.0, 0.3.0, and 0.4.0 created schemas v8, v10, and v12 respectively. All three need migration. In 0.9.0, sow status can inspect v12 and returns 5 for v8 or v10. On all three schemas, sow build and sow init exit 6 and ask for migration.

Stop all writers and back up the complete workspace with hard links preserved. Then run the following commands for each repository.

sow repo migrate pgsql -C /srv/sow
sow build -C /srv/sow -r pgsql
sow check -C /srv/sow -r pgsql

Leftovers from older releases

  • Interrupted 0.7.1 local GC plan with an empty manifest array: run sow gc again; 0.9.0 resumes it directly.
  • Invalid transition control target after a build, in a repository migrated from C2 layout by SOW 0.5 or 0.6: current releases recover this automatically.
  • Leftover C2 migration stage files block local GC: rerun sow repo migrate pgsql -C /srv/sow. Files that SOW cannot prove safe to delete are kept under .sow/pgsql/abandoned/ and their location is reported; inspect them before you remove them.

4.2 - sow.yml Reference

Every sow.yml field with its default and validation rule, plus key references, the password-file contract, and publication targets.

sow.yml is the configuration file of a workspace, the directory that holds your standard repositories. It declares which repositories exist, which Dists each one serves and with what package policy, how indexes and packages are signed, and where builds are published. Look here when you edit the file by hand or need the exact default or validation rule for a field. A simple repository has no configuration file: sow create and sow prune never read it.

Complete example

This file uses every section. Comments give the default that applies when a field is omitted. Only schema and each Dist’s format are required: schema: sow/v3 alone is a valid, empty workspace.

schema: sow/v3                         # required
architectures: [x86_64, aarch64]       # default; amd64 and arm64 are accepted aliases

repos:
  pgsql:                               # public tree at <workspace>/pgsql/
    protected: true                    # refuse `sow repo rm`; default false
    signing:                           # omit for unsigned indexes and untouched packages
      rpm:
        packages:                      # sign RPM files with the host rpm and GPG
          mode: fill                   # default: fill with a key, never without
          key: agent://7F721C4AD40F4A9D8CA578BFAC7E4690B50CCF3B
          passfile: /run/secrets/rpm-password
          trusted_keys: [keys/upstream.asc]
        metadata:                      # writes repodata/repomd.xml.asc
          key: keys/repo-signing.asc
          passfile: /run/secrets/gpg-password
      deb:
        metadata:                      # writes InRelease and Release.gpg
          key: keys/repo-signing.asc
          passfile: /run/secrets/gpg-password
    dists:
      el9:
        format: rpm                    # required: rpm or deb; fixed after creation
        limit: 2                       # newest versions kept; default 0 keeps all
        exclude:
          - kind: [debuginfo, debugsource, llvmjit]
      el10:
        format: rpm
        architectures: [x86_64]        # default: the workspace list
      bookworm:
        format: deb
        exclude:
          - kind: [dbgsym, dbg]
          - name: ["*-experimental"]
            arch: [aarch64]

targets:
  mirror:                              # copy to a local directory
    repository: pgsql
    provider: filesystem
    endpoint: file:///srv/www          # must already exist
    prefix: pgsql
    public_endpoint: https://repo.example.com/pgsql/
    max_cache_ttl: 5m
  cdn:                                 # upload to Cloudflare R2
    repository: pgsql
    provider: r2
    endpoint: https://0123456789abcdef.r2.cloudflarestorage.com
    bucket: packages                   # region defaults to auto
    prefix: pgsql
    credential: env://SOW_R2_CREDENTIAL
    public_endpoint: https://cdn.example.com/pgsql/
    max_cache_ttl: 24h

Check the file after every edit, then look at what SOW will actually use:

sow config check
sow config show -r pgsql

config check parses the file, compares it with the recorded state of each repository, and resolves every signing reference. It exits 0 when the file is usable, and otherwise:

  • 2: the file itself is invalid, such as a YAML error, an unknown field, a bad name, or a value outside its rule.
  • 6: the file is valid but cannot be applied. A signing reference does not resolve, the file drops a repository or Dist that already has state, or it drops an architecture that members or built Generations still use.
  • 5: a Dist’s format differs from the one it was created with.

config show prints the effective configuration with every default filled in and the resolved key fingerprints added. In a workspace with several repositories, select one with -r, or print the whole workspace with --all.

File rules

  • The file is one YAML document with schema: sow/v3. Unknown fields, duplicate keys, and a second document are errors.
  • It is named sow.yml or sow.yaml and sits at the workspace root as a regular file of at most 16 MiB. Reads follow a symlink to a regular file; sow init creates sow.yml and refuses a symlink. Having both sow.yml and sow.yaml as regular files is an error. With sow.yml, a repository directory named sow.yaml is allowed.
  • sow init, repo new/rm, and dist new/rm edit the file as part of their work. Policy, signing, and target settings are yours to edit. SOW applies defaults when it reads the file and never writes them back.
  • A repository or Dist you add by hand is only declared. Run sow init to create its state, or use sow repo new and sow dist new, which do both. To remove one, use sow repo rm or sow dist rm; deleting it from the file instead fails config check with exit 6, because its state still exists.
  • A frozen sow/v2 workspace is readable by config check, repo ls, repo show, dist ls, and dist show until you upgrade it with repo migrate.

Workspace

Field Type Default Meaning
schema string Required Must be sow/v3
architectures string list [x86_64, aarch64] CPU families that Dists in this workspace may build
repos map Empty Repository names and settings
targets map Empty Publication target names and settings

SOW knows two architecture families, x86_64 and aarch64. It accepts amd64 for x86_64 and arm64 for aarch64, and stores the canonical name. A list you write must not be empty or name the same family twice after that normalization. noarch and all are package architectures, not families, so they are rejected here; SOW adds those neutral packages to every view of a Dist on its own.

Repositories

Field Type Default Meaning
protected boolean false Refuses repo rm, even with -f
signing map Unsigned metadata; package mode: never Signing settings
dists map Empty Dist names and settings

protected guards against deleting the whole repository by mistake. It does not block package changes or dist rm. To remove a protected repository, set it to false, run sow config check, then sow repo rm.

Repository, Dist, and target names must match [a-z0-9][a-z0-9._-]* and must not be one of the reserved names ., .., .sow, pool, dists, sow.yml, workspace.lock, workspace-ops, or repo-locks. Each repository needs separate paths for its state directory, database, and SQLite sidecar files. For example, the database of repository db and the state directory of repository db.db would both be .sow/db.db, so the names cannot coexist.

Dists

Field Type Default Meaning
format string Required rpm or deb; cannot change after the Dist is created
architectures string list Workspace list Nonempty subset of the workspace families
limit integer 0 Newest versions to keep per binary package name and canonical architecture; 0 keeps all
exclude rule list Empty Exclusion rules

Adding an architecture marks the Dist dirty. sow build then generates the new view. Removing an architecture is rejected while members or built Generations still reference it. A build also rejects changes that withdraw a protected entry point, such as a published RPM architecture’s repomd.xml. See Published entry points.

limit must be zero or positive. RPM versions compare by epoch-version-release, with a caret snapshot sorting before the next point release (2.0^20250611 < 2.0.1); DEB versions use Debian ordering. Neutral packages (noarch, all) form their own group. limit removes older members when newer ones arrive, and relaxing it later does not bring them back: add their package files again.

Exclusion rules

exclude:
  - kind: [debuginfo, debugsource, dbgsym, dbg, llvmjit]
  - name: ["test-*", "*-experimental"]
    arch: [aarch64]

A package is excluded when any rule matches. A rule matches when all of its fields match, and a field matches when any of its patterns does. In the example, every debug package is excluded, and so is any test-* or *-experimental package built for aarch64. Exclusion runs before limit, over every candidate member of the Dist.

Field Matches
name Binary package name
source Normalized RPM SOURCERPM or DEB Source name
arch x86_64, aarch64, or neutral
kind From the package-name suffix. RPM: debuginfo, debugsource, llvmjit; DEB: dbgsym, dbg; all others: main
format rpm or deb

Patterns are case-sensitive exact strings or shell globs (*, ?, [...]). An empty rule, an empty or untrimmed pattern, a pattern repeated within one field, or an invalid glob is an error. Values are not checked against what packages can contain, so a typo such as kind: [debuginf] is accepted and matches nothing. See Membership policy for how to read the results.

Signing

Signing is configured per repository, in three independent blocks. Leave all three out and SOW publishes unsigned indexes and stores package files exactly as they arrived.

Block Signs Output
signing.rpm.metadata RPM index manifest repodata/repomd.xml.asc
signing.deb.metadata APT release manifest InRelease, Release.gpg
signing.rpm.packages RPM package files Signature embedded in each RPM

DEB package files are never re-signed; APT trusts them through the signed Release. Signing model explains key rotation, package reuse, and client setup.

RPM package settings

rpm.packages field Default Meaning
mode never without a key; fill with a key never, fill, or always
key None Key reference for the signer; required by fill and always
passfile None Password file; requires key
trusted_keys Empty Further public-key references whose signatures fill keeps
Mode Behavior Use when
never Store input bytes unchanged You do not sign packages, or must keep upstream bytes exactly
fill Keep packages whose signature verifies with key or a trusted key; sign the rest You mix upstream-signed packages with your own builds
always Keep packages already signed by key; re-sign every other package Every package must carry your signature

The public half of key is trusted automatically. A reference listed twice in trusted_keys is an error.

Package signing runs the host rpm command on a staged copy, so the private key must already be in the GPG environment that rpm uses. Naming a key file in key identifies the signer; it does not import the private key into that environment.

Metadata settings

rpm.metadata and deb.metadata take the same fields:

Field Default Meaning
key None Key reference; without it the index is unsigned
passfile None Password file; requires key
passphrase None Legacy password reference; requires key; cannot be combined with passfile

Key references

Form Example Resolves to
Path keys/repo.asc OpenPGP key file; a relative path starts at the workspace root
file:// file:///secure/repo.asc OpenPGP key file
env:// env://SOW_METADATA_KEY Variable holding armored key material, a file path, or a GPG key identifier
agent:// agent://7F721C4AD40F4A9D8CA578BFAC7E4690B50CCF3B Key in the local GPG environment

Environment variable names match [A-Za-z_][A-Za-z0-9_]*. A GPG key identifier is a 16-digit key ID or a 40- or 64-digit fingerprint, in either letter case.

A key file holds ASCII-armored or binary OpenPGP data, at most 16 MiB; comment lines outside the armor are tolerated. It can be a regular file or a symlink to one, such as a Kubernetes Secret mount. When SOW has the private key material, it signs metadata itself and supports RSA, EdDSA (Ed25519, Ed448), ECDSA, and DSA keys. When a reference resolves to a GPG key identifier, through agent:// or an environment variable, SOW calls external gpg instead.

A signing key 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 rather than silently using the first key.

Password files

A protected private key needs its password at signing time. SOW reads it from a file you name, so the password never appears in sow.yml, in a command line, or in an environment variable value. The same mechanism serves RPM packages, RPM metadata, and APT metadata, for key files and agent:// keys alike.

Which source applies. For each signing key, SOW takes the first source that is set:

  1. --passfile PATH on the command line, for every key the invocation uses.
  2. The key’s own passfile in sow.yml, or its legacy passphrase reference.
  3. SOW_GPG_PASSFILE, a default path for keys without a configured source.
  4. None: unlocking is left to the existing key, GPG, or RPM setup.
sow create ./packages -S 0123456789ABCDEF --passfile /run/secrets/gpg-password
export SOW_GPG_PASSFILE=/run/secrets/gpg-password
sow config check
sow build -r demo

passfile sits next to key under repos.<name>.signing.rpm.packages, signing.rpm.metadata, or signing.deb.metadata; there is no top-level setting. passfile: "" counts as unset. The command-line override does not bypass validation: a metadata key with both passfile and passphrase set is still rejected.

Paths. passfile takes a literal filesystem path, not a URL such as file:// and not a variable name. Paths from the command line or SOW_GPG_PASSFILE are relative to the process working directory, even with -C; paths in sow.yml are relative to the workspace root. SOW does not expand ~ or $VARIABLE in configuration or environment values (your shell expands them in command-line arguments), and it searches no default location. To reuse one file across commands, set SOW_GPG_PASSFILE to an absolute path. An empty SOW_GPG_PASSFILE is an error when it is the selected source and a password is needed; unset the variable instead.

File format. The file contains the password itself:

  • One nonempty line, at most 64 KiB including an optional line ending. An optional UTF-8 BOM is removed.
  • A final newline is optional; exactly one final LF or CRLF is removed.
  • Nothing is trimmed: leading and trailing spaces and tabs belong to the password. Quotes, #, and backslashes are literal; there are no comments, escapes, or NAME=value lines.
  • Rejected: an empty file, an empty line, NUL, a CR or LF inside the password, a bare final CR, and extra blank lines. A password made only of spaces is not empty.
  • The path can be a regular file, a symlink (including a Kubernetes Secret mount), or a named pipe. A pipe writer has two seconds to write the line and close its end.

Keep the file outside the repository and any public document root, normally with mode 0600 in a private directory. SOW does not insist on exactly 0600, so a read-only secret mount with suitable access control also works. Anyone who can read the file can read the password.

When it is read and how it fails. SOW reads the selected source only to sign or to run a signing check. A missing, unreadable, or malformed source fails the command; SOW does not try the next source or open a password prompt. With an explicit source, external GPG runs in batch loopback mode, which the agent must allow; a hardware key that requires a touch or PIN still requires it.

Without any source, an encrypted metadata key file still needs a password reference. External GPG metadata signing can use a key the agent has already unlocked, but runs with pinentry disabled. RPM package signing keeps its usual agent and macro behavior. An unprotected key needs no password file. SOW_GPG_PASSFILE only supplies a password: sow create still needs --sign-with to sign anything.

Commands that accept --passfile. create (with --sign-with), init, config check, repo new/rm/migrate, dist new/rm, add, rm, build, and export rpm-leaf. add --skip can still sign packages, and rm --check can render signed preview metadata. publish, local and target gc, and log prune accept it too, because finishing an interrupted operation can need a signer; recovery selects the source again from the current invocation and configuration. Query commands, config show, and check (which only verifies public signatures) never read password files. retain and prune do not accept --passfile.

What SOW does with the password. It never writes the value to logs, journals, configuration output, repository state, or public files. External GPG metadata signing receives it through a private file descriptor. RPM may call GPG several times per package, so RPM signing writes it to a 0600 file in a private sow-gpg-pass-* directory under $TMPDIR (or /tmp), then overwrites the file with zeros and removes it when the call returns; a process killed by force can leave it behind. If a signing tool fails, SOW reports a diagnostic drawn from at most 4 KiB of its stderr. Changing only a passfile path does not change a signing identity or mark any Dist dirty.

Passphrase references (legacy)

Metadata keys still accept the older passphrase field, as a path, file://, or env:// reference, including with GPG key identifiers. It has the same priority as a per-key passfile: it beats SOW_GPG_PASSFILE and loses to --passfile. Setting both passfile and passphrase on one key is an error. Prefer passfile in new configuration. Switching an existing key from passphrase to passfile can trigger one metadata rebuild, because the recorded configuration identity includes the old reference.

Legacy references keep their byte-oriented rules: at most 64 KiB, nonempty, no NUL; one final LF and then one final CR are removed. In-process signing accepts other bytes in such a password; external GPG requires a single line. Relative legacy file paths resolve from the workspace root, like key files.

Check signing settings

config check exits 2 for a malformed reference and 6 for one that does not resolve or cannot sign. It unlocks metadata key files and checks that they can sign; external GPG metadata keys also sign a probe. A wrong or missing password for an encrypted metadata key is reported as the key being unusable for signing. For RPM package signing, the check covers the password file’s format, the tools, and whether the secret key is available. It signs no package, so it cannot prove the password is correct; that happens when a package first needs signing.

config show adds public identities to the signing settings: key_fingerprint, and for active RPM package signing also key_snapshot_sha256, trusted_key_fingerprints, and trusted_key_snapshot_sha256s. The fingerprint and snapshot arrays are sorted independently, so do not pair them by index. These are output fields only; sow.yml does not accept them.

Publication targets

A target copies one repository’s public tree (pool/ and dists/) to a directory or an R2 bucket, so clients can install from somewhere other than the workspace host. sow publish TARGET uploads packages before the indexes that reference them and verifies the result at public_endpoint.

Field Provider Required Rule
repository Both Yes A repository defined in repos
provider Both Yes filesystem or r2
endpoint Both Yes Filesystem: file:///absolute/path, not /. R2: https://host with no path; http:// only for localhost, 127.0.0.1, or ::1
region R2 No Default auto; letters, digits, and -, 1–64 characters, case-insensitive
bucket R2 Yes DNS-safe name: 1–63 characters of a-z, 0-9, ., -, starting and ending with a letter or digit, no ..
prefix Both No Relative path under the endpoint; empty means the storage root
credential R2 Yes env://NAME or file:///absolute/path
public_endpoint Both Yes URL where SOW verifies published files. R2: http(s)://; filesystem: http(s):// or file://
max_cache_ttl Both Yes Go duration from 0 up, such as 0s, 5m, or 24h
authoritative_workspace Both No Default true; false or null is rejected
single_writer Both No Default true; false or null is rejected
exclusive_write_authority Both No Default true; false or null is rejected

A filesystem target rejects region, bucket, and credential. SOW normalizes what it can: scheme and host case, default ports, a trailing slash on endpoint, the trailing / that public_endpoint always gets, and durations (24h becomes 24h0m0s). The rest must already be canonical:

  • prefix has no leading or trailing /, no empty, ., or .. segment, no backslash, ?, #, or percent-encoded separator, and only visible ASCII characters.
  • endpoint and public_endpoint carry no user name, query, or fragment, and the public_endpoint path has no . or empty segments.
  • A file:// public_endpoint must name the published directory itself, the endpoint path plus prefix; publish rejects any other directory.

Cache lifetime. max_cache_ttl is the longest time a client, proxy, or CDN may keep a published file. Target GC keeps the files a publication superseded for at least that long after the publication, so stale indexes in caches still find their packages. Set it to the longest cache lifetime your HTTP service uses. With 0s, superseded files may become candidates at the next target GC, subject to existing deadlines and live references. R2 reports candidates by default and requires --delete for deletion. The maximum accepted value is Go’s maximum duration minus 24 hours, inclusive.

Ownership. The three authority fields state the assumption target GC depends on: this workspace is the only writer under the target’s prefix. They default to true and cannot be turned off. For the same reason two targets cannot overlap. On the same storage, their prefixes must not be equal or nested, and an empty prefix overlaps everything; two R2 targets with the same endpoint and bucket count as the same storage whatever their region. Filesystem targets must not resolve to the same or nested directories.

Filesystem endpoint. Create the endpoint directory before the first publish. It must be a real directory, not a symlink; SOW creates the prefix below it.

R2 credentials. The variable or file named by credential holds one JSON document:

{"access_key_id":"YOUR_ACCESS_KEY_ID","secret_access_key":"YOUR_SECRET_ACCESS_KEY"}

session_token is also accepted. Unknown fields, trailing data, missing keys, and values over 64 KiB are rejected. A credential file must resolve to a regular file; a symlink to one is accepted. config check validates only the form of the reference; an unset variable or unreadable file shows up when publish or target gc runs, which then exits 5. Credentials never appear in the public tree or in config show.

Published entry points. A configured target protects the paths in its published Generation for repomd.xml, Release, InRelease, Release.gpg, and repomd.xml.asc. Builds can update these files and rotate checksum-named metadata. A change that removes a protected path, such as dropping a published RPM architecture view or disabling its metadata signature, exits 6 with mutation would withdraw published pointer. Retire or move the target binding before withdrawing that path.

Changing a target. The first publish binds the target to its repository, provider, storage identity (endpoint, region, bucket), and prefix. To change the target name, public_endpoint, or max_cache_ttl afterwards, edit the file and accept the change with publish --rebind. The repository, provider, endpoint, region, bucket, and prefix cannot be rebound; configure a new target instead. Pending target maintenance can block a TTL or public_endpoint change until it completes.

Fixed settings

Some things have no field because SOW derives them. A repository always lives at <workspace>/<name>. APT indexes always use the component main. Architecture views follow from Dist configuration and package headers. Generations are kept with retain, not with a count in the file.

See Repository layout for where these paths land and Exit codes for scripting against config check.

4.3 - Package References

Name a stored package by digest, coordinate, file name, or bare name, and resolve ambiguous or missing matches.

rm, show, and where take a package reference: a string that names one package stored in a standard repository, or every version of a package at once. Look here when a command reports that a reference is ambiguous or matches nothing, or when a script needs a reference that always picks exactly one object. add is different: it takes file or directory paths.

The easiest way to get an exact reference is to copy it from sow ls:

sow ls -r demo -d el9
sow show 'rpm:example-0:1.0-1.x86_64' -r demo

Accepted forms

Form Syntax Matches
SHA-256 sha256:<64 lowercase hex digits> Stored package bytes
RPM coordinate rpm:<name>-<epoch>:<version>-<release>.<arch> Complete RPM identity, including epoch
DEB coordinate deb:<name>=<version>:<arch> Complete DEB identity
File name example-1.0-1.x86_64.rpm Stored package file name
Bare name example Every package with that binary name

Use a coordinate or a full digest in scripts. A file name is a convenience and is not guaranteed to be unique; a bare name deliberately matches several versions. References do not accept paths, globs, regular expressions, or version ranges.

SHA-256. Write all 64 digits in lowercase; an abbreviated or uppercase digest is rejected with exit 6. The digest is of the stored bytes, which RPM package signing can make different from the input file’s digest.

Coordinates. Every component is required, because SOW matches the complete stored coordinate. An RPM coordinate always includes the epoch, 0 when the package has none. A DEB coordinate carries the complete Debian version, with any epoch and revision. The architecture is the package’s own: x86_64, aarch64, or noarch for RPM; amd64, arm64, or all for DEB. The sow.yml aliases do not apply here.

sow where 'rpm:example-0:1.0-1.noarch'
sow where 'deb:example=2:1.0-1:amd64'

Name matching and ambiguity

A bare name can match several versions or architectures. Each command handles that differently:

Command When a bare name matches several packages
rm Removes every match from the selected Dists
show Rejects the reference and lists the candidates
where Requires one package identity, then returns every repository location for it

Preview a name-wide removal before applying it:

sow rm example -r demo -d el9 --check

For show or where, pick a coordinate or digest from the candidate list. where can return several repositories when they hold the same format, coordinate, and SHA-256; if repositories hold different versions or bytes, narrow it with -r or a more specific reference. Every other form must identify one object within a repository. A reference that matches nothing or is ambiguous returns exit 6.

sow prune DIR --protect NAME, used on simple repositories, also takes only an exact binary RPM package name, not a coordinate, digest, or file name.

Search scope

Command Searches Selection
rm Desired membership of the selected Dists in one repository -r; repeatable -d, or an inferred Dist
show Every recorded package object in one repository, including ones no longer in any Dist -r; -d narrows to desired membership of those Dists
where Desired membership in every repository of the workspace Optional -r and -d

Files SOW has not recorded are never query results. If rm cannot infer the Dist and the repository has several, pass -d. Without -r, where -d NAME searches the repositories that have a Dist of that name, and fails if none does.

Coordinate conflicts

Within a repository, one coordinate names at most one content object, so references stay unambiguous. SOW rejects a different package that reuses an existing coordinate instead of silently replacing it, and a changed signature alone counts as different bytes.

With active RPM signing, SOW can reuse an existing signed object when its coordinate, signature-neutral payload, and signing policy all match. Otherwise, publish changed bytes as a new release with a new file name. See Signing model.

Command options are on the rm, show, and where pages.

4.4 - Repository Layout

Where package files, indexes, private state, and publication output live, and which of them to serve.

Every path SOW reads or writes, in a simple repository and in a workspace of standard repositories. Look here when you configure a web server, write backup or sync rules, or need to find a file that a diagnostic names. For a standard repository, the rule that matters most: serve <workspace>/<repo>/, which holds pool/ and dists/, and keep sow.yml and .sow/ outside the web server’s document root.

Simple repository

  • /srv/offline/
    • example-1.0-1.x86_64.rpm
    • example_1.0-1_amd64.deb
    • repodata/
      • <sha256>-primary.xml.gz
      • <sha256>-filelists.xml.gz
      • <sha256>-other.xml.gz
      • repomd.xml
    • Packages
    • Packages.gz
    • repo_completewith --pigsty

sow create writes indexes next to the packages: RPM metadata only when the directory holds RPMs, DEB metadata only when it holds DEBs. Index entries are relative (a bare file name for RPM, ./<file name> for DEB), so the directory works at any URL. sow prune removes older RPMs from the same directory and rewrites only the RPM index.

SOW also keeps a few private files in a simple repository:

Path Purpose Serve or copy
.sow-plain-stage-*/ Staging while create runs; a later create removes stale ones Exclude
.sow-prune-repo-complete Tracks the completion marker while prune runs Exclude
.sow-plain-rpm-history.json Current and previous RPM metadata references Keep it with a copy you will run create or prune on

The history file is not part of any client index and is not a recovery journal.

Workspace and standard repositories

  • <workspace>/
    • sow.ymlworkspace configuration
    • .sow/private state
      • workspace.lock
      • workspace-ops/
      • repo-locks/<repo>.lock
      • <repo>.db
      • <repo>/
        • abandoned/retained migration stages
        • stage/active staging and retain-remove-* removal plans/tombstones
        • recovery/active local GC plans (<operation-id>/plan.json) and detached payloads
        • retained/retained generation records
        • transitions/
        • pending/
    • <repo>/public repository root
      • pool/
      • dists/
Path under .sow/ Holds
workspace.lock, repo-locks/<repo>.lock Advisory locks; SOW coordinates processes through these fixed paths, so leave them in place
workspace-ops/ Workspace lifecycle journal for init, repo new, and repo rm
<repo>.db Repository database: membership, builds, operation journal, publication state. SQLite WAL and shared-memory sidecar files can sit beside it
<repo>/pending/ New package files waiting for a build to move them into the pool
<repo>/stage/, recovery/, transitions/, abandoned/ Work in progress and recovery material for builds, GC, retain rm, and layout migration
<repo>/retained/ Records of Generations kept with retain

.sow/ and the pending directories are private (0700). Pending package files are 0644, so a build can move them into public paths without changing their mode.

SOW 0.9.0 uses database schema v13 and configuration schema sow/v3 (in sow.yml or sow.yaml); the two version numbers are independent. The database only makes sense together with the private and public files it describes, so back up and restore the workspace as a whole, and do it before repo migrate. Do not edit the schema version or the rebuildable cache by hand.

Package pool

pool/<prefix>/<source>/<filename>

Each repository stores every package once, in its own pool. Every Dist and architecture index points at that one file, so a noarch package shared by five views is still one copy.

source comes from the RPM SOURCERPM or DEB Source field, normalized to a source package name; without one, SOW uses the binary package name. The prefix is the first character in lowercase, except that a source starting with lowercase lib uses its first four characters (or the whole name, if shorter), also in lowercase.

Source Example path
postgresql-18 pool/p/postgresql-18/libpq5_18.3-1_amd64.deb
example pool/e/example/example-1.0-1.x86_64.rpm
libfoo pool/libf/libfoo/libfoo1_1.0-1_amd64.deb

Pool files are immutable. Removing a package from a Dist does not delete its bytes, because built, retained, recovery, and publication records can still reference them; gc deletes them once no record does.

RPM Dist

  • dists/el9/
    • x86_64/repodata/
      • <sha256>-primary.xml.gz
      • <sha256>-filelists.xml.gz
      • <sha256>-other.xml.gz
      • repomd.xml
      • repomd.xml.ascwith metadata signing
    • aarch64/repodata/

Architecture views hold metadata only. Each package location points back to the pool:

<location href="../../../pool/e/example/example-1.0-1.x86_64.rpm"/>

A native package appears in its own architecture’s view; a noarch package appears in every configured view. Older checksum-named metadata files can remain next to the current ones, and repomd.xml selects the active set. For a self-contained directory with local package paths, use export rpm-leaf.

DEB Dist

  • dists/trixie/
    • Release
    • InReleasewith metadata signing
    • Release.gpgwith metadata signing
    • main/
      • binary-amd64/
        • Packages
        • Packages.gz
        • by-hash/SHA256/<digest>
      • binary-arm64/

Packages entries use paths relative to the repository root, such as Filename: pool/e/example/example_1.0-1_amd64.deb. Release lists SHA-256 checksums and sets Acquire-By-Hash: yes. An architecture all package appears in every applicable index.

Publication paths

Both target providers receive the same public layout under the target’s prefix:

  • <prefix>/
    • pool/
    • dists/

An export is different: it has its own package files, metadata, manifest, and a .sow-export.json completion marker. It is a separate delivery artifact, not another standard repository.

Names and case sensitivity

Repository, Dist, and target names become path components, so they follow the naming rules in the configuration reference; the reserved names (.sow, pool, dists, sow.yml, and others) keep them from colliding with the paths above.

SOW rejects a new pool path that differs only in case from an existing one, even with identical bytes. On a case-insensitive filesystem, source directories that differ only in case also conflict. On a case-sensitive filesystem they can coexist, so check for them before you move a repository to a case-insensitive volume.

See Pool and metadata views, Serve and publish, and Platforms and integrations.

4.5 - Exit Codes

What exit codes 0–6 and 130 mean, what to do next, and how to branch on them in scripts.

Every SOW command exits with one of the codes below, and a code means the same thing in every command. A script can therefore branch on the code and leave the message for humans. Look here when you wrap SOW in a script, or when you need to know whether a nonzero exit left committed work behind.

Code Meaning Next step
0 Success, or nothing to do Read the result; a command with nothing to do can report noop: true
1 Runtime I/O, package parsing, rendering, or another unclassified error Fix the reported input or environment problem, then retry
2 Invalid command line, workspace discovery failure, or invalid configuration Check sow help COMMAND, the selection flags, and sow config check
3 Partial success Read the result to separate committed work from failed items
4 Write lock unavailable Retry later or allow a longer --timeout
5 Integrity or recovery error, or the repository or target is not ready for this operation Inspect status and check; build a dirty repository, or finish the recorded operation the error names
6 Operation rejected Fix the conflict, package reference, architecture, signing setting, or protection setting the error names
130 Interrupted by SIGINT or SIGTERM Run the recovery command for the interrupted operation

Success does not always mean ready

status exits 0 whenever it can report the state, including dirty, recovering, and error. Its ready_to_copy field summarizes that state but does not check bytes. Run check before you deliver a repository:

sow build -r demo
sow check -r demo

A dirty repository can have perfectly consistent old indexes and still fail check with 5, because the desired state has not been built. Build and check again. If the diagnostic instead reports corrupted bytes or conflicting recovery evidence, investigate that first; see Troubleshooting.

Partial success

Code 3 means some work committed and some failed, so neither “retry everything” nor “carry on” is safe without reading the result:

  • add: at least one input was accepted or reused and at least one failed. The JSON result keeps a per-input outcome. A package excluded by policy is not a failure.
  • init: some declared objects were created before a later one failed.
  • prune: an error occurred after it published the filtered index or removed at least one RPM.

Capture both the output and the code before deciding whether to continue:

#!/usr/bin/env bash
set -uo pipefail

sow add ./incoming/ -r demo -d el9 --json > add-result.json
rc=$?
case "$rc" in
  0) ;;
  3) jq '.result.items[] | select(.status == "failed")' add-result.json
     exit 3 ;;
  4) echo 'Repository is busy; retry later.' >&2
     exit 4 ;;
  *) exit "$rc" ;;
esac

sow check -r demo || exit $?
sow publish mirror

The script stops on partial success so you can inspect the failed inputs before anything is published. mirror must be a configured target for demo.

Lock waits and interruption

Write commands wait for their lock without a time limit by default (-T 0). -T 30s waits up to 30 seconds and -N tries once; either returns 4 when the lock stays busy. Combining -N with a nonzero -T is a usage error (2). Read-only commands do not accept these flags. Some of them take shared locks for a consistent snapshot, while status reports writer activity without waiting for the writer.

SOW returns 130 when it handles Ctrl-C or SIGTERM. An internal timeout, such as an upload making no progress, keeps its normal error class instead. Interruption never undoes work that already committed: inspect the state and follow Transactions and recovery to resume.

JSON errors

With --json, stdout carries the result envelope and stderr carries diagnostics. Each entry in the errors array has a class that maps to the exit code:

Code JSON class
1 runtime
2 usage, discovery, or config
3 partial
4 lock
5 integrity
6 rejected
130 interrupted

Branch on the code or class, never on message text. create and prune, the commands for simple repositories, print their underlying error (starting with plain:) to stderr, and their JSON message can carry an extra CLI category prefix. When ok is false, diagnostic and partial results are still present. See JSON output for the envelope.

4.6 - JSON Output

The sow.cli/v1 envelope, error classes, ID types, and the result fields of every command.

With --json, a SOW command writes one versioned JSON document instead of human-readable text, so a script gets stable field names rather than parsing log lines. Look here for the envelope every response shares, how errors and IDs are typed, and the result fields of each command.

The document is a single newline-terminated line on stdout; diagnostics go to stderr. Successful create and prune runs put their warnings and skipped entries inside the JSON result and leave stderr empty. log export is the exception: it writes JSON Lines and does not accept --json.

sow status -r demo --json | jq '.result.status'

Envelope

Every JSON response has these seven fields:

Field Type Meaning
schema string sow.cli/v1
command string Command name including any subcommand, such as repo ls
ok boolean true on success; false when errors is not empty
repository string or null The selected repository, when the response is tied to one
operation string or null Operation or publication attempt ID, per command (see below)
result object or null Command data, including partial or diagnostic results on failure
errors array Error objects with code, class, and message

A successful configuration check, shown here on several lines:

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

A command that fails before doing meaningful work usually returns result: null. Some failures still return a useful result: a failed check, a partially successful add, or a maintenance error after a database commit, which reports what did commit. Keep the result when ok is false, and read it together with status and the operation log before retrying; a nonzero exit does not mean the transaction rolled back.

Errors

{"code":3,"class":"partial","message":"managed: batch partially succeeded"}

Branch on code or class, never on message text. The classes are runtime, usage, discovery, config, partial, lock, integrity, rejected, and interrupted; Exit codes maps them to exit codes and next steps.

Identities

Treat operation and Generation IDs as strings. Operation IDs can exceed the range of integers that JavaScript represents exactly. Generation IDs are 20-digit, zero-padded decimal strings, so they also sort correctly as text:

{"operation":"8632724976452398569","built_generation":"00000000000000000004"}

This applies to generation, built_generation, base_generation, and base when it names a Generation. Desired-state revisions and counts are JSON numbers.

The top-level operation field holds:

Command Value
add, rm without preview, build, local gc, log prune Journal ID, if one was allocated
publish, publish --abort Publication attempt ID, if available
log ID The requested operation ID
Other commands (create, prune, init, config, ls, show, where, retain, export) null

A null operation does not mean the command is read-only. The top-level repository is null for create, prune, init, config check, and repo ls. where sets it when -r/--repo is given and leaves it null when searching every repository; each entry in result.locations names its own repository either way.

Simple repositories: create and prune

sow create returns:

Result field Meaning
dir Absolute path of the indexed directory
rpm, deb Retained RPM and DEB file counts from this scan. Identical copies count separately and share one index entry
kept Sorted file names retained by this scan
removed Files removed by --pigsty
skipped {path, reason} objects for packages skipped in the default fault-tolerant mode, when present
warnings Warning strings from scanning or publication, when present
marker Whether the completion marker was produced
marker_sha256 Marker digest, present with the marker
noop No public file needed to change
recovered Always false; a simple repository has no journal to recover
signed, signer Signed file names and signer identity, when available
dropped_metadata Unsupported repomd.xml data types (such as group, updateinfo, or modules) that create replaced, when present

sow prune returns:

Result field Meaning
dir Target directory path
dry_run Whether --dry-run was set
kept Sorted file names of the top-level RPMs kept
candidates {path, latest} objects: each removal candidate and the RPM that replaces it
removed File names of removed RPMs
skipped {path, reason} objects for RPMs skipped in the default fault-tolerant mode, when present
warnings Warning strings, such as corrupt packages, equal-version conflicts, or unmatched --protect names, when present
index_updated Whether repodata/ was rewritten
marker Whether repo_complete exists after completion
noop Whether a live run made no changes. A preview checks removal candidates and any pending completion marker. It does not predict an index rewrite

Initialization and configuration

Command Result
init workspace, config_created, repositories_initialized, dists_initialized, existing
config check workspace, repositories, dists
config show The effective configuration: schema, architectures, repos, and targets when present

Resolved signing settings can include public key fingerprints and certificate snapshot hashes. The fingerprint and hash arrays are sorted independently; do not pair them by index. See Check signing settings.

Repositories and Dists

repo ls returns result.repositories[]; repo new and repo show return one repository object directly. Its fields are name, path, protected, dists, generation, desired_revision, status, packages, memberships, and config, plus dirty_reasons and recent_operation when available. packages counts stored package objects and memberships counts desired Dist memberships, so one object in two Dists counts as one package and two memberships.

An operation summary has id, kind, state, created_at, and updated_at, plus an optional error_class. status.pending_operation and status.recent_operation use the same shape.

dist ls returns result.dists[]; dist new and dist show return one Dist object with name, format, architectures, desired_members, built_members, generation, dirty, status, effective_config_sha256, config, and an optional dirty_reasons. Each architecture entry has family and ecosystem_arch; a DEB view of family x86_64 has the ecosystem name amd64, for example.

repo rm and dist rm return name, removed, and noop.

repo migrate returns repository, repository_id, from_layout, to_layout, schema_from, schema_to, phase, generation, grace_not_before (null when no grace deadline applies), legacy_aliases, complete, and an optional warnings. Warnings from an aborted migration name retained temporary stages or incomplete cleanup. Once the repository is selected, a failed migration still reports it in the response. See repo migrate for the phases.

add, rm, and build

All three report the repository state after the operation: repository, desired_revision, built_generation, and dirty.

add also returns operation, accepted, failed, memberships_added, memberships_removed, and items[]. Each item has input and status, plus format, coordinate, sha256, a per-Dist dists map, and error when those are known.

Item status Meaning
accepted A new package entered membership
reused An existing package object was reused; membership can still change
excluded Policy kept the package out of every selected Dist
failed The input failed; read error

Each entry of the dists map is accepted, excluded, or limited, so one package can have different outcomes in different Dists. memberships_removed grows when limit pushes older versions out.

rm returns an optional operation, removed[], the selected dists, changes[], and check. Each removed record has dist, sha256, coordinate, and name. A preview has check: true, and only prediction_complete: true means its predicted file list is complete. rm never deletes pool bytes.

build returns operation, the Dists it considered in dists, and noop. A no-op build creates no Generation.

status and check

status returns status, ready_to_copy, desired_revision, built_generation, dirty_dists, dirty_reasons, pending, and repository_locked, plus pending_operation, recent_operation, and lock_holder when they apply. status is clean, dirty, recovering, or error, and pending holds count and bytes. A successful query can report any of those states: ok: true means the query worked, not that the repository is healthy. Run check before publishing or copying.

check returns repository, status, ready_to_copy, built_generation, desired_revision, and layers[]. Each layer has name, ok, checked, and issues. The normal layers, in order, are config, state, public-modes, retained, package-bytes, desired-membership, index, signature, and generation-manifest. During an active layout transition, the first three are followed by layout-transition instead. A repository-wide check can pass every consistency layer and still exit 5 when desired changes need building. With -d, status and check report ready_to_copy for the selected Dists. Omit -d to gate delivery of the entire repository.

changes

The result has repository, base, generation, dirty, and changes[]. Each change contains:

Field Values
op add, update, delete
phase payload, metadata, pointer, delete
path Slash-separated path relative to the repository root
size, sha256 Present for added and updated files; omitted for deletions

changes first runs the same verification as check. It works on a dirty repository, but exits 5 while an operation is pending or the repository is recovering or fails verification.

Without a base, the comparison is against the previous built Generation. Base 0 lists the complete current tree, and a numbered base compares that recorded Generation with the current one. These are local file differences; remote changes are the business of publish and target gc.

Package queries

Command Result fields
ls repository, selected dists, dirty, packages[]
show repository, package
where reference, locations[]

A package object has sha256, format, coordinate, architecture, canonical_arch, pool_path, filename, size, name, source, version, kind, storage, created_revision, dists, and built_dists, plus optional epoch, release, RPM payload_sha256 and signature_key, and warning.

  • architecture is the package’s own name (noarch, amd64, and so on); canonical_arch is x86_64, aarch64, or neutral.
  • storage is pool or pending. It describes the local workspace, not remote publication.
  • dists is the desired membership; built_dists is the membership of the last build.
  • A package object’s coordinate has no format prefix: prepend format and : to get a CLI reference. Coordinates in where locations already include it.

Each where location has repository, dists, built_dists, sha256, and coordinate.

Publication and maintenance

Command Main result fields
publish repository, target, provider, generation, optional attempt/checkpoint, phase, objects, noop
publish --abort repository, target, provider, attempt, phase, objects
retain add/rm repository, record, record_identity, path
retain ls repository, generations[]
Local gc Optional operation, repository, base_generation, generation, objects, bytes, noop
Target gc repository, target, provider, phase, reports, candidates, deleted_objects, deleted_bytes, retained_objects, pending_grace, completed_attempts, noop
export rpm-leaf repository, repository_id, generation, dist, arch, directory, method, signed, signer_identity, packages, files, manifest_sha256

publish --rebind returns the normal publish shape. For R2, the default target GC report and gc TARGET --delete share the target GC fields; the latter records verified removals in deleted_objects and deleted_bytes.

Operation logs

log returns repository and operations[], newest first. log ID returns repository and detail, which holds operation, duration_ms, events, packages, memberships, and files:

Detail array Record fields
events sequence, state, detail_json, occurred_at
packages sequence, input_path, disposition; optional package_sha256, coordinate, error_class, message, dists
memberships sequence, dist, package_sha256, action
files sequence, action, phase, path; optional size, sha256

payload_json, result_json, and event detail_json are strings that contain JSON, so decode them separately. Operations that build metadata record publication_time in payload_json; layout migrations and journals written without a recorded time omit it.

sow log -r demo --json \
  | jq '.result.operations[] | .payload_json | fromjson'

log prune returns operation, repository, before, pruned, and compaction_deferred. A date-only argument is resolved in the machine’s local time zone, and before holds the resolved timestamp.

log export writes one complete operation record per line, without the envelope:

sow log export operations.jsonl -r demo
sow log export - -r demo

The output file must not exist yet. A symlinked parent directory, such as /tmp on macOS, is resolved to its physical path before the file is created atomically and the directory is synced.

Use a validation result in a script

#!/usr/bin/env bash
set -euo pipefail
sow check -r demo --json | jq -e '.ok' >/dev/null
sow changes 0 -r demo --json \
  | jq -r '.result.changes[] | [.phase, .op, .path] | @tsv'

The script fails unless the local repository passes check, then prints its current file manifest. To publish it, run sow publish TARGET for a configured target.

4.7 - Platforms & Integrations

What SOW runs on, which packages and clients it supports, how that is tested, and what it does not support.

Check this page before you deploy SOW or point a new client at it. The first sections list what is supported: host platforms, workspace filesystems, package inputs, client formats, and publication providers. How it is tested lists the automated checks behind those claims, and Not supported lists the gaps with their workarounds.

Platforms

Operating system amd64 arm64 Release formats
Linux Yes Yes Archive, RPM, DEB
macOS Yes Yes Archive

Release binaries are built with CGO_ENABLED=0 and need no language runtime. An archive contains the sow binary and the Apache-2.0 LICENSE; the Linux packages install /usr/bin/sow and the license. Building from source requires Go 1.27.4 or later. sow version prints the binary’s version, platform, and Go toolchain.

Workspace filesystem

A workspace needs a local POSIX filesystem with advisory locks, fsync, and atomic rename within the filesystem, because every build and recovery depends on them. On macOS, use APFS: SOW refuses to build when the atomic directory exchange it needs is unavailable. Keep the public tree and private staging on the same filesystem.

Serve only <workspace>/<repo>/. That pool/ plus dists/ tree is complete on its own, so you can copy it to other storage without the private database or journal.

SOW rejects pool paths that differ only in case, and on a case-insensitive filesystem it also rejects source directories that differ only in case. A repository built on a case-sensitive volume can therefore contain source directories that a case-insensitive destination cannot hold; filesystem publication checks for this before it starts. See Repository layout.

Package inputs

RPM. SOW reads RPM format v4 and v6, including dual- and multi-signed packages, wherever it reads packages: create and prune for simple repositories, add, build, and check for standard repositories. For v6 that means lead major versions 3 through 6, PAYLOADSHA256 without PAYLOADSHA256ALGO, and native OpenPGP v4 and v6 signature arrays in RPMSIGTAG_OPENPGP (tag 278). SOW also verifies RSA, DSA, ECDSA, and EdDSA (Ed25519) signatures in RPMSIGTAG_DSA (tag 267) and the legacy PGP tags; when tag 278 is present, it is authoritative. Main-header tags that repeat with identical values, such as the duplicate SOURCERPM in some EL10 packages, are accepted; conflicting main-header tags and duplicate signature-header tags are rejected.

DEB. SOW reads binary packages whose control.tar is uncompressed or compressed with gzip, bzip2, xz, or zstd. Legacy Latin-1 bytes (>= 0x80) in the control file are normalized to UTF-8.

Architectures. Dists in a standard repository accept x86_64, aarch64, and neutral packages: RPM x86_64, aarch64, and noarch; DEB amd64, arm64, and all. sow create indexes whatever architectures a simple repository contains.

Metadata signing supports RSA, EdDSA (Ed25519, Ed448), ECDSA, and DSA keys; see Signing model.

Repository formats and clients

Repository Client entry point Package locations
Simple, RPM repodata/repomd.xml Beside repodata/
Simple, DEB Packages or Packages.gz Beside the indexes: a flat APT repository (deb URL ./)
Standard, RPM dists/<dist>/<arch>/repodata/repomd.xml Relative paths back to the root pool/
Standard, DEB dists/<dist>/Release, or InRelease when signed Root-relative pool/ paths

A standard repository’s APT indexes use the component main and SHA-256 by-hash files. Metadata signing adds repomd.xml.asc for RPM and InRelease plus Release.gpg for APT. RPM metadata is gzip-compressed primary, filelists, and other XML, which DNF and YUM read directly.

Publication times

In a standard repository, each operation that builds metadata records one publication time and uses it for the APT Release date, the RPM repomd.xml data timestamps, and the metadata signatures. Recovery reuses the recorded time, and an operation that changes nothing leaves it untouched; a journal written without a recorded time keeps its earlier timestamp behavior. The RPM revision stays the Generation number. sow repo migrate is the exception: it keeps its own timestamp behavior, described below.

Existing EL7 caches

EL7 YUM compares metadata data timestamps with the copy it has cached, so a repository whose timestamps go backwards can look stale to existing clients. For a simple repository, create --metadata-timestamp SECONDS and prune --metadata-timestamp SECONDS let you keep an existing publication time and move it forward; the default is 0.

Exported RPM leaves and the RPM metadata that sow repo migrate writes use timestamp 0, with no override; later builds of a standard repository use their recorded publication time. If clients have cached a positive timestamp under their current repository ID, give these outputs a new repository ID or clear that ID’s metadata cache; changing only the base URL is not enough. To keep the old ID and cache, keep serving a simple repository and follow the timestamp procedure in Migrate an existing YUM repository.

Publication providers

Provider Publication Target GC
filesystem Writes below an existing canonical file:// endpoint Deletes conditionally after the cache grace period, then verifies the files are gone from the public endpoint
r2 Writes through S3-compatible storage operations Reports candidates by default; gc TARGET --delete rechecks eligible objects, deletes them, and verifies they are gone

Both providers publish the complete repository under the configured prefix. The HTTP service, DNS, credentials, access policy, and caching in front of that storage are yours to set up: public_endpoint tells SOW where to verify published content but does not create a service. R2 public endpoints must use HTTP(S); filesystem targets also accept file://. Field rules are in Publication targets.

How it is tested

The table covers the v0.9.0 test suite. Results are available for the CI run, integration tests, and release build.

Check Environment What it proves
Core contract tests Linux and macOS Repository manager, recovery, signing, and the patched RPM parser, as unit and contract suites
CLI clean-room workflow Linux The shipped binary: a mixed RPM and DEB simple repository, workspace initialization, RPM and DEB Dists, queries, build, and check
APT client, simple repository Ubuntu 22.04 apt updates, discovers, downloads, and installs from an explicitly trusted, unsigned flat APT repository
Clients of a signed standard repository Ubuntu 22.04, AlmaLinux 9 APT and DNF verify signed repository metadata and install a package
RPM signing with a password file AlmaLinux 8, 9, 10 Native rpm-sign and GnuPG sign with a protected key whose password comes from a password file
Detached signature transition AlmaLinux 8, 9, 10 How real DNF clients behave while repomd.xml and its detached signature are replaced
S3-compatible publication Pinned PGSTY Silo container Object transport, target GC deletion, republishing identical bytes, and a following no-op publish
Release packaging Linux Four archives, two RPMs, two DEBs, checksums, installed paths, and license files

The S3-compatible check does not run against Cloudflare R2 itself. Verify conditional multipart completion against the hosted R2 endpoint your deployment uses.

Before you switch production clients, run sow check, publish to the intended target, then refresh indexes and install a package with the real client configuration. See Serve and publish for client setup.

Not supported

Not supported Instead
Windows hosts Run SOW on Linux or macOS
A workspace on NFS or another network filesystem Keep the workspace on a local POSIX filesystem; copy or publish the public tree elsewhere
A macOS workspace on a volume without atomic directory exchange Use APFS
Packages for other CPU architectures, such as i686, in a standard repository (add rejects them) Index such a directory as a simple repository with sow create
DEB packages with control.tar.lzma Rebuild them with a gzip, bzip2, xz, zstd, or uncompressed control archive
SQLite (primary_db), zchunk, modulemd, and source-package RPM indexes See XML and SQLite RPM metadata
Default dnf reposync against a standard repository’s RPM view See dnf reposync

XML and SQLite RPM metadata

SOW writes gzip-compressed XML only, not the SQLite primary_db, filelists_db, or other_db. That does not stop YUM: when no suitable SQLite index exists, the upstream YUM metadata loader reads the XML and builds its own local cache. A tool that accepts only primary_db needs an XML input path or a separate conversion. Because the XML is gzip-compressed, zstd support is a separate question when you compare SOW’s output with other repositories.

SOW also writes no zchunk, modulemd, or source-package indexes. If clients need module profiles or dnf module install, keep a tool that provides module metadata. To install packages from modular builds as ordinary RPMs, set the client’s module_hotfixes policy; see Migrate an existing YUM repository.

dnf reposync

By default dnf reposync confines downloads to one repository directory, following its documented safe-write rule, so it rejects the parent-relative package locations in a standard repository’s RPM views. Use sow export rpm-leaf to produce a self-contained directory for that workflow.

5 - Commands

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

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

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

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

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

Command index

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

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

Global syntax

sow [OPTIONS] COMMAND [ARGS]

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

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

Signing passwords

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

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

Workspace discovery

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

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

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

Repository selection

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

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

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

Dist selection

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

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

The other commands default to a wider scope:

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

Locking

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

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

Parallelism

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

JSON output

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

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

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

Exit codes

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

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

5.1 - sow create

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

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

Synopsis

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

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

Options

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

Examples

Index a directory that holds both RPMs and DEBs:

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

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

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

The same result for a script:

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

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

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

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

Inputs and outputs

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

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

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

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

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

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

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

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

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

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

Deterministic output and idempotence

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

Keep the previous RPM indexes

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

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

Publication time for existing YUM repositories

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

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

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

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

Signing RPMs

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

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

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

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

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

–pigsty

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

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

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

The repo_complete gate

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

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

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

Metadata from other tools

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

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

Locking and interrupted runs

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

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

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

Exit codes

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

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

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

See also

5.2 - sow prune

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

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

Synopsis

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

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

Options

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

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

Preview and prune

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

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

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

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

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

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

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

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

Skipped packages and –strict

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

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

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

Mixed directories and repo_complete

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

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

Supported repositories

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

Integrity and recovery

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

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

Exit codes

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

See also

5.3 - sow init

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

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

Synopsis

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

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

Options

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

Examples

Start an empty workspace in the current directory:

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

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

Then add repositories and Dists by hand:

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

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

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

Idempotence rules

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

Apply a declared configuration

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

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

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

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

A second run changes nothing:

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

Locking and recovery

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

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

Exit codes

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

See also

5.4 - sow config

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

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

Synopsis

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

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

Examples

Validate before a build in CI:

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

Compare the effective policy of two Dists:

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

sow config check

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

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

Options

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

Strict field rejection

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

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

Active workspaces must use schema: sow/v3:

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

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

How far the signing check goes depends on the signer:

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

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

sow config show

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

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

The file on disk holds only what you wrote:

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

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

Options

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

Select configuration with -r and -d

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

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

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

Signing references

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

Exit codes

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

See also

5.5 - sow repo

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

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

Synopsis

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

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

Examples

Create the repositories for a two-tier layout:

sow repo new infra
sow repo new pgsql

Create a repository without waiting for a held lock:

sow repo new nightly -N

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

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

Naming

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

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

sow repo ls

Lists every repository in the workspace. Read-only.

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

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

sow repo new

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

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

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

sow repo show

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

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

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

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

sow repo rm

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

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

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

Force removal

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

protected

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

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

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

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

sow repo migrate

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

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

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

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

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

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

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

Abandon a transition with –abort

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

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

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

Exit codes

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

See also

5.6 - sow dist

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

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

Synopsis

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

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

Examples

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

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

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

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

List Dists that need a build:

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

Naming

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

sow dist ls

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

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

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

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

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

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

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

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

sow dist new

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

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

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

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

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

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

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

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

Creation and recovery

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

sow dist show

Shows one Dist in detail. Read-only.

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

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

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

sow dist rm

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

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

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

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

Dist removal does not delete Pool bytes

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

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

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

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

Exit codes

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

See also

5.7 - sow add

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

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

Synopsis

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

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

Options

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

Examples

Add two RPMs to el9:

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

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

Import a directory tree in one go and build once:

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

Inputs and targets

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

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

Item statuses

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

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

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

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

Policy: exclude and limit

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

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

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

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

–skip

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

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

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

Package architecture

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

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

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

Partial batches

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

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

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

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

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

Processing order

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

RPM signing modes

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

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

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

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

Exit codes

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

See also

5.8 - sow rm

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

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

Synopsis

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

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

Options

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

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

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

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

Examples

Preview a removal, then apply it:

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

Remove one exact object from two Dists:

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

Stage several removals, then build once:

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

Feed the preview plan to another tool:

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

Package references

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

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

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

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

Preview with –check

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

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

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

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

Default behavior: remove and rebuild

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

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

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

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

–skip

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

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

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

Policy interaction

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

Exit codes

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

See also

5.9 - sow ls

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

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

Synopsis

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

Output

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

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

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

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

Examples

List exact references for all objects not yet built:

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

List pool paths in deterministic order:

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

Selection

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

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

Exit codes

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

See also

5.10 - sow show

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

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

Synopsis

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

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

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

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

Output

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

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

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

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

Package reference

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

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

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

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

Exit codes

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

See also

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

5.11 - sow where

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

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

Synopsis

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

Output

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

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

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

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

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

Reference resolution

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

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

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

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

Exit codes

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

See also

5.12 - sow status

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

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

Synopsis

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

Output

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

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

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

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

Repository states

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

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

Exit behavior

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

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

Details

Unfinished operations

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

Reading older workspaces

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

See also

5.13 - sow build

Turn desired state and current configuration into a new Generation, or finish an interrupted operation.

sow build reapplies the current limit and exclude policy and renders the indexes and configured signatures for each affected Dist. Once packages are in pool/, it atomically switches each Dist directory and records the repository Generation after the switches complete. add and rm build by default. Run build yourself after add --skip or rm --skip, after editing sow.yml, or to finish an interrupted operation. Run sow check afterwards before you deliver the tree.

Synopsis

sow build [-j|--jobs N] [-C|--workdir DIR] [-r|--repo NAME] [-d|--dist NAME]... [-T|--timeout DUR | -N|--no-wait] [--json] [--passfile PATH]
Flag Meaning Default
-j, --jobs N Parallel package inspection and render workers; at least 1 logical CPU count
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
-d, --dist NAME Build only these Dists; repeatable all affected Dists
-T, --timeout DUR Maximum lock wait; 0 waits indefinitely 0
-N, --no-wait Fail immediately when the lock is held false
--passfile PATH Signing password file for this run; overrides per-key config (Password files) —
--json Output JSON false

Without -d, SOW builds every affected Dist in the repository. With -d, it builds only the named Dists, and changes to the others stay dirty.

Result

sow build -r demo -d el9
built repository=demo operation=2769214987359113555 dists=el9 revision=4 generation=00000000000000000005 dirty=false

dirty=false means nothing is left to build. Use --json to read the result in a script.

When membership, relevant policy, renderer settings, and signing configuration already match the current Generation, build is a no-op and keeps it:

sow build -r demo -d el9
build repository=demo dists=el9 already current (noop) revision=4 generation=00000000000000000005 dirty=false

Apply policy changes

build re-evaluates the current exclude and limit policy against desired membership. Tightening policy can remove members. Loosening it does not bring back earlier members from leftover pool files; run sow add again for the packages you want to restore.

Metadata signing

Configure metadata signing in sow.yml. Changing a configured key reference or fingerprint makes the affected Dists dirty, and the next build re-signs their metadata.

  • RPM: always writes repodata/repomd.xml; adds repomd.xml.asc when signing is configured.
  • DEB: always writes Release; adds InRelease and Release.gpg when signing is configured.

Commit and recovery

SOW moves the packages the build needs from the pending area into pool/, writes the new indexes, and only then replaces client entry points such as repomd.xml and Release, so an entry point never refers to a file that is not there yet. One build can cover several Dists; they share the resulting Generation, and Dists you did not select stay dirty until a later build.

If a build stops, run it again. SOW finds the unfinished operation by its pending state, not by timestamp order, and uses the operation journal to finish or roll back the work. If the journal, database, and files disagree, the command reports an integrity error; use sow check and sow log to find the affected state.

A build refuses to withdraw a client entry point (a pointer-phase file) that a configured target has published. See Removing a published view.

Publication time

Each new build records one UTC publication time with whole-second precision. APT Release dates, RPM data timestamps, and metadata signatures across the affected Dists all use it. Recovery reuses the recorded time, and a no-op build leaves it unchanged.

The time cannot precede the recorded time of an earlier build or the activation time of the selected signing key; a key that is not usable yet makes the build fail. Keep the host clock correct.

Progress events

Long builds append structured build_progress records to the operation log. Each record has phase, completed, total, and jobs; the phases are rendering, promoting_payload, publishing_dists, normalizing_public_tree, and finalizing. Read them with sow log OPERATION.

Details

  • repo migrate and journals without a recorded publication time keep their earlier timestamp behavior; see Publication times.
  • An rm --check preview picks its own publication time, so the hashes and sizes it predicts can differ from those of the real run.

Exit codes

Code Trigger
0 Build completed, or nothing to do
1 Renderer, signing, or filesystem failure
2 Usage error, workspace not found, or implicit repository selection is ambiguous
4 Repository write lock unavailable
5 Recovery cannot complete safely, or the repository is in error
6 Explicit scope is not configured, the current configuration rejects existing state, or the build would withdraw a published entry point

See also

5.14 - sow check

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

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

Synopsis

sow check [-j|--jobs N] [-C|--workdir DIR] [-r|--repo NAME] [-d|--dist NAME]... [--json]
Flag Meaning Default
-j, --jobs N Parallel verification workers; at least 1 logical CPU count
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Select a repository selection rules
-d, --dist NAME Check membership and indexes for these Dists; repeatable all Dists
--json Output JSON false

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

Output

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

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

Verification layers

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

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

Dirty is not deliverable

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

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

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

Details

Package verification

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

Unfinished layout migration

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

Exit codes

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

See also

5.15 - sow changes

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

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

Synopsis

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

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

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

Output

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

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

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

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

Base Generation

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

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

Examples

Save a complete manifest of the current Generation:

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

Show only the changes under one Dist:

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

Details

Dirty and recovery states

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

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

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

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

Exit codes

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

See also

5.16 - sow publish

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

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

Synopsis

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

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

Flag Meaning Default
--abort Abandon an interrupted attempt that has not reached commit intent false
--rebind Accept a changed target name, public_endpoint, or max_cache_ttl, then continue false
-C, --workdir DIR Workspace discovery start directory current directory
-T, --timeout DUR Maximum lock wait; 0 waits indefinitely 0
-N, --no-wait Fail immediately when the lock is held false
--passfile PATH Signing password file, needed only if SOW must first recover an interrupted local operation (Password files) —
--json Output JSON false

--abort and --rebind are mutually exclusive.

Before you publish

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

Publication protocol

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

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

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

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

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

Resume or abandon an attempt

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

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

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

Change target settings

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

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

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

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

Removing a published view

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

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

To remove the view anyway, retire the target first:

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

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

Details

Public visibility checks

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

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

R2 inventory

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

Filesystem target paths

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

Changed content and conflicts

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

Other preconditions

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

Exit behavior

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

See also

5.17 - sow retain

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

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

Synopsis

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

GENERATION is a decimal integer greater than zero.

Options

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

retain add

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

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

Any other Generation is rejected with exit 6:

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

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

retain ls

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

An empty list is a successful result.

retain rm

retain rm releases a Generation by removing its retained record:

sow retain rm 12 -r pgsql
removed retained generation 00000000000000000012

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

Details

Interrupted removal

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

Damaged records

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

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

Moving the record also removes its protection against GC.

Exit behavior

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

See also

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

5.18 - sow gc

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

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

Synopsis

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

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

Flag Meaning Default
-C, --workdir DIR Workspace discovery start directory current directory
-r, --repo NAME Repository for local GC; a target already names its repository selection rules
--delete Delete eligible objects on an R2 target, or resume an interrupted R2 deletion false
-T, --timeout DUR Maximum lock wait; 0 waits indefinitely 0
-N, --no-wait Fail immediately when the lock is held false
--passfile PATH Signing password file, needed only if SOW must first recover an interrupted local operation (Password files) —
--json Output JSON false

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

Local GC

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

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

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

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

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

Target GC

Cache grace

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

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

Note

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

What each provider does

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

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

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

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

Details

Interrupted GC

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

Other preconditions

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

Exit behavior

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

See also

5.19 - sow export

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

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

Synopsis

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

Output

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

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

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

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

Source requirements

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

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

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

Details

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

Exit behavior

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

See also

5.20 - sow log

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

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

Synopsis

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

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

sow log

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

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

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

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

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

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

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

One operation in detail

Pass an operation ID for its summary:

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

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

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

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

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

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

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

Filtering by Dist

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

sow log -d trixie -r pigsty

Operation lifecycle

The state field shows how far an operation got:

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

sow log export

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

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

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

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

Output path

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

sow log prune

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

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

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

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

BEFORE syntax

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

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

Records kept by prune

prune never deletes:

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

Examples

Show the most recent write:

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

Find failed operations among the 50 most recent:

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

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

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

Find the operation that last touched a Dist:

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

Exit codes

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

See also