Migrate an Existing YUM Repository
This guide covers a flat directory of RPMs and repodata/, such as a repository previously
built with createrepo_c. It uses Plain sow create, without creating a Managed workspace.
The commands below target SOW 0.8.0.
1. Prepare a working copy
Back up the current packages and metadata. Make a separate working copy for the migration; copy RPM files without hard links if you plan to re-sign them. Check the installed binary:
Confirm that the version is 0.8.0.
| Check | Action |
|---|---|
| Package layout | Plain reads top-level regular RPMs; migrate nested package layouts separately |
| Client features | Plain emits primary/filelists/other XML, not SQLite databases or module streams |
| Package trust | Keep valid upstream signatures, or deliberately replace them with your own key |
| Index trust | If clients use repo_gpgcheck=1, sign and verify the new repomd.xml separately |
| Existing clients | Include clients with cached metadata, using their existing URL and repository ID |
If your clients use modular filtering, keep the repository’s existing module_hotfixes=1 setting where needed. Plain metadata does not include module streams or profiles.
If the existing repomd.xml contains independent metadata such as comps, updateinfo, or modules, sow create replaces the index and reports the dropped types as a warning on stderr (or in dropped_metadata with --json). Once SOW owns repodata/, you can also use sow prune to remove superseded RPM versions while keeping --metadata-timestamp monotonic; prune refuses an index that still carries foreign metadata types.
2. Preserve publication history
EL7 YUM can reject an index whose largest data timestamp is older than the cached index. Read <data><timestamp> in the current repomd.xml and retained copies, then use the largest value clients may have seen. If a previous run reset the live index to zero, recover that value from earlier copies or publication records. Use data timestamps, not revision or file modification times.
Have the maintenance script serialize updates and save the greatest published timestamp outside the served tree. For changed content, choose:
Save the chosen timestamp before switching the public index. A failed publication may leave a gap in the sequence. Keep this record when you restore old content or move the repository to another directory. The +1 distinguishes publications; EL7 also accepts equal timestamps.
For unchanged content, reuse the timestamp after checking the indexes, referenced checksums, and signature. Repair a zero or regressed timestamp. Passing the current time on every run changes repomd.xml, so create can no longer report a no-op.
3. Build and sign a candidate
For this one-off example, prepare /srv/yum.candidate as an independent copy.
Set HISTORICAL_MAX to the verified maximum from the live index, the saved maximum publication time, and trusted history.
Set SIGN_KEY to the full fingerprint of your metadata signing key.
The following commands use Python 3 to choose a strictly newer time:
Record PUBLISH_TIME in the maintenance system before publishing the candidate. Compare the fingerprint from gpg --verify with the expected signing key.
--sign-with KEY signs unsigned RPMs and preserves existing signatures, including vendor signatures. To replace every package signature with your key, add --overwrite in the candidate copy. This changes package bytes; create builds indexes from the signed result. Generate the detached index signature after the final create run.
For protected package-signing keys, SOW 0.7.0 adds --passfile PATH and SOW_GPG_PASSFILE. See Password files. These settings do not affect the separate gpg command above. For unattended metadata signing, pass --pinentry-mode loopback --passphrase-file PATH alongside --batch, or use an unlocked agent key.
4. Test the candidate
Point a 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. This checks cache compatibility, package paths, and signatures.
If you are migrating an automated update script, also check two cases:
- With the same inputs, options, and timestamp, a repeat build reports
noop=true. Preserve the existing valid detached signature. - After package content changes, the script advances the timestamp and the same client can fetch the new package.
When comparing with createrepo_c, check dependency meaning and client behavior; XML
formatting can differ. See Platforms & Integrations.
5. Publish the repository
Plain replaces multiple files; it does not make the whole directory switch atomically.
Coordinate package replacement, metadata, detached signatures, and cache visibility in
your publication layer. SOW retains the current and immediately previous SOW checksum-named RPM metadata sets.
Unchanged runs keep the same previous set. Keep .sow-plain-rpm-history.json when copying a directory for further builds.
For clients that cache indexes across several updates, retain the required older metadata and packages in your publication layer.
Keep the original backup and the saved maximum publication time. Roll back package content by rebuilding
and signing it as a newer publication. Restoring an old repomd.xml beside changed RPMs
can reintroduce checksum or timestamp failures.
Use the checks above for Plain repositories; sow check applies to Managed repositories. See sow create for options and Signing for package and metadata signatures.