Generated by GPT-5-mini| mock (library) | |
|---|---|
| Name | mock |
| Title | mock (library) |
| Developer | Red Hat |
| Released | 2002 |
| Programming language | Python |
| Operating system | Linux |
| Genre | Build tool, Package build environment |
| License | GPLv2+ |
mock (library) mock (library) is a build and test environment tool used to create reproducible RPM package buildroots in isolated chroot environments. It automates creation of clean build environments, dependency installation, and RPM building, enabling developers and continuous integration systems to produce consistent artifacts across distributions and architectures. Widely adopted in enterprise and open source workflows, mock integrates with package management and release pipelines to support automation for distribution projects and vendor ecosystems.
mock provides an isolated buildroot mechanism for RPM-based distributions such as Fedora Project, CentOS Stream, RHEL, and openSUSE. It leverages underlying tools like chroot management utilities, rpm (software), and yum/dnf for dependency resolution. Administrators configure mock with per-target configuration files referencing distribution trees from repositories such as Koji (software), Pungi, or mirror infrastructure operated by organizations like Fedoraproject and EPEL. The tool can be invoked from command-line environments, automated via Jenkins (software), GitLab CI/CD, or integrated with packaging tools used by organizations like Red Hat.
mock originated in the early 2000s to address reproducible builds for the Fedora Project release engineering workflows. Development has been influenced by engineers and maintainers affiliated with Red Hat, contributors from the CentOS community, and packaging teams coordinating with projects such as EPEL and Koji (software). Over time mock adapted to changes in package management, incorporating support for dnf after the successorization of yum, and integrating with container-focused infrastructure like Docker and podman as build environments evolved. The project has been discussed at conferences and events such as FOSDEM, linux.conf.au, and Open Source Summit where maintainers and users compare approaches with alternatives like pbuilder and sbuild.
mock centers on reproducible chroot-based buildroots, configurable via per-target files that specify base packages, macros, and repository definitions. Key features include isolation through chroot or user namespaces, support for multiple architectures including x86_64, aarch64, and ppc64le, and hook scripts enabling pre- and post-build customization for projects like Fedora Modular or CentOS Stream. mock coordinates with build systems such as Koji (software) for task orchestration and supports signing artifacts using tools associated with GnuPG for release verification. It also provides caching options for package downloads from mirrors operated by projects like mirror-maker or services run by Red Hat.
Typical usage invokes mock to build an SRPM or RPM in a specified target, for example a target representing Fedora Project or RHEL minor releases. Integrations often appear in CI pipelines maintained by organizations using Jenkins (software), GitLab CI/CD, or GitHub Actions runners, where mock is used to ensure packages built in environments similar to those managed by Koji (software). Packaging guides for distributions such as Fedora Project and CentOS illustrate common patterns: defining target configs, enabling repositories like EPEL, and writing hook scripts referencing signing keys maintained in infrastructure by Red Hat engineers. Mock examples also appear in documentation from projects like LibreOffice, GNOME Project, and KDE where packagers produce binary artifacts for distribution repositories.
mock interoperates with build orchestration systems including Koji (software)],] Pungi, and CI services such as Jenkins (software) and GitLab CI/CD. It consumes repository metadata produced by tools like createrepo_c and works with package management clients such as dnf and legacy yum. For containerized workflows, mock can be combined with Docker or podman to run builds inside isolated containers or to create container images after RPM production, complementing image build tools like Buildah and Ansible (software). Compatibility efforts ensure mock targets reflect tree snapshots from services like Fedora Project mirrors and enterprise repositories managed by Red Hat.
mock provides reliable isolation but incurs overhead from chroot setup, package installation, and dependency resolution, which can affect throughput compared to lightweight container builds using Docker. Performance depends on mirror availability from services such as Fedora Project mirrors or CentOS repositories and on caching strategies employed by CI systems like Jenkins (software). Limitations include complexity of maintaining target configurations for multiple distribution versions, challenges with cross-compilation for architectures like aarch64, and the need to manage GPG keys and signing infrastructure used by projects including EPEL and Red Hat for secure releases.
The mock ecosystem includes contributors from Red Hat, packagers across Fedora Project, CentOS, and openSUSE communities, and users in independent projects such as LibreOffice, KDE, and GNOME Project. Discussion and development occur on mailing lists and at events like FOSDEM and Open Source Summit, while CI integrations are maintained in repositories on platforms like GitHub and GitLab. Complementary tools and services include Koji (software), createrepo_c, Buildah, and signing workflows involving GnuPG; packaging policies and best practices are influenced by standards from projects such as Fedora Project packaging guidelines.
Category:RPM package management