RPM Package Build Pipeline

An interactive guide to setting up a robust RPM build system using Mock, local repositories, and Fedora COPR.

1

Phase 1: Local Build with Mock

Mock is the standard tool for building RPMs in a clean, isolated chroot environment. This ensures your package build is reproducible and doesn't depend on your host system's configuration.

Setup Checklist

Install Mock: sudo dnf install mock
Add your user to the 'mock' group: sudo usermod -a -G mock $(whoami)
Apply group changes (log out and log back in, or use newgrp mock in your shell).
Update mock configurations: sudo mock -r fedora-rawhide-x86_64 --init
2

Phase 2: Building an RPM

Once Mock is set up, you can build a Source RPM (`.src.rpm`). The command is highly configurable. Use the options below to see how the command changes.

Interactive Mock Command Builder

3

Phase 3: Local RPM Repository

After building your RPMs, you need a way to distribute them. A local repository is a simple way to host your packages for testing on your local network.

Repository Setup Checklist

Install repository creation tool: sudo dnf install createrepo_c
Create a directory to host RPMs: mkdir -p /path/to/my/repo
Copy your newly built RPMs into this directory.
Generate repository metadata: createrepo_c /path/to/my/repo
Serve the directory over HTTP (e.g., using python3 -m http.server or Nginx).
4

Phase 4: Integrate with Fedora COPR

Fedora's COPR (Cool Other Package Repo) is a public build service that automates building and hosting RPMs. It's an excellent alternative to managing your own repository, especially for public projects.

Local Repository

  • Fast: Builds and tests are on your local machine.
  • Private: Ideal for internal or proprietary software.
  • Full Control: You manage the entire environment.
  • Manual: Requires manual steps for building and publishing.

Fedora COPR

  • Automated: Integrates with SCM (like Git) for automatic builds.
  • Public: Easy for others to discover and use your packages.
  • Multi-Arch: Builds for multiple architectures automatically.
  • Managed: No need to manage build servers or repositories.

COPR Setup Checklist

Create an account on the Fedora COPR website.
Install the command-line client: sudo dnf install copr-cli
Authenticate your client by following the website's API instructions.
Create a new project: copr-cli create my-project-name --chroot fedora-rawhide-x86_64
Build your SRPM: copr-cli build my-project-name /path/to/package.src.rpm

Complete Workflow Overview

Source Code / SRPM
Mock Build Environment
Published RPMs
Local Repository
Fedora COPR