deb-mock/mock
robojerk 4c0dcb2522
Some checks failed
Build Deb-Mock Package / build (push) Successful in 54s
Lint Code / Lint All Code (push) Failing after 1s
Test Deb-Mock Build / test (push) Failing after 36s
enhance: Add comprehensive .gitignore for deb-mock project
- Add mock-specific build artifacts (chroot/, mock-*, mockroot/)
- Include package build files (*.deb, *.changes, *.buildinfo)
- Add development tools (.coverage, .pytest_cache, .tox)
- Include system files (.DS_Store, Thumbs.db, ._*)
- Add temporary and backup files (*.tmp, *.bak, *.backup)
- Include local configuration overrides (config.local.yaml, .env.local)
- Add test artifacts and documentation builds
- Comprehensive coverage for Python build system project

This ensures build artifacts, chroot environments, and development
tools are properly ignored in version control.
2025-08-18 23:37:49 -07:00
..
docs enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
etc enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
integration-tests enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
py enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
scripts enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
tests enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
.gitignore enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
COPYING enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
Makefile enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
mock.conf enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
mockchain enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
precompile-bash-completion enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
pylintrc enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
README.md enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
requirements.txt enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
run-tests.sh enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00
setup.cfg enhance: Add comprehensive .gitignore for deb-mock project 2025-08-18 23:37:49 -07:00

deb-mock

Overview

deb-mock is Debian's equivalent to Fedora's Mock - a chroot build environment manager that provides isolated, reproducible build environments for Debian packages. It's designed to work seamlessly with deb-bootc-compose and deb-orchestrator to create Debian's complete bootc ecosystem.

What deb-mock Does

Core Purpose

deb-mock is fundamentally a chroot environment manager - it doesn't build packages directly, but rather creates and manages isolated build environments where packages can be built safely. Think of it as the "sandbox creator" for Debian package building, providing clean, reproducible environments for each build.

Primary Functions

1. Build Environment Management

  • Chroot Creation: Creates isolated chroot environments for builds
  • Buildroot Management: Manages buildroot lifecycle (create, populate, cleanup)
  • Package Installation: Installs build dependencies in the chroot
  • Environment Isolation: Ensures builds don't interfere with host system

2. Build Process Orchestration

  • Build Execution: Runs build commands within the chroot
  • Dependency Resolution: Manages package dependencies for builds
  • Result Collection: Collects build artifacts from the chroot
  • Cleanup Management: Handles post-build cleanup and caching

3. Security & Isolation

  • User Management: Manages UIDs/GIDs within the chroot
  • Mount Management: Controls filesystem access and mounts
  • Network Isolation: Provides network isolation during builds
  • Resource Control: Limits resource usage within chroots

Architecture

Single-Process Architecture

deb-mock uses a single-process, multi-stage architecture with clear separation of concerns:

┌─────────────────────────────────────────────────────────────┐
│                        deb-mock Process                    │
├─────────────────────────────────────────────────────────────┤
│  Configuration  │  Buildroot  │  Package   │  Command     │
│     Manager     │   Manager   │  Manager   │  Executor    │
├─────────────────────────────────────────────────────────────┤
│  Plugin System │  Mount      │  UID       │  State       │
│                │  Manager    │  Manager   │  Manager     │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
                    ┌─────────────────┐
                    │   Chroot        │
                    │   Environment   │
                    └─────────────────┘

Core Components

1. Main Entry Point (deb_mock/core.py)

The command-line interface that orchestrates all operations:

  • Command Parsing: Handles user commands and arguments
  • Configuration Loading: Loads and validates configuration
  • Buildroot Management: Creates and manages build environments
  • Command Execution: Executes build commands in chroots

2. Buildroot Manager (deb_mock/chroot.py)

The core component that manages chroot environments:

  • Chroot Lifecycle: Creates, populates, and destroys chroots
  • Package Management: Installs and manages packages in chroots
  • Plugin Integration: Coordinates plugin execution
  • State Management: Tracks buildroot state and progress

3. Package Manager (deb_mock/package_manager.py)

