Overview
Azure Linux provides specialized tools for package development, testing, and debugging. These tools enable developers to work efficiently with RPM packages in isolated environments.containerized-rpmbuild
Thecontainerized-rpmbuild tool enables building and testing individual Azure Linux packages in an isolated containerized environment.
Features
- Creates an Azure Linux container for isolated package builds
- Mounts SPECs, INTERMEDIATE_SRPMS, and out/RPMs from the Azure Linux repository
- Supports using locally built RPMs or upstream RPMs for dependencies
- Uses native RPM commands for package building
- Syncs changes to SPECS/ back to the host
- Provides both build and test modes
Basic Usage
Available Options
View all available options and usage information:Configuration Parameters
The tool accepts several optional parameters to customize behavior:| Parameter | Description | Default |
|---|---|---|
REPO_PATH | Directory to use as Azure Linux repo | Current directory |
MODE | Operation mode (build or test) | build |
VERSION | Azure Linux version (1.0 or 2.0) | 2.0 |
MOUNTS | Additional directories to mount into container | None |
BUILD_MOUNT | Directory to mount as build directory | $REPO_PATH/build |
EXTRA_PACKAGES | Additional packages to install in container | None |
ENABLE_REPO | Use local RPMs for build dependencies | Disabled |
KEEP_CONTAINER | Keep container on exit | Disabled (cleaned up) |
QUIET | Suppress stdout for most commands | Disabled |
Build Mode
Build a package using the default worker chroot filesystem:- Uses the worker chroot as the container filesystem
- Provides a complete build environment
- Changes to SPECS/ are preserved on the host
- All other changes are ephemeral
Test Mode
Test a package using the upstream Azure Linux container:- Uses the upstream Azure Linux container image
- Provides a clean runtime environment
- Suitable for testing package installation and functionality
Using Local Dependencies
Enable local RPMs to satisfy build dependencies:Mounting Additional Directories
Mount extra directories into the container:Persistent Containers
Keep the container running after exit for debugging:Overriding Build Definitions
You can override any Azure Linux make definitions when using containerized-rpmbuild:Working with Packages
Building a Single Package
Testing Package Installation
Debugging Build Issues
Use persistent containers to debug:Best Practices
- Use Build Mode for Development: When actively developing spec files, use build mode to get the full toolchain.
- Test in Clean Environment: Use test mode to verify packages install correctly in a minimal environment.
-
Keep Containers for Debugging: When troubleshooting build issues, use
KEEP_CONTAINER=yto inspect the environment. - Mount Source Directories: For iterative development, mount your source directories to avoid copying files.
- Use Local Repos: When testing with locally built dependencies, enable local repository support.