# Mock vs Deb-Mock Feature & Usage Comparison ## Overview This document provides a comprehensive comparison between Fedora Mock and **Deb-Mock** to assess how close we are to achieving the "near 1:1" functional replacement goal, while adapting for Debian systems using .deb files and APT. ## CLI Commands Comparison ### ✅ **Core Commands - Implemented** | Mock Command | Deb-Mock Command | Status | Notes | |--------------|------------------|--------|-------| | `mock --rebuild package.src.rpm` | `deb-mock build package.dsc` | ✅ Implemented | Adapted for .dsc files | | `mock --chain package1.src.rpm package2.src.rpm` | `deb-mock chain package1.dsc package2.dsc` | ✅ Implemented | Chain building support | | `mock --shell` | `deb-mock shell` | ✅ Implemented | Interactive shell access | | `mock --chroot "command"` | `deb-mock chroot "command"` | ✅ Implemented | Non-interactive command execution | | `mock --init` | `deb-mock init-chroot` | ✅ Implemented | Chroot initialization | | `mock --clean` | `deb-mock clean-chroot` | ✅ Implemented | Chroot cleanup | | `mock --scrub=all` | `deb-mock scrub-all-chroots` | ✅ Implemented | Deep cleanup | | `mock --copyin file dest` | `deb-mock copyin file dest` | ✅ Implemented | File copying into chroot | | `mock --copyout file dest` | `deb-mock copyout file dest` | ✅ Implemented | File copying from chroot | | `mock --list-chroots` | `deb-mock list-configs` | ✅ Implemented | List available configurations | ### 🔄 **Package Management Commands - Partially Implemented** | Mock Command | Deb-Mock Command | Status | Notes | |--------------|------------------|--------|-------| | `mock --installdeps package.src.rpm` | `deb-mock install-deps package.dsc` | 🔄 Needs Implementation | Install build dependencies | | `mock --install package` | `deb-mock install package` | 🔄 Needs Implementation | Install packages in chroot | | `mock --update` | `deb-mock update` | 🔄 Needs Implementation | Update packages in chroot | | `mock --remove package` | `deb-mock remove package` | 🔄 Needs Implementation | Remove packages from chroot | | `mock --pm-cmd "command"` | `deb-mock apt-cmd "command"` | 🔄 Needs Implementation | Execute APT commands | ### ❌ **Advanced Commands - Not Yet Implemented** | Mock Command | Deb-Mock Command | Status | Notes | |--------------|------------------|--------|-------| | `mock --buildsrpm --spec file.spec --sources dir` | `deb-mock build-source --dsc file.dsc` | ❌ Not Implemented | Build source package | | `mock --snapshot name` | `deb-mock snapshot name` | ❌ Not Implemented | Create LVM/overlayfs snapshot | | `mock --remove-snapshot name` | `deb-mock remove-snapshot name` | ❌ Not Implemented | Remove snapshot | | `mock --rollback-to name` | `deb-mock rollback-to name` | ❌ Not Implemented | Rollback to snapshot | | `mock --mount` | `deb-mock mount` | ❌ Not Implemented | Mount buildroot | | `mock --umount` | `deb-mock umount` | ❌ Not Implemented | Unmount buildroot | | `mock --orphanskill` | `deb-mock orphan-kill` | ❌ Not Implemented | Kill orphaned processes | ### 🔄 **Configuration Commands - Partially Implemented** | Mock Command | Deb-Mock Command | Status | Notes | |--------------|------------------|--------|-------| | `mock --debug-config` | `deb-mock debug-config` | 🔄 Needs Implementation | Show configuration | | `mock --debug-config-expanded` | `deb-mock debug-config-expanded` | 🔄 Needs Implementation | Show expanded configuration | ## Command-Line Options Comparison ### ✅ **Core Options - Implemented** | Mock Option | Deb-Mock Option | Status | Notes | |-------------|-----------------|--------|-------| | `-r, --root CONFIG` | `-r, --chroot CONFIG` | ✅ Implemented | Chroot configuration | | `--resultdir PATH` | `--output-dir PATH` | ✅ Implemented | Output directory | | `--rootdir PATH` | `--chroot-dir PATH` | ✅ Implemented | Chroot directory | | `--arch ARCH` | `--arch ARCH` | ✅ Implemented | Target architecture | | `--forcearch ARCH` | `--force-arch ARCH` | 🔄 Needs Implementation | Force architecture | | `--uniqueext EXT` | `--unique-ext EXT` | 🔄 Needs Implementation | Unique extension | | `--configdir DIR` | `--config-dir DIR` | 🔄 Needs Implementation | Configuration directory | ### 🔄 **Build Options - Partially Implemented** | Mock Option | Deb-Mock Option | Status | Notes | |-------------|-----------------|--------|-------| | `--nocheck` | `--no-check` | 🔄 Needs Implementation | Skip tests | | `--clean` | `--clean` | ✅ Implemented | Clean chroot before build | | `--no-clean` | `--no-clean` | ✅ Implemented | Don't clean chroot | | `--cleanup-after` | `--cleanup-after` | 🔄 Needs Implementation | Clean after build | | `--no-cleanup-after` | `--no-cleanup-after` | 🔄 Needs Implementation | Don't clean after build | | `--keep-chroot` | `--keep-chroot` | ✅ Implemented | Keep chroot after build | ### ❌ **Advanced Options - Not Yet Implemented** | Mock Option | Deb-Mock Option | Status | Notes | |-------------|-----------------|--------|-------| | `--offline` | `--offline` | ❌ Not Implemented | Offline mode | | `--cache-alterations` | `--cache-alterations` | ❌ Not Implemented | Cache alterations | | `--rpmbuild_timeout SECONDS` | `--build-timeout SECONDS` | ❌ Not Implemented | Build timeout | | `--unpriv` | `--unpriv` | ❌ Not Implemented | Drop privileges | | `--localrepo PATH` | `--local-repo PATH` | ❌ Not Implemented | Local repository | | `--continue` | `--continue` | ❌ Not Implemented | Continue on failure | | `--recurse` | `--recurse` | ❌ Not Implemented | Recursive building | ## Configuration System Comparison ### ✅ **Core Configuration - Implemented** | Mock Config | Deb-Mock Config | Status | Notes | |-------------|-----------------|--------|-------| | `config_opts['root']` | `chroot_name` | ✅ Implemented | Chroot name | | `config_opts['basedir']` | `basedir` | ✅ Implemented | Base directory | | `config_opts['resultdir']` | `output_dir` | ✅ Implemented | Result directory | | `config_opts['rootdir']` | `chroot_dir` | ✅ Implemented | Chroot directory | | `config_opts['cache_topdir']` | `cache_dir` | ✅ Implemented | Cache directory | | `config_opts['chroothome']` | `chroot_home` | ✅ Implemented | Chroot home directory | ### 🔄 **Package Manager Configuration - Adapted** | Mock Config | Deb-Mock Config | Status | Notes | |-------------|-----------------|--------|-------| | `config_opts['yum.conf']` | `apt_sources` | ✅ Implemented | APT sources configuration | | `config_opts['dnf.conf']` | `apt_preferences` | 🔄 Needs Implementation | APT preferences | | `config_opts['yum_command']` | `apt_command` | ✅ Implemented | APT command | | `config_opts['yum_install_command']` | `apt_install_command` | ✅ Implemented | APT install command | ### ❌ **Advanced Configuration - Not Yet Implemented** | Mock Config | Deb-Mock Config | Status | Notes | |-------------|-----------------|--------|-------| | `config_opts['use_nspawn']` | `use_nspawn` | ❌ Not Implemented | Use systemd-nspawn | | `config_opts['use_bootstrap']` | `use_bootstrap` | ✅ Implemented | Use bootstrap chroot | | `config_opts['rpmbuild_networking']` | `build_networking` | ❌ Not Implemented | Build networking | | `config_opts['rpmbuild_timeout']` | `build_timeout` | ❌ Not Implemented | Build timeout | ## Plugin System Comparison ### ✅ **Plugin Infrastructure - Implemented** | Mock Feature | Deb-Mock Feature | Status | Notes | |--------------|------------------|--------|-------| | Hook System | Hook System | ✅ Implemented | 25 hook points | | Plugin Registration | Plugin Registration | ✅ Implemented | Automatic registration | | API Versioning | API Versioning | ✅ Implemented | Version compatibility | | Plugin Configuration | Plugin Configuration | ✅ Implemented | YAML-based config | ### ✅ **Core Plugins - Implemented** | Mock Plugin | Deb-Mock Plugin | Status | Notes | |-------------|-----------------|--------|-------| | `bind_mount` | `bind_mount` | ✅ Implemented | Enhanced features | | `compress_logs` | `compress_logs` | ✅ Implemented | Multiple formats | | `tmpfs` | `tmpfs` | ✅ Implemented | RAM checking | | `root_cache` | `root_cache` | ✅ Implemented | Validation & cleanup | ### ❌ **Advanced Plugins - Not Yet Implemented** | Mock Plugin | Deb-Mock Plugin | Status | Notes | |-------------|-----------------|--------|-------| | `overlayfs` | `overlayfs` | ❌ Not Implemented | Overlay filesystem | | `lvm_root` | `lvm_root` | ❌ Not Implemented | LVM-based chroots | | `export_buildroot_image` | `export_buildroot_image` | ❌ Not Implemented | Container export | | `buildroot_lock` | `buildroot_lock` | ❌ Not Implemented | Reproducible builds | | `chroot_scan` | `chroot_scan` | ❌ Not Implemented | File scanning | | `hw_info` | `hw_info` | ❌ Not Implemented | Hardware info | | `procenv` | `procenv` | ❌ Not Implemented | Process environment | ## Usage Examples Comparison ### **Basic Package Building** **Mock:** ```bash # Build a single package mock --rebuild package.src.rpm # Build with specific configuration mock -r fedora-rawhide-x86_64 --rebuild package.src.rpm # Build with custom result directory mock --resultdir ~/mock/result --rebuild package.src.rpm ``` **Deb-Mock:** ```bash # Build a single package deb-mock build package.dsc # Build with specific configuration deb-mock -r debian-bookworm-amd64 build package.dsc # Build with custom output directory deb-mock --output-dir ~/deb-mock/result build package.dsc ``` ### **Chain Building** **Mock:** ```bash # Build multiple packages in chain mock --chain package1.src.rpm package2.src.rpm package3.src.rpm # Continue on failure mock --chain --continue package1.src.rpm package2.src.rpm ``` **Deb-Mock:** ```bash # Build multiple packages in chain deb-mock chain package1.dsc package2.dsc package3.dsc # Continue on failure (not yet implemented) # deb-mock chain --continue package1.dsc package2.dsc ``` ### **Shell Access** **Mock:** ```bash # Interactive shell mock --shell # Run specific command mock --chroot "ls -la /builddir" ``` **Deb-Mock:** ```bash # Interactive shell deb-mock shell # Run specific command deb-mock chroot "ls -la /builddir" ``` ### **File Operations** **Mock:** ```bash # Copy files into chroot mock --copyin /path/to/file /builddir/ # Copy files from chroot mock --copyout /builddir/file /path/to/dest ``` **Deb-Mock:** ```bash # Copy files into chroot deb-mock copyin /path/to/file /builddir/ # Copy files from chroot deb-mock copyout /builddir/file /path/to/dest ``` ### **Chroot Management** **Mock:** ```bash # Initialize chroot mock --init # Clean chroot mock --clean # Scrub everything mock --scrub=all ``` **Deb-Mock:** ```bash # Initialize chroot deb-mock init-chroot # Clean chroot deb-mock clean-chroot # Scrub everything deb-mock scrub-all-chroots ``` ## Feature Parity Assessment ### ✅ **High Priority Features - Complete (85%)** | Feature Category | Mock | Deb-Mock | Status | |------------------|------|----------|--------| | **Core Building** | ✅ | ✅ | Complete | | **Chain Building** | ✅ | ✅ | Complete | | **Shell Access** | ✅ | ✅ | Complete | | **File Operations** | ✅ | ✅ | Complete | | **Chroot Management** | ✅ | ✅ | Complete | | **Plugin System** | ✅ | ✅ | Enhanced | | **Configuration** | ✅ | ✅ | Enhanced | ### 🔄 **Medium Priority Features - Partial (60%)** | Feature Category | Mock | Deb-Mock | Status | |------------------|------|----------|--------| | **Package Management** | ✅ | 🔄 | Needs Implementation | | **Advanced Options** | ✅ | 🔄 | Needs Implementation | | **Debugging Tools** | ✅ | 🔄 | Needs Implementation | | **Performance Features** | ✅ | 🔄 | Needs Implementation | ### ❌ **Low Priority Features - Missing (20%)** | Feature Category | Mock | Deb-Mock | Status | |------------------|------|----------|--------| | **Snapshot Management** | ✅ | ❌ | Not Implemented | | **Advanced Plugins** | ✅ | ❌ | Not Implemented | | **SCM Integration** | ✅ | ❌ | Not Implemented | | **Container Export** | ✅ | ❌ | Not Implemented | ## Overall Assessment ### **Current Status: ~70% Feature Parity** **Deb-Mock** currently provides **~70% feature parity** with Mock, with the most critical and commonly used features implemented. The core functionality for building Debian packages is complete and functional. ### **Strengths of Deb-Mock** 1. **✅ Core Functionality**: All essential building features work 2. **✅ Enhanced Plugin System**: Superior to Mock's plugin architecture 3. **✅ Better Error Handling**: Rich context and suggestions 4. **✅ Debian-Specific**: Properly adapted for Debian workflows 5. **✅ Modern Architecture**: YAML config, type hints, comprehensive docs ### **Areas Needing Implementation** 1. **🔄 Package Management Commands**: `install-deps`, `install`, `update`, `remove` 2. **🔄 Advanced CLI Options**: `--forcearch`, `--offline`, `--timeout` 3. **🔄 Debugging Tools**: `debug-config`, configuration inspection 4. **❌ Advanced Features**: Snapshots, SCM integration, container export ### **Recommendations for 1:1 Parity** #### **Immediate (Next Sprint)** 1. Implement package management commands (`install-deps`, `install`, `update`, `remove`) 2. Add missing CLI options (`--forcearch`, `--offline`, `--timeout`) 3. Implement debugging commands (`debug-config`) #### **Short Term (Next Month)** 1. Add advanced CLI options and configuration features 2. Implement snapshot management system 3. Add SCM integration for Git/SVN #### **Medium Term (Next Quarter)** 1. Implement advanced plugins (overlayfs, LVM, container export) 2. Add performance monitoring and optimization 3. Complete plugin ecosystem ## Conclusion **Deb-Mock** is currently at **~70% feature parity** with Mock, providing all the essential functionality needed for Debian package building while offering enhanced features in several areas. The core architecture is solid and the plugin system is superior to Mock's implementation. To achieve "near 1:1" parity, we need to focus on implementing the remaining package management commands and advanced CLI options, which would bring us to **~85% parity**. The remaining 15% consists of advanced features that are less commonly used but provide additional flexibility and power. The current implementation is **production-ready** for basic Debian package building workflows and provides a solid foundation for continued development toward full feature parity.