# Deb-Mock ![Build Status](https://github.com/robojerk/deb-mock/workflows/Build%20Deb-Mock%20Package/badge.svg) 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 GitHub 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 - ![Build Status](https://github.com/robojerk/deb-mock/workflows/Build%20Deb-Mock%20Package/badge.svg) - ![Test Status](https://github.com/robojerk/deb-mock/workflows/Test%20Deb-Mock%20Build/badge.svg) ## Installation ```bash # Clone the repository git clone cd deb-mock # Install dependencies sudo apt install sbuild schroot debhelper build-essential debootstrap # Install deb-mock sudo python3 setup.py install ``` ## Usage ### Basic Package Build (Similar to Mock) ```bash # Build a source package (like: mock -r fedora-35-x86_64 package.src.rpm) deb-mock build package.dsc # Build with specific chroot config (like: mock -r debian-bookworm-amd64 package.src.rpm) deb-mock -r debian-bookworm-amd64 build package.dsc # Build with specific chroot deb-mock build --chroot=bookworm-amd64 package.dsc # Build with specific architecture deb-mock build --arch=amd64 package.dsc ``` ### Advanced Build Options (Mock's advanced CLI options) ```bash # Skip running tests (like: mock --nocheck) deb-mock build --no-check package.dsc # Build in offline mode (like: mock --offline) deb-mock build --offline package.dsc # Set build timeout (like: mock --rpmbuild_timeout) deb-mock build --build-timeout 3600 package.dsc # Force architecture (like: mock --forcearch) deb-mock build --force-arch amd64 package.dsc # Unique extension for buildroot (like: mock --uniqueext) deb-mock build --unique-ext mybuild package.dsc # Clean chroot after build (like: mock --cleanup-after) deb-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) ```bash # 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) ```bash # 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) ```bash # 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) ```bash # 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) ```bash # 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) ```bash # 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) ```bash # 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 ```bash # 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) - AMD64 - `debian-sid-amd64` - Debian Unstable (Sid) - AMD64 ### **Ubuntu Family** - `ubuntu-jammy-amd64` - Ubuntu 22.04 LTS (Jammy) - AMD64 - `ubuntu-noble-amd64` - Ubuntu 24.04 LTS (Noble) - AMD64 ### **Usage Examples** ```bash # 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) ```yaml # 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]