sow create
sow create writes RPM and DEB indexes beside the package files in a directory. Use it for a flat repository that does not need a managed Workspace. DIR defaults to the current directory.
Synopsis
--passfile PATH requires --sign-with; SOW_GPG_PASSFILE supplies a default password-file path but does not enable signing by itself. Use one nonempty line: SOW strips an optional UTF-8 BOM and one final LF or CRLF without trimming whitespace. Regular files, symlinks, and named pipes (2-second writer deadline) are supported. Relative paths start at the current directory, and SOW searches no default location. See Password files.
sow create replaces an existing repomd.xml. SOW does not carry independent metadata such as groups (comps), updateinfo, or modules into the new index. From SOW 0.7.0, create reports those data types as a warning on standard error in human output, or in the dropped_metadata result field with --json. It does not report alternate package-index encodings (*_db, *_zck). 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 rejects such an index instead.
Type reporting requires a readable, valid prior index within the 16 MiB inspection limit. Create can still replace an oversized or malformed index without listing its data types; prune rejects an oversized prior index.
Use sow prune to keep only the latest version per package name and architecture in a flat RPM repository.
Description
create reads the top-level regular package files in DIR. For RPMs, it generates repodata/. For DEBs, it generates Packages and Packages.gz. A mixed directory gets both formats. Architectures come from the package headers; Plain mode accepts all architectures found in the packages.
Indexes use relative package paths: the filename for RPM, and ./<filename> for DEB. Serve the package directory through HTTP or use it as a local file:// source.
By default, create updates its indexes and preserves the package files. --pigsty can delete matching packages, and --sign-with can replace RPMs with signed copies.
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 | — |
Scan rules
- SOW considers only top-level regular files ending in
.rpmor.deb. - No recursion, no symlink following, no Workspace config.
createrejects running inside a managed.sowworkspace ancestor. - By default, corrupt or unreadable packages, source RPMs (
src/nosrc), and coordinate conflicts (including Debian version-equivalent conflicts such as1.0-1vs1.00-1) are skipped with a warning so remaining valid packages still enter the index. With--pigsty, exclusion filtering runs before duplicate-filename checks. - If every candidate of one format fails, SOW preserves that format’s previous index, history, and completion state while still publishing valid packages of the other format (including in fresh
--pigstydirectories). - Human output prints warnings to stderr. Successful
--jsonoutput includeswarningsandskippedin the stdout envelope and leaves stderr empty. - Pass
--strictto fail before writing on any skipped package, coordinate conflict, or empty directory (without--pigsty).
Package I/O and final validation
Keep the input directory unchanged while create runs. SOW scans the packages, then checks for file changes before replacing the indexes. A detected change returns exit code 5. Use --jobs to set the number of parallel package-processing workers.
Deterministic output and idempotence
Without forced package re-signing, the rendered metadata is byte-stable for a given input set
and timestamp: gzip output is deterministic.
repomd.xml carries <revision>0</revision> and data timestamps defaulting to 0;
--metadata-timestamp overrides the latter. Repeating the same options on an unchanged directory
rewrites nothing and reports noop=true:
Keep the previous RPM indexes
SOW keeps the checksum-named RPM metadata referenced by the current and immediately previous repomd.xml.
A client that fetched the previous index can still retrieve those metadata files after an update.
An unchanged run does not advance this retention window.
The hidden .sow-plain-rpm-history.json file records these references. Keep it with the directory when rebuilding a working copy.
It is a retention record, not a recovery journal. Plain mode still recovers by rebuilding.
This window does not retain removed package files or every older index. If client caches span several updates, keep the required packages and metadata in your publication layer.
The repo_complete gate
If the directory contains repo_complete (or an interrupted .sow-prune-repo-complete marker left by sow prune), use --pigsty to refresh it with the indexes. Running without --pigsty returns an error:
To keep using the completion marker, rerun with --pigsty. If you no longer use it, move the marker out of the directory first.
Publication time for existing YUM repositories
--metadata-timestamp sets the RPM repomd data timestamps. It does not change package files, compressed XML streams, or DEB indexes. The default is 0, and the accepted range is 0..253402300799 Unix seconds. This option was added in SOW 0.5.0.
EL7 YUM rejects metadata whose maximum data timestamp is older than its cached copy. When replacing an existing metadata generator, choose a timestamp at least as large as the highest value previously published. For changed content, advance it by at least one second to distinguish updates.
Record the publication time and pass it on every update. Omitting the option resets it to 0. Restoring older package content is a new publication, so keep the timestamp increasing. Use seconds, not milliseconds, and avoid future dates.
If clients verify repomd.xml.asc, regenerate that signature after repomd changes. create neither signs repomd nor updates or removes its old detached signature.
See Migrating an Existing YUM Repository for the complete procedure.
–pigsty
--pigsty applies these cleanup rules and writes a completion marker:
- Delete DEB packages whose parsed architecture is
i386. RPMs are not removed merely for carrying ani386/i486/i586/i686architecture. - Delete RPM/DEB whose binary package name is exactly
patroniand whose upstream version is exactly3.0.4. RPM comparesVERSION, ignoring epoch and release; DEB strips epoch and Debian revision first.3.0.4+foois not a match. - After all indexes render successfully, write
repo_complete: the SHA-256 of every remaining top-level RPM/DEB, sorted by basename byte order, formatted<sha256><two spaces><basename>.
Cleanup applies only to top-level regular package files that parsed successfully and matched a rule.
SOW retains documentation packages such as annobin-docs unless they match one of those rules.
SOW removes the existing repo_complete before replacing indexes. It then deletes the packages matched by the cleanup rules and writes the new marker last. A missing marker means the build is incomplete.
Signing RPMs
-S/--sign-with KEY signs RPM package files through the local RPM/GPG environment. Use a 16-digit hexadecimal key ID or a 40- or 64-digit fingerprint. An optional 0x or 0X prefix is accepted. Make the private key available in that environment before running the command. For a protected key, use --passfile PATH or set SOW_GPG_PASSFILE to its password-file path.
- Default: SOW signs only RPMs that have no parseable embedded OpenPGP signature (native RPM 6
RPMSIGTAG_OPENPGPtag 278, RSA/DSA/ECDSA/EdDSA in signature header tag 267, or legacy PGP tags). Packages that are already signed keep their bytes. --overwriterequires--sign-withand switches torpm --resignover every retained RPM.- SOW signs a temporary copy, cryptographically verifies the resulting OpenPGP signature (supporting both RPM v4 and RPM v6 tag 278, including multi-signed RPMs) and checks that package identity and content are unchanged, then replaces the original RPM. The indexes describe the final signed file.
- At least one top-level RPM must remain after
--pigstycleanup, andrpmmust be onPATH.
Locking, staging and overwrite rebuild
create locks the target directory while it updates the indexes and releases the parent directory lock immediately after binding (and before waiting on a busy target), so concurrent runs on sibling flat directories do not block each other. Use --timeout or --no-wait to control lock waiting.
An interruption can leave only part of the index set updated. Rerun sow create with the same intended options to rebuild from the current packages. Plain mode rebuilds from scratch; the result field recovered remains false.
For --pigsty, expose the repository only after repo_complete appears. Use Managed mode when you need journaled recovery.
Examples
Index a mixed directory:
Machine-readable result:
Build a Pigsty flat repository with eight workers and a publication time chosen from its history:
The caller records this time and signs the resulting repomd.xml when clients require it.
Failure envelope:
Exit codes
| Code | Trigger |
|---|---|
0 |
Indexes written, or unchanged input produced a no-op |
1 |
Directory unreadable or missing, package parse failure, renderer failure, signing tool failure, or a missing/unreadable/malformed password file when signing needs it |
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 |
Managed .sow workspace ancestor, repo_complete / .sow-prune-repo-complete gate hit, --sign-with on a DEB-only directory, or under --strict: empty directory, skipped package, or coordinate conflict |
See also
- Plain Flat Repositories — the design behind
create - Quick Start — five-minute flat repository walkthrough
- Repository Layout — what the flat tree looks like
- Sign Your Repository — generating and using a signing key
- Migrate an Existing YUM Repository — replacing an existing metadata generator