No description
|
Some checks failed
Build and Publish Debian Package / Build Debian Package (push) Failing after 1m20s
|
||
|---|---|---|
| .forgejo/workflows | ||
| deb_mock | ||
| debian | ||
| dev_notes | ||
| docs | ||
| examples | ||
| scripts | ||
| tests | ||
| .gitignore | ||
| koji-and-mock-alternative.md | ||
| Makefile | ||
| PROJECT_STATUS.md | ||
| README.md | ||
| requirements-dev.txt | ||
| requirements.txt | ||
| setup.py | ||
| test-config.yaml | ||
Deb-Mock
A low-level utility to create clean, isolated build environments for single Debian packages. This tool is a direct functional replacement for Fedora's Mock, adapted specifically for Debian-based ecosystems.
Last updated: 2025-01-22 12:00:00 UTC
Purpose
Deb-Mock provides:
- sbuild Integration: A wrapper around the native Debian sbuild tool to standardize its command-line arguments and behavior
- Chroot Management: Handles the creation, maintenance, and cleanup of the base chroot images used for building
- Build Metadata Capture: Captures and standardizes all build output, including logs, .deb files, and .changes files
- Reproducible Build Enforcement: Ensures that all build dependencies are satisfied within the isolated environment
Features
- ✅ Isolated build environments using chroot
- ✅ Integration with Debian's native sbuild tool
- ✅ Standardized build metadata capture
- ✅ Reproducible build verification
- ✅ Clean environment management and cleanup
- ✅ Chain building for dependent packages (like Mock's
--chain) - ✅ Shell access to chroot environments (like Mock's
--shell) - ✅ File operations between host and chroot (like Mock's
--copyin/--copyout) - ✅ Chroot scrubbing for cleanup without removal (like Mock's
--scrub) - ✅ Core configurations for popular distributions (like Mock's
mock-core-configs)
CI/CD Status
This project uses Forgejo Actions for continuous integration and deployment:
- Build: Automatically builds and tests the package on every push
- Test: Comprehensive testing of all CLI commands and functionality
- Release: Automated releases when tags are pushed
- Documentation: Auto-updates README with build status
Build Status
Installation
From Forgejo Package Registry (Recommended)
# Add the Deb-Mock repository from Forgejo
wget -O - https://git.raines.xyz/api/packages/robojerk/debian/gpg.key | sudo apt-key add -
echo 'deb [signed-by=/usr/share/keyrings/forgejo-robojerk.gpg] https://git.raines.xyz/api/packages/robojerk/debian unstable main' | sudo tee /etc/apt/sources.list.d/deb-mock.list
sudo apt update
# Install mock
sudo apt install -y mock
From Debian Repository (Alternative)
# Add the Mock repository
wget -O - http://debian.raines.xyz/mock.gpg.key | sudo apt-key add -
echo 'deb http://debian.raines.xyz unstable main' | sudo tee /etc/apt/sources.list.d/mock.list
sudo apt update
# Install mock
sudo apt install -y mock
From Source
# Clone the repository
git clone https://git.raines.xyz/robojerk/deb-mock.git
cd deb-mock
# Install dependencies
sudo apt install sbuild schroot debhelper build-essential debootstrap python3-venv python3-pip
# Create virtual environment and install
python3 -m venv venv
source venv/bin/activate
pip install -e .
Building Debian Package
# Install build dependencies
sudo apt install -y build-essential devscripts debhelper dh-python python3-all python3-setuptools
# Build the package
dpkg-buildpackage -us -uc -b
# Install the built package
sudo dpkg -i ../deb-mock_*.deb
Usage
Basic Package Build (Similar to Mock)
# Build a source package (like: mock -r fedora-35-x86_64 package.src.rpm)
mock build package.dsc
# Build with specific chroot config (like: mock -r debian-bookworm-amd64 package.src.rpm)
mock -r debian-bookworm-amd64 build package.dsc
# Build with specific chroot
mock build --chroot=bookworm-amd64 package.dsc
# Build with specific architecture
mock build --arch=amd64 package.dsc
Advanced Build Options (Mock's advanced CLI options)
# Skip running tests (like: mock --nocheck)
mock build --no-check package.dsc
# Build in offline mode (like: mock --offline)
mock build --offline package.dsc
# Set build timeout (like: mock --rpmbuild_timeout)
mock build --build-timeout 3600 package.dsc
# Force architecture (like: mock --forcearch)
mock build --force-arch amd64 package.dsc
# Unique extension for buildroot (like: mock --uniqueext)
mock build --unique-ext mybuild package.dsc
# Clean chroot after build (like: mock --cleanup-after)
mock build --cleanup-after package.dsc
# Don't clean chroot after build (like: mock --no-cleanup-after)
deb-mock build --no-cleanup-after package.dsc
Core Configurations (Mock's mock-core-configs equivalent)
# List available core configurations
deb-mock list-configs
# Use core configurations (similar to Mock's -r option)
deb-mock -r debian-bookworm-amd64 build package.dsc
deb-mock -r debian-sid-amd64 build package.dsc
deb-mock -r ubuntu-jammy-amd64 build package.dsc
deb-mock -r ubuntu-noble-amd64 build package.dsc
Chain Building (Mock's --chain equivalent)
# Build multiple packages that depend on each other
deb-mock chain package1.dsc package2.dsc package3.dsc
# Continue building even if one package fails
deb-mock chain --continue-on-failure package1.dsc package2.dsc package3.dsc
# Use core config with chain building
deb-mock -r debian-bookworm-amd64 chain package1.dsc package2.dsc
Package Management (Mock's package management commands)
# Install build dependencies (like: mock --installdeps package.src.rpm)
deb-mock install-deps package.dsc
# Install packages in chroot (like: mock --install package)
deb-mock install package1 package2 package3
# Update packages in chroot (like: mock --update)
deb-mock update
deb-mock update package1 package2
# Remove packages from chroot (like: mock --remove package)
deb-mock remove package1 package2
# Execute APT commands (like: mock --pm-cmd "command")
deb-mock apt-cmd "update"
deb-mock apt-cmd "install package"
Chroot Management (Similar to Mock)
# Initialize a new chroot (like: mock -r fedora-35-x86_64 --init)
deb-mock init-chroot bookworm-amd64
# List available chroots (like: mock --list-chroots)
deb-mock list-chroots
# Clean up a chroot (like: mock -r fedora-35-x86_64 --clean)
deb-mock clean-chroot bookworm-amd64
# Scrub a chroot without removing it (like: mock -r fedora-35-x86_64 --scrub)
deb-mock scrub-chroot bookworm-amd64
# Scrub all chroots (like: mock --scrub-all-chroots)
deb-mock scrub-all-chroots
Debugging and Configuration (Mock's debugging commands)
# Show current configuration (like: mock --debug-config)
deb-mock config
# Show detailed configuration (like: mock --debug-config-expanded)
deb-mock debug-config
deb-mock debug-config --expand
# Show cache statistics
deb-mock cache-stats
# Clean up old cache files
deb-mock cleanup-caches
Shell Access (Mock's --shell equivalent)
# Open a shell in the chroot environment
deb-mock shell
# Open a shell in a specific chroot
deb-mock shell --chroot=sid-amd64
# Use core config for shell access
deb-mock -r debian-sid-amd64 shell
File Operations (Mock's --copyin/--copyout equivalents)
# Copy files from host to chroot (like: mock --copyin file.txt /tmp/)
deb-mock copyin file.txt /tmp/
# Copy files from chroot to host (like: mock --copyout /tmp/file.txt .)
deb-mock copyout /tmp/file.txt .
# Use core config with file operations
deb-mock -r debian-bookworm-amd64 copyin file.txt /tmp/
Advanced Usage
# Build with custom configuration
deb-mock build --config=custom.conf package.dsc
# Build with verbose output
deb-mock build --verbose package.dsc
# Build with debug output
deb-mock build --debug package.dsc
# Keep chroot after build (for debugging)
deb-mock build --keep-chroot package.dsc
Core Configurations
Deb-Mock includes pre-configured build environments for popular Debian-based distributions, similar to Mock's mock-core-configs package:
Debian Family
debian-bookworm-amd64- Debian 12 (Bookworm) - AMD64debian-sid-amd64- Debian Unstable (Sid) - AMD64
Ubuntu Family
ubuntu-jammy-amd64- Ubuntu 22.04 LTS (Jammy) - AMD64ubuntu-noble-amd64- Ubuntu 24.04 LTS (Noble) - AMD64
Usage Examples
# Build for Debian Bookworm
deb-mock -r debian-bookworm-amd64 build package.dsc
# Build for Ubuntu Jammy
deb-mock -r ubuntu-jammy-amd64 build package.dsc
# Build for Debian Sid (unstable)
deb-mock -r debian-sid-amd64 build package.dsc
Configuration
Deb-Mock uses YAML configuration files to define build environments. See docs/configuration.md for detailed configuration options.
Example Configuration (Similar to Mock configs)
# Basic configuration
chroot_name: bookworm-amd64
architecture: amd64
suite: bookworm
output_dir: ./output
keep_chroot: false
verbose: false
debug: false
# Build environment
build_env:
DEB_BUILD_OPTIONS: parallel=4,nocheck
DEB_BUILD_PROFILES: nocheck
# Build options
build_options:
- --verbose
- --no-run-lintian
Comparison with Fedora Mock
| Mock Feature | Deb-Mock Equivalent | Status |
|---|---|---|
mock -r config package.src.rpm |
deb-mock -r config package.dsc |
✅ |
mock --chain |
deb-mock chain package1.dsc package2.dsc |
✅ |
mock --shell |
deb-mock shell |
✅ |
mock --copyin |
deb-mock copyin |
✅ |
mock --copyout |
deb-mock copyout |
✅ |
mock --scrub |
deb-mock scrub-chroot |
✅ |
mock --init |
deb-mock init-chroot |
✅ |
mock --clean |
deb-mock clean-chroot |
✅ |
mock --list-chroots |
deb-mock list-chroots |
✅ |
mock --installdeps |
deb-mock install-deps |
✅ |
mock --install |
deb-mock install |
✅ |
mock --update |
deb-mock update |
✅ |
mock --remove |
deb-mock remove |
✅ |
mock --pm-cmd |
deb-mock apt-cmd |
✅ |
mock --nocheck |
deb-mock --no-check |
✅ |
mock --offline |
deb-mock --offline |
✅ |
mock --forcearch |
deb-mock --force-arch |
✅ |
mock --debug-config |
deb-mock debug-config |
✅ |
mock-core-configs |
deb-mock list-configs |
✅ |
Development
This project is part of the three-tool system for Debian build and assembly:
- Deb-Mock (this project): Low-level build environment utility
- Deb-Orchestrator: Central build management system
- Tumbi-Assembler: Distribution composition tool
License
[License information to be added]
Contributing
[Contribution guidelines to be added]