Skip to content

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.

Table reader