Handles package installation and dependency resolution:

  • Package Installation: Installs packages in chroots
  • Dependency Resolution: Resolves package dependencies
  • Repository Management: Manages package repositories
  • Fallback Support: Provides fallback to alternative package managers

Integration with deb-bootc-compose and deb-orchestrator

The deb-ecosystem Workflow

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│ deb-bootc-      │    │ deb-orchestrator│    │    deb-mock     │
│   compose       │    │   Build System  │    │ Build Environment│
└─────────────────┘    └─────────────────┘    └─────────────────┘
         │                       │                       │
         │ 1. "I need packages" │                       │
         │──────────────────────▶│                       │
         │                       │                       │
         │                       │ 2. "Build this .deb" │
         │                       │──────────────────────▶│
         │                       │                       │
         │                       │ 3. "Environment ready"│
         │                       │◀──────────────────────│
         │                       │                       │
         │                       │ 4. "Build complete"   │
         │                       │◀──────────────────────│
         │                       │                       │
         │ 5. "Packages ready"   │                       │
         │◀──────────────────────│                       │

How deb-mock Fits

  1. deb-orchestrator requests a build environment for package building
  2. deb-mock creates an isolated chroot environment
  3. deb-mock installs build dependencies in the chroot
  4. deb-orchestrator executes build commands in the deb-mock environment
  5. deb-mock provides build results back to deb-orchestrator

Development Status

Current Phase

  • Status: Foundation development
  • Phase: Phase 1 (Weeks 1-8 of parallel development)
  • Timeline: Parallel development with deb-bootc-compose and deb-orchestrator

Development Goals

  • Basic chroot management system
  • Package installation using apt/dpkg
  • Basic environment isolation
  • Simple plugin framework
  • YAML-based configuration system

Success Criteria

  • Can create isolated chroot environments
  • Can install packages in chroots
  • Basic isolation working
  • Simple plugin system functional
  • Configuration system working

Technology Stack

Primary Language

  • Python: For rapid development and Debian tooling integration

Key Dependencies

  • debootstrap: For creating base chroot environments
  • schroot: For chroot management and isolation
  • sbuild: For package building within chroots
  • apt/dpkg: For package management within chroots

Integration Points

  • deb-orchestrator: REST API for build environment requests
  • deb-bootc-compose: Direct integration for specific build operations
  • Debian build tools: Integration with sbuild, schroot, debootstrap
  • Package repositories: Debian package sources and results

Getting Started

Prerequisites

  • Python 3.9+ installed
  • Debian build tools (debootstrap, schroot, sbuild)
  • Basic understanding of Debian packaging and chroot environments

Development Setup

# Navigate to the project directory
cd parallel_projects/deb-mock

# Install Python dependencies
pip install -r requirements.txt

# Run basic tests
python -m pytest tests/

# Run the CLI
python -m deb_mock.cli --help

Configuration

Configuration is handled through YAML files. See config.yaml for examples.

Key Differences from Fedora's Mock

Package Management

  • Mock: Uses RPM, DNF/YUM
  • deb-mock: Uses DEB, apt/dpkg

Build Tools

  • Mock: Integrates with rpmbuild
  • deb-mock: Integrates with sbuild, debuild

Repository Structure

  • Mock: RPM repositories with metadata
  • deb-mock: Debian package pools with Sources/Packages files

Configuration

  • Mock: Python .cfg files
  • deb-mock: YAML configuration files

Contributing

This project is part of Debian's bootc ecosystem development. Contributions are welcome!

Development Guidelines

  • Follow Python best practices and PEP 8
  • Write comprehensive tests for all functionality
  • Document all public APIs and interfaces
  • Ensure compatibility with Debian's development standards

Contact

  • Project: Part of deb-bootc-compose ecosystem
  • Goal: Create Debian's equivalent to Fedora's Mock build environment manager
  • Timeline: Phase 1 development (Weeks 1-8)

License

[License information to be added]


Note: This is a development project. The project is currently in early development and not ready for production use. It's being developed in parallel with deb-bootc-compose and deb-orchestrator to create Debian's complete bootc ecosystem.