Skip to content

Instantly share code, notes, and snippets.

@bdrewery

bdrewery/gist:6479394

Last active Dec 22, 2015
Embed
What would you like to do?
Poudriere atomic repository updating

This allows for atomic package repository updates and dry-runs. It will allow the repository to be usable during a package build session without a wrapper to do symlinks with latest or clones etc.

  1. On first build, repository is converted to symlinked structure
  2. On build startup, all of .real is hardlink-copied to .shadow
  3. Package building treats .shadow as the PACKAGES directory
  4. Because the top-level files and directories are symlinked to .real, the build leaves all existing files alone during the build. Hardlinks are safe as package building only overwrites. The repo files are explicitly copied to prevent accidental incremental updates to the production repo.
  5. Once build completes, the top-level .shadow is renamed to .real_TIMESTAMP and the .current symlink is atomically moved to the new package directory.

View during build

Note that .shadow has poudriere built in it, but the .real directory does not.

.
./.current -> .real
./.real
./.real/All
./.real/All/beadm-0.8.5.txz
./.real/All/cblog-0.1.6_1.txz
./.real/All/ccache-3.1.9_2.txz
./.real/All/clearsilver-0.10.5.txz
./.real/All/fcgi-devkit-2.4.0.txz
./.real/All/gettext-0.18.3.txz
./.real/All/gmake-3.82_1.txz
./.real/All/libiconv-1.14_1.txz
./.real/All/libtool-2.4.2.txz
./.real/All/pkg-1.1.4_1.txz
./.real/All/tinycdb-0.78.txz
./.real/Latest
./.real/Latest/pkg.txz -> ../All/pkg-1.1.4_1.txz
./.real/digests.txz
./.real/packagesite.txz
./.real/repo.txz
./.shadow
./.shadow/.new_packages
./.shadow/All
./.shadow/All/beadm-0.8.5.txz
./.shadow/All/cblog-0.1.6_1.txz
./.shadow/All/ccache-3.1.9_2.txz
./.shadow/All/clearsilver-0.10.5.txz
./.shadow/All/fcgi-devkit-2.4.0.txz
./.shadow/All/gettext-0.18.3.txz
./.shadow/All/gmake-3.82_1.txz
./.shadow/All/libiconv-1.14_1.txz
./.shadow/All/libtool-2.4.2.txz
./.shadow/All/pkg-1.1.4_1.txz
./.shadow/All/poudriere-3.0.4.txz
./.shadow/All/tinycdb-0.78.txz
./.shadow/Latest
./.shadow/Latest/pkg.txz -> ../All/pkg-1.1.4_1.txz
./All -> .current/All
./Latest -> .current/Latest
./digests.txz -> .current/digests.txz
./packagesite.txz -> .current/packagesite.txz
./repo.txz -> .current/repo.txz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.