| Crates.io | ognibuild |
| lib.rs | ognibuild |
| version | 0.2.6 |
| created_at | 2023-05-23 18:25:32.742083+00 |
| updated_at | 2025-12-03 00:16:49.442748+00 |
| description | Detect and run any build system |
| homepage | https://github.com/jelmer/ognibuild |
| repository | https://github.com/jelmer/ognibuild.git |
| max_upload_size | |
| id | 872213 |
| size | 1,119,171 |
Ognibuild is a simple wrapper with a common interface for invoking any kind of build tool.
The ideas is that it can be run to build and install any source code directory by detecting the build system that is in use and invoking that with the correct parameters.
It can also detect and install missing dependencies.
The goal of ognibuild is to provide a consistent CLI that can be used for any software package. It is mostly useful for automated building of large sets of diverse packages (e.g. different programming languages).
It is not meant to expose all functionality that is present in the underlying build systems. To use that, invoke those build systems directly.
Ognibuild has a number of subcommands:
ogni clean - remove any built artifactsogni dist - create a source tarballogni build - build the package in-treeogni install - install the packageogni test - run the testsuite in the source directoryogni cache-env - cache a Debian cloud image for testing (Linux only)It also includes a subcommand that can fix up the build dependencies for Debian packages, called deb-fix-build.
ogni -d https://gitlab.gnome.org/GNOME/fractal install
On Linux systems with the debian feature enabled, ognibuild can use cached Debian cloud images
to speed up tests that require a Debian environment. This is particularly useful for running tests
with UnshareSession.
To cache a Debian image:
ogni cache-env sid
Once cached, tests will automatically use the cached image instead of bootstrapping a new environment from the network. This significantly reduces test execution time.
You can also specify a different Debian suite:
ogni cache-env bookworm
ogni cache-env stable
The cached images are stored in ~/.cache/ognibuild/images/.
To run tests without network access:
First, cache an image and build everything (requires network):
ogni cache-env sid
cargo build --all-targets
Run tests in a network-isolated environment (requires sudo):
sudo CARGO_HOME=$HOME/.cargo OGNIBUILD_DEBIAN_TEST_TARBALL=$HOME/.cache/ognibuild/images/debian-sid-amd64.tar.gz unshare -n cargo test --frozen
The CARGO_HOME environment variable ensures cargo finds the downloaded dependencies.
The OGNIBUILD_DEBIAN_TEST_TARBALL environment variable points to the cached Debian image.
The --frozen flag prevents cargo from accessing the network.
Ognibuild respects the following environment variables:
OGNIBUILD_DISABLE_NET - When set to 1, true, yes, or on (case-insensitive), prevents the ogni cache-env CLI command from downloading Debian images. Note: This only affects the CLI tool, not library code.OGNIBUILD_DEPS - URL of the ognibuild dependency server to use for resolving dependencies.OGNIBUILD_DEBIAN_TEST_TARBALL - Path to a custom Debian tarball to use for testing instead of downloading one.To run tests in a network-isolated environment:
First, cache a Debian image (requires network):
ogni cache-env sid
Then run tests in a network namespace (requires root or CAP_NET_ADMIN):
sudo unshare -n -- sudo -u $USER bash -c 'cd $(pwd) && cargo test'
If no cached image exists and network is unavailable, tests will fail with a clear error message indicating that either a cached image or network access is required.
If you run into any issues, please see Debugging.
Ognibuild is functional, but sometimes rough around the edges. If you run into issues (or lack of support for a particular ecosystem), please file a bug.
Package repositories are used to install missing dependencies.
The following "native" repositories are supported:
As well one distribution repository:
Ognibuild is licensed under the GNU GPL, v2 or later.