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
sudo dnf install mock
sudo usermod -a -G mock $(whoami)
newgrp mock in your shell).
sudo mock -r fedora-rawhide-x86_64 --init
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
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
sudo dnf install createrepo_c
mkdir -p /path/to/my/repo
createrepo_c /path/to/my/repo
python3 -m http.server or Nginx).
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
sudo dnf install copr-cli
copr-cli create my-project-name --chroot fedora-rawhide-x86_64
copr-cli build my-project-name /path/to/package.src.rpm