Usage
Parameters
Full path to the SRPM to build
The directory to create the build folder in
Full path to worker_chroot.tar.gz containing the build environment
Full path to local.repo file for RPM dependencies
The directory to use as the local repo and to submit RPM packages to
The output directory for source RPM packages
Directory that contains already built toolchain RPMs. Should contain a top level directory for each architecture.
The cache directory containing downloaded dependency RPMS from Azure Linux Base
The name of the spec file used to build this package without the extension
The distribution tag the SPEC will be built with (e.g., .azl3)
The distro release version that the SRPM will be built with
The distro build number that the SRPM will be built with
Timeout for package building (e.g., 2h, 30m)
Run the %check section during package build (runs package tests)
Optional file path to an rpmmacros file for rpmbuild to use
Filepaths to RPM packages that should be installed before building (can be specified multiple times)
Architecture of resulting package
Whether or not to delete the chroot folder after the build is done
Automatically install and use ccache during package builds
The directory used to store ccache outputs
The configuration file for ccache
Max number of CPUs used for package building
Path to the log file
Log level (panic, fatal, error, warn, info, debug, trace)
How It Works
- Create Chroot: Extracts worker_chroot.tar.gz to create an isolated build environment
- Mount Dependencies: Mounts local RPM repositories and toolchain directories into chroot
- Install Build Dependencies: Uses tdnf to install packages listed in BuildRequires
- Build Package: Runs rpmbuild to compile the package from source
- Run Tests: Optionally runs %check section if
--run-checkis specified - Extract Results: Copies built RPMs to the output directory
- Cleanup: Removes chroot unless
--no-cleanupis specified
Build Environment
The worker chroot contains:- Build Tools: gcc, make, cmake, autotools, etc.
- Package Manager: tdnf for installing dependencies
- RPM Tools: rpmbuild, rpm, rpmspec
- Standard Libraries: glibc, system headers, etc.
Ccache Support
Pkgworker supports ccache to speed up rebuilds:- Incremental builds during development
- CI/CD pipelines with frequent rebuilds
- Large C/C++ packages with long compile times
Example
Standard Package Build
Build with Tests
Development Build (No Cleanup)
./build/workers/mypackage-1.0-1/ to debug build issues.
Output
On successful build, pkgworker prints a comma-separated list of built RPM files to stdout:Notes
- This tool is typically invoked by the scheduler, not run directly by users
- Requires root privileges for chroot operations
- Each package builds in a clean, isolated environment
- Build dependencies are automatically installed from available repositories
- The
--timeoutparameter prevents runaway builds - Use
--no-cleanupduring development to inspect build artifacts - The
--run-checkflag runs package test suites, which may significantly increase build time