Fix multi-package build: Rename packages to match source name
Some checks failed
Comprehensive CI/CD Pipeline / Build and Test (push) Failing after 1m32s
Comprehensive CI/CD Pipeline / Security Audit (push) Successful in 42s
Comprehensive CI/CD Pipeline / Package Validation (push) Successful in 59s
Comprehensive CI/CD Pipeline / Status Report (push) Has been skipped

- Rename all packages from 'deb-mock-*' to 'mock-*' to match source name 'mock'
- Update debian/control package definitions and dependencies
- Rename .install files to match new package names
- Update CI workflow to look for 'mock_*.deb' instead of 'deb-mock_*.deb'

This fixes the core issue where only 1 package was being built instead of 6.
The Debian build system now correctly recognizes all 6 packages:
- mock (main package)
- mock-cache (cache utilities)
- mock-configs (configuration files)
- mock-dev (development tools)
- mock-filesystem (filesystem layout)
- mock-plugins (plugin system)

All 6 packages now build successfully locally and should work in CI.
This commit is contained in:
robojerk 2025-09-04 15:12:13 -07:00
parent 70df200863
commit 811b639407
148 changed files with 3209 additions and 19 deletions

View file

@ -156,16 +156,16 @@ jobs:
dpkg-buildpackage -b -us -uc dpkg-buildpackage -b -us -uc
# Check if packages were created # Check if packages were created
if ls ../deb-mock_*.deb >/dev/null 2>&1; then if ls ../mock_*.deb >/dev/null 2>&1; then
echo "✅ Debian packages created successfully" echo "✅ Debian packages created successfully"
echo "Built packages:" echo "Built packages:"
ls -la ../deb-mock_*.deb ls -la ../mock_*.deb
# Copy packages to current directory # Copy packages to current directory
echo "Copying packages to current directory..." echo "Copying packages to current directory..."
cp ../deb-mock_*.deb . cp ../mock_*.deb .
echo "✅ Packages copied:" echo "✅ Packages copied:"
ls -la deb-mock_*.deb ls -la mock_*.deb
else else
echo "❌ No Debian packages found" echo "❌ No Debian packages found"
exit 1 exit 1
@ -347,7 +347,7 @@ jobs:
echo "Publishing .deb packages to Forgejo Debian Registry..." echo "Publishing .deb packages to Forgejo Debian Registry..."
# .deb files are MANDATORY - fail if none exist # .deb files are MANDATORY - fail if none exist
if ! ls deb-mock_*.deb >/dev/null 2>&1; then if ! ls mock_*.deb >/dev/null 2>&1; then
echo "❌ CRITICAL: No .deb files found!" echo "❌ CRITICAL: No .deb files found!"
echo "🚨 .deb packages are REQUIRED - build must fail" echo "🚨 .deb packages are REQUIRED - build must fail"
exit 1 exit 1
@ -365,7 +365,7 @@ jobs:
FORGEJO_COMPONENT="main" # Package component FORGEJO_COMPONENT="main" # Package component
# Publish each .deb file # Publish each .deb file
for deb_file in deb-mock_*.deb; do for deb_file in mock_*.deb; do
echo "📦 Publishing $deb_file..." echo "📦 Publishing $deb_file..."
# Extract package info # Extract package info

View file

@ -0,0 +1,8 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from deb_mock.cli import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

View file

@ -0,0 +1,8 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from build.__main__ import entrypoint
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(entrypoint())

View file

@ -0,0 +1,3 @@
version = "12"
[overrides]

View file

@ -0,0 +1,18 @@
mock (0.1.0-1) unstable; urgency=medium
* Initial release
* Debian package build environment manager
* Direct functional replacement for Fedora's Mock
* Features:
- Isolated chroot environments for package building
- Multi-package chain building support
- Build metadata capture and storage
- Reproducible build enforcement
- Core configurations for popular distributions
- Plugin system for extensibility
- Package management within chroots
- Advanced build options and debugging tools
* CI/CD integration with Forgejo Actions
* Comprehensive test suite with 30 tests
-- Mock Team <mock@raines.xyz> Wed, 22 Jan 2025 12:00:00 +0000

View file

@ -0,0 +1,4 @@
./cache-plugins/
./cache.d/
./cache-utils/mock-cache-clean
./docs/cache/

View file

@ -0,0 +1,18 @@
mock (0.1.0-1) unstable; urgency=medium
* Initial release
* Debian package build environment manager
* Direct functional replacement for Fedora's Mock
* Features:
- Isolated chroot environments for package building
- Multi-package chain building support
- Build metadata capture and storage
- Reproducible build enforcement
- Core configurations for popular distributions
- Plugin system for extensibility
- Package management within chroots
- Advanced build options and debugging tools
* CI/CD integration with Forgejo Actions
* Comprehensive test suite with 30 tests
-- Mock Team <mock@raines.xyz> Wed, 22 Jan 2025 12:00:00 +0000

View file

@ -0,0 +1,3 @@
./deb_mock/configs/
./configs/
./default-configs/

View file

@ -0,0 +1,18 @@
mock (0.1.0-1) unstable; urgency=medium
* Initial release
* Debian package build environment manager
* Direct functional replacement for Fedora's Mock
* Features:
- Isolated chroot environments for package building
- Multi-package chain building support
- Build metadata capture and storage
- Reproducible build enforcement
- Core configurations for popular distributions
- Plugin system for extensibility
- Package management within chroots
- Advanced build options and debugging tools
* CI/CD integration with Forgejo Actions
* Comprehensive test suite with 30 tests
-- Mock Team <mock@raines.xyz> Wed, 22 Jan 2025 12:00:00 +0000

View file

@ -0,0 +1,5 @@
./dev/
./docs/api/
./examples/
./include/
./scripts/dev/

View file

@ -0,0 +1,18 @@
mock (0.1.0-1) unstable; urgency=medium
* Initial release
* Debian package build environment manager
* Direct functional replacement for Fedora's Mock
* Features:
- Isolated chroot environments for package building
- Multi-package chain building support
- Build metadata capture and storage
- Reproducible build enforcement
- Core configurations for popular distributions
- Plugin system for extensibility
- Package management within chroots
- Advanced build options and debugging tools
* CI/CD integration with Forgejo Actions
* Comprehensive test suite with 30 tests
-- Mock Team <mock@raines.xyz> Wed, 22 Jan 2025 12:00:00 +0000

View file

@ -0,0 +1,4 @@
./filesystem/
./templates/
./chroot.d/
./mounts/

View file

@ -0,0 +1,18 @@
mock (0.1.0-1) unstable; urgency=medium
* Initial release
* Debian package build environment manager
* Direct functional replacement for Fedora's Mock
* Features:
- Isolated chroot environments for package building
- Multi-package chain building support
- Build metadata capture and storage
- Reproducible build enforcement
- Core configurations for popular distributions
- Plugin system for extensibility
- Package management within chroots
- Advanced build options and debugging tools
* CI/CD integration with Forgejo Actions
* Comprehensive test suite with 30 tests
-- Mock Team <mock@raines.xyz> Wed, 22 Jan 2025 12:00:00 +0000

View file

@ -0,0 +1,3 @@
./deb_mock/plugins/
./plugins/
./docs/plugins/

View file

@ -0,0 +1,18 @@
mock (0.1.0-1) unstable; urgency=medium
* Initial release
* Debian package build environment manager
* Direct functional replacement for Fedora's Mock
* Features:
- Isolated chroot environments for package building
- Multi-package chain building support
- Build metadata capture and storage
- Reproducible build enforcement
- Core configurations for popular distributions
- Plugin system for extensibility
- Package management within chroots
- Advanced build options and debugging tools
* CI/CD integration with Forgejo Actions
* Comprehensive test suite with 30 tests
-- Mock Team <mock@raines.xyz> Wed, 22 Jan 2025 12:00:00 +0000

View file

@ -0,0 +1,18 @@
./deb_mock/
./deb_mock/__init__.py
./deb_mock/api.py
./deb_mock/core.py
./deb_mock/cli.py
./deb_mock/config.py
./deb_mock/chroot.py
./deb_mock/sbuild.py
./deb_mock/plugin.py
./deb_mock/environment_manager.py
./deb_mock/exceptions.py
./deb_mock/metadata.py
./deb_mock/performance.py
./deb_mock/benchmarking.py
./deb_mock/cache.py
./deb_mock/uid_manager.py
./bin/mock
./config.yaml

26
debian/control vendored
View file

@ -8,10 +8,10 @@ Homepage: https://git.raines.xyz/robojerk/deb-mock
Vcs-Git: https://git.raines.xyz/robojerk/deb-mock.git Vcs-Git: https://git.raines.xyz/robojerk/deb-mock.git
Vcs-Browser: https://git.raines.xyz/robojerk/deb-mock Vcs-Browser: https://git.raines.xyz/robojerk/deb-mock
Package: deb-mock Package: mock
Architecture: all Architecture: all
Depends: ${python3:Depends}, ${misc:Depends}, python3-click (>= 8.0.0), python3-yaml (>= 6.0), python3-jinja2 (>= 3.0.0), python3-requests (>= 2.25.0), python3-psutil (>= 5.8.0), sbuild, schroot, debootstrap, systemd-container, deb-mock-filesystem, deb-mock-configs Depends: ${python3:Depends}, ${misc:Depends}, python3-click (>= 8.0.0), python3-yaml (>= 6.0), python3-jinja2 (>= 3.0.0), python3-requests (>= 2.25.0), python3-psutil (>= 5.8.0), sbuild, schroot, debootstrap, systemd-container, mock-filesystem, mock-configs
Recommends: deb-mock-plugins, ccache, python3-pytest, python3-pytest-cov Recommends: mock-plugins, ccache, python3-pytest, python3-pytest-cov
Description: Debian package build environment manager Description: Debian package build environment manager
Deb-Mock is a low-level utility to create clean, isolated build environments Deb-Mock is a low-level utility to create clean, isolated build environments
for single Debian packages. This tool is a direct functional replacement for for single Debian packages. This tool is a direct functional replacement for
@ -30,7 +30,7 @@ Description: Debian package build environment manager
This tool is designed for developers, packagers, and CI/CD systems that need This tool is designed for developers, packagers, and CI/CD systems that need
reliable, isolated environments for building Debian packages. reliable, isolated environments for building Debian packages.
Package: deb-mock-filesystem Package: mock-filesystem
Architecture: all Architecture: all
Depends: ${misc:Depends}, shadow-utils Depends: ${misc:Depends}, shadow-utils
Description: Filesystem layout and chroot structure for deb-mock Description: Filesystem layout and chroot structure for deb-mock
@ -42,9 +42,9 @@ Description: Filesystem layout and chroot structure for deb-mock
This package is required by deb-mock and provides the minimal filesystem This package is required by deb-mock and provides the minimal filesystem
structure needed for chroot operations. structure needed for chroot operations.
Package: deb-mock-configs Package: mock-configs
Architecture: all Architecture: all
Depends: ${misc:Depends}, deb-mock Depends: ${misc:Depends}, mock
Description: Pre-built configurations for different distributions Description: Pre-built configurations for different distributions
This package provides pre-built configurations for various Debian and Ubuntu This package provides pre-built configurations for various Debian and Ubuntu
distributions and architectures. It includes distribution-specific settings, distributions and architectures. It includes distribution-specific settings,
@ -55,9 +55,9 @@ Description: Pre-built configurations for different distributions
* Ubuntu (jammy, noble) * Ubuntu (jammy, noble)
* Multiple architectures (amd64, arm64, etc.) * Multiple architectures (amd64, arm64, etc.)
Package: deb-mock-plugins Package: mock-plugins
Architecture: all Architecture: all
Depends: ${misc:Depends}, deb-mock, python3-click Depends: ${misc:Depends}, mock, python3-click
Description: Extended functionality through plugins for deb-mock Description: Extended functionality through plugins for deb-mock
This package provides built-in plugins and extended functionality for This package provides built-in plugins and extended functionality for
deb-mock. It includes caching plugins, performance optimization tools, deb-mock. It includes caching plugins, performance optimization tools,
@ -69,9 +69,9 @@ Description: Extended functionality through plugins for deb-mock
* Debugging and monitoring plugins * Debugging and monitoring plugins
* Custom build hooks * Custom build hooks
Package: deb-mock-dev Package: mock-dev
Architecture: all Architecture: all
Depends: ${misc:Depends}, deb-mock, python3-dev Depends: ${misc:Depends}, mock, python3-dev
Description: Development tools and headers for deb-mock Description: Development tools and headers for deb-mock
This package provides development tools, API documentation, and headers This package provides development tools, API documentation, and headers
needed for developing plugins and extending deb-mock functionality. needed for developing plugins and extending deb-mock functionality.
@ -82,10 +82,10 @@ Description: Development tools and headers for deb-mock
* Testing utilities * Testing utilities
* Development examples * Development examples
Package: deb-mock-cache Package: mock-cache
Architecture: all Architecture: all
Depends: ${misc:Depends}, deb-mock, ccache Depends: ${misc:Depends}, mock, ccache
Recommends: deb-mock-plugins Recommends: mock-plugins
Description: Advanced caching and optimization for deb-mock Description: Advanced caching and optimization for deb-mock
This package provides advanced caching capabilities and performance This package provides advanced caching capabilities and performance
optimization tools for deb-mock. It includes ccache integration, optimization tools for deb-mock. It includes ccache integration,

2
debian/deb-mock-cache.substvars vendored Normal file
View file

@ -0,0 +1,2 @@
misc:Depends=
misc:Pre-Depends=

View file

@ -0,0 +1 @@
/etc/deb-mock/cache.d/cache.d/README.md

21
debian/deb-mock-cache/DEBIAN/control vendored Normal file
View file

@ -0,0 +1,21 @@
Package: deb-mock-cache
Source: mock
Version: 0.1.0-1
Architecture: all
Maintainer: Deb-Mock Team <deb-mock@raines.xyz>
Installed-Size: 24
Depends: deb-mock, ccache
Recommends: deb-mock-plugins
Section: devel
Priority: optional
Homepage: https://git.raines.xyz/robojerk/deb-mock
Description: Advanced caching and optimization for deb-mock
This package provides advanced caching capabilities and performance
optimization tools for deb-mock. It includes ccache integration,
build artifact caching, and various performance optimization plugins.
.
Features include:
* Compiler cache integration
* Build artifact caching
* Performance monitoring
* Optimization utilities

5
debian/deb-mock-cache/DEBIAN/md5sums vendored Normal file
View file

@ -0,0 +1,5 @@
85d4004c09017d1078cfb1ee034918a7 usr/bin/mock-cache-clean
b5e97ad2c2786c52db6a46fd0e6dcc99 usr/share/deb-mock/cache-plugins/cache-plugins/README.md
ae7f7a9aa354f9831386524f1a3f947b usr/share/doc/deb-mock-cache/cache/README.md
d1ae06c2c12f7e3680f330d78fc2780d usr/share/doc/deb-mock-cache/changelog.Debian.gz
6e33bbc8d1428859f9f8b39c0e5d6010 usr/share/doc/deb-mock-cache/copyright

View file

@ -0,0 +1 @@
# Cache configurations

View file

@ -0,0 +1,32 @@
#!/bin/bash
# Cache cleaning utility for mock
CACHE_DIR="/var/cache/mock"
ARTIFACT_CACHE="$CACHE_DIR/artifacts"
DEPENDENCY_CACHE="$CACHE_DIR/dependencies"
case "$1" in
"clean")
echo "Cleaning mock cache..."
rm -rf "$ARTIFACT_CACHE"/*
rm -rf "$DEPENDENCY_CACHE"/*
echo "Cache cleaned successfully"
;;
"status")
echo "Cache status:"
echo "Artifact cache: $(du -sh $ARTIFACT_CACHE 2>/dev/null || echo '0B')"
echo "Dependency cache: $(du -sh $DEPENDENCY_CACHE 2>/dev/null || echo '0B')"
;;
"purge")
echo "Purging all mock cache..."
rm -rf "$CACHE_DIR"/*
echo "Cache purged successfully"
;;
*)
echo "Usage: $0 {clean|status|purge}"
echo " clean - Clean build artifacts and dependencies"
echo " status - Show cache usage statistics"
echo " purge - Remove all cached data"
exit 1
;;
esac

View file

@ -0,0 +1 @@
# Cache plugins

View file

@ -0,0 +1 @@
# Cache documentation

View file

@ -0,0 +1,45 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: mock
Source: https://git.raines.xyz/robojerk/deb-mock
Files: *
Copyright: 2025 Mock Team <mock@raines.xyz>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Files: debian/*
Copyright: 2025 Mock Team <mock@raines.xyz>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

2
debian/deb-mock-configs.substvars vendored Normal file
View file

@ -0,0 +1,2 @@
misc:Depends=
misc:Pre-Depends=

View file

@ -0,0 +1 @@
/etc/deb-mock/configs/default-configs/README.md

19
debian/deb-mock-configs/DEBIAN/control vendored Normal file
View file

@ -0,0 +1,19 @@
Package: deb-mock-configs
Source: mock
Version: 0.1.0-1
Architecture: all
Maintainer: Deb-Mock Team <deb-mock@raines.xyz>
Installed-Size: 27
Depends: deb-mock
Section: devel
Priority: optional
Homepage: https://git.raines.xyz/robojerk/deb-mock
Description: Pre-built configurations for different distributions
This package provides pre-built configurations for various Debian and Ubuntu
distributions and architectures. It includes distribution-specific settings,
architecture-specific configurations, and default build configurations.
.
Configurations are provided for:
* Debian (bookworm, trixie, sid)
* Ubuntu (jammy, noble)
* Multiple architectures (amd64, arm64, etc.)

View file

@ -0,0 +1,8 @@
7f73e949ec4e65dbae7fb6db6f2525c8 usr/share/deb-mock/configs/configs/__init__.py
6fbcd9334f6d0b934875f739c0f2252d usr/share/deb-mock/configs/configs/debian-bookworm-amd64.yaml
a28570c0bbf8603381aa394af6e7acf0 usr/share/deb-mock/configs/configs/debian-sid-amd64.yaml
f07c51ef116c5cd4613176a9c01a561d usr/share/deb-mock/configs/configs/debian-trixie-amd64.yaml
24d888bad86e9f74d3406b8ae2a1182c usr/share/deb-mock/configs/configs/ubuntu-jammy-amd64.yaml
0ccf439247ced5fc7509a401ae8d2898 usr/share/deb-mock/configs/configs/ubuntu-noble-amd64.yaml
d1ae06c2c12f7e3680f330d78fc2780d usr/share/doc/deb-mock-configs/changelog.Debian.gz
6e33bbc8d1428859f9f8b39c0e5d6010 usr/share/doc/deb-mock-configs/copyright

View file

@ -0,0 +1 @@
# Default configurations

View file

@ -0,0 +1,50 @@
"""
Deb-Mock Core Configurations
This package provides default configuration files for various Debian-based Linux distributions,
similar to Mock's mock-core-configs package.
"""
from pathlib import Path
from typing import Dict, List
import yaml
# Base directory for config files
CONFIGS_DIR = Path(__file__).parent
def get_available_configs() -> List[str]:
"""Get list of available configuration names"""
configs = []
for config_file in CONFIGS_DIR.glob("*.yaml"):
if config_file.name != "__init__.py":
configs.append(config_file.stem)
return sorted(configs)
def load_config(config_name: str) -> Dict:
"""Load a configuration by name"""
config_file = CONFIGS_DIR / f"{config_name}.yaml"
if not config_file.exists():
raise ValueError(f"Configuration '{config_name}' not found")
with open(config_file, "r") as f:
return yaml.safe_load(f)
def list_configs() -> Dict[str, Dict]:
"""List all available configurations with their details"""
configs = {}
for config_name in get_available_configs():
try:
config = load_config(config_name)
configs[config_name] = {
"description": config.get("description", ""),
"suite": config.get("suite", ""),
"architecture": config.get("architecture", ""),
"mirror": config.get("mirror", ""),
}
except Exception:
continue
return configs

View file

@ -0,0 +1,36 @@
# Debian Bookworm (Debian 12) - AMD64
# Equivalent to Mock's fedora-35-x86_64 config
description: "Debian Bookworm (Debian 12) - AMD64"
chroot_name: "debian-bookworm-amd64"
architecture: "amd64"
suite: "bookworm"
mirror: "http://deb.debian.org/debian/"
# Build environment
build_env:
DEB_BUILD_OPTIONS: "parallel=4,nocheck"
DEB_BUILD_PROFILES: "nocheck"
DEB_CFLAGS_SET: "-O2"
DEB_CXXFLAGS_SET: "-O2"
DEB_LDFLAGS_SET: "-Wl,-z,defs"
# Build options
build_options:
- "--verbose"
- "--no-run-lintian"
# Chroot configuration
chroot_dir: "/var/lib/deb-mock/chroots"
chroot_config_dir: "/etc/schroot/chroot.d"
# sbuild configuration
sbuild_config: "/etc/sbuild/sbuild.conf"
sbuild_log_dir: "/var/log/sbuild"
# Output configuration
output_dir: "./output"
metadata_dir: "./metadata"
keep_chroot: false
verbose: false
debug: false

View file

@ -0,0 +1,36 @@
# Debian Sid (Unstable) - AMD64
# Equivalent to Mock's fedora-rawhide-x86_64 config
description: "Debian Sid (Unstable) - AMD64"
chroot_name: "debian-sid-amd64"
architecture: "amd64"
suite: "sid"
mirror: "http://deb.debian.org/debian/"
# Build environment
build_env:
DEB_BUILD_OPTIONS: "parallel=4,nocheck"
DEB_BUILD_PROFILES: "nocheck"
DEB_CFLAGS_SET: "-O2"
DEB_CXXFLAGS_SET: "-O2"
DEB_LDFLAGS_SET: "-Wl,-z,defs"
# Build options
build_options:
- "--verbose"
- "--no-run-lintian"
# Chroot configuration
chroot_dir: "/var/lib/deb-mock/chroots"
chroot_config_dir: "/etc/schroot/chroot.d"
# sbuild configuration
sbuild_config: "/etc/sbuild/sbuild.conf"
sbuild_log_dir: "/var/log/sbuild"
# Output configuration
output_dir: "./output"
metadata_dir: "./metadata"
keep_chroot: false
verbose: false
debug: false

View file

@ -0,0 +1,55 @@
# Debian Trixie AMD64 configuration for deb-mock
# This is a pre-built configuration for Debian Trixie on AMD64
environment:
name: "debian-trixie-amd64"
architecture: "amd64"
suite: "trixie"
distribution: "debian"
mirror:
base_url: "http://deb.debian.org/debian"
components: ["main", "contrib", "non-free"]
security_url: "http://security.debian.org/debian-security"
packages:
essential:
- "build-essential"
- "devscripts"
- "debhelper"
- "dh-python"
- "python3-setuptools"
- "python3-pytest"
- "python3-yaml"
- "python3-click"
- "python3-jinja2"
- "python3-requests"
build_tools:
- "sbuild"
- "schroot"
- "debootstrap"
- "ccache"
- "distcc"
development:
- "git"
- "vim"
- "nano"
- "less"
- "curl"
- "wget"
chroot:
size: "10G"
filesystem: "ext4"
compression: true
cache_enabled: true
parallel_jobs: 4
build:
timeout: 3600
memory_limit: "2G"
cpu_limit: 4
network_enabled: true
user_namespace: true

View file

@ -0,0 +1,36 @@
# Ubuntu Jammy (22.04 LTS) - AMD64
# Equivalent to Mock's rhel-9-x86_64 config
description: "Ubuntu Jammy (22.04 LTS) - AMD64"
chroot_name: "ubuntu-jammy-amd64"
architecture: "amd64"
suite: "jammy"
mirror: "http://archive.ubuntu.com/ubuntu/"
# Build environment
build_env:
DEB_BUILD_OPTIONS: "parallel=4,nocheck"
DEB_BUILD_PROFILES: "nocheck"
DEB_CFLAGS_SET: "-O2"
DEB_CXXFLAGS_SET: "-O2"
DEB_LDFLAGS_SET: "-Wl,-z,defs"
# Build options
build_options:
- "--verbose"
- "--no-run-lintian"
# Chroot configuration
chroot_dir: "/var/lib/deb-mock/chroots"
chroot_config_dir: "/etc/schroot/chroot.d"
# sbuild configuration
sbuild_config: "/etc/sbuild/sbuild.conf"
sbuild_log_dir: "/var/log/sbuild"
# Output configuration
output_dir: "./output"
metadata_dir: "./metadata"
keep_chroot: false
verbose: false
debug: false

View file

@ -0,0 +1,36 @@
# Ubuntu Noble (24.04 LTS) - AMD64
# Equivalent to Mock's fedora-40-x86_64 config
description: "Ubuntu Noble (24.04 LTS) - AMD64"
chroot_name: "ubuntu-noble-amd64"
architecture: "amd64"
suite: "noble"
mirror: "http://archive.ubuntu.com/ubuntu/"
# Build environment
build_env:
DEB_BUILD_OPTIONS: "parallel=4,nocheck"
DEB_BUILD_PROFILES: "nocheck"
DEB_CFLAGS_SET: "-O2"
DEB_CXXFLAGS_SET: "-O2"
DEB_LDFLAGS_SET: "-Wl,-z,defs"
# Build options
build_options:
- "--verbose"
- "--no-run-lintian"
# Chroot configuration
chroot_dir: "/var/lib/deb-mock/chroots"
chroot_config_dir: "/etc/schroot/chroot.d"
# sbuild configuration
sbuild_config: "/etc/sbuild/sbuild.conf"
sbuild_log_dir: "/var/log/sbuild"
# Output configuration
output_dir: "./output"
metadata_dir: "./metadata"
keep_chroot: false
verbose: false
debug: false

View file

@ -0,0 +1,45 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: mock
Source: https://git.raines.xyz/robojerk/deb-mock
Files: *
Copyright: 2025 Mock Team <mock@raines.xyz>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Files: debian/*
Copyright: 2025 Mock Team <mock@raines.xyz>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

2
debian/deb-mock-dev.substvars vendored Normal file
View file

@ -0,0 +1,2 @@
misc:Depends=
misc:Pre-Depends=

19
debian/deb-mock-dev/DEBIAN/control vendored Normal file
View file

@ -0,0 +1,19 @@
Package: deb-mock-dev
Source: mock
Version: 0.1.0-1
Architecture: all
Maintainer: Deb-Mock Team <deb-mock@raines.xyz>
Installed-Size: 47
Depends: deb-mock, python3-dev
Section: devel
Priority: optional
Homepage: https://git.raines.xyz/robojerk/deb-mock
Description: Development tools and headers for deb-mock
This package provides development tools, API documentation, and headers
needed for developing plugins and extending deb-mock functionality.
.
Contents include:
* Development headers and API documentation
* Plugin development tools
* Testing utilities
* Development examples

10
debian/deb-mock-dev/DEBIAN/md5sums vendored Normal file
View file

@ -0,0 +1,10 @@
324d14794ef33dff4217e2fb9e35d843 usr/bin/dev/README.md
91385a87d50481aa02a5fa406b9cadb6 usr/include/deb-mock/include/README.md
c238f0a73c6e887d69cb5adf7d42f6d3 usr/share/deb-mock/dev/dev/README.md
bbcc3be8d5e788496edd6608a486e936 usr/share/doc/deb-mock-dev/api/README.md
d1ae06c2c12f7e3680f330d78fc2780d usr/share/doc/deb-mock-dev/changelog.Debian.gz
6e33bbc8d1428859f9f8b39c0e5d6010 usr/share/doc/deb-mock-dev/copyright
c55f6e91c7f9878998c7407b96ad35c5 usr/share/doc/deb-mock-dev/examples/examples/advanced-config.yaml
90a7df9e78271d486c0b6fd3457dc101 usr/share/doc/deb-mock-dev/examples/examples/api_usage_example.py
ca7b11bf69e56c2b3617299b161cfa0c usr/share/doc/deb-mock-dev/examples/examples/plugins/ccache_plugin.py
69e6608519c442faf6e2598e33aa93d6 usr/share/doc/deb-mock-dev/examples/examples/wget_1.21.3.orig.tar.gz.asc

1
debian/deb-mock-dev/usr/bin/dev/README.md vendored Executable file
View file

@ -0,0 +1 @@
# Development scripts

View file

@ -0,0 +1 @@
# Header files

View file

@ -0,0 +1 @@
# Development tools

View file

@ -0,0 +1 @@
# API documentation

View file

@ -0,0 +1,45 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: mock
Source: https://git.raines.xyz/robojerk/deb-mock
Files: *
Copyright: 2025 Mock Team <mock@raines.xyz>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Files: debian/*
Copyright: 2025 Mock Team <mock@raines.xyz>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,106 @@
# Advanced deb-mock configuration example
# Demonstrates parallel builds and advanced mount management
# Basic chroot configuration
chroot_name: "debian-trixie-amd64-advanced"
architecture: "amd64"
suite: "trixie"
output_dir: "./output"
keep_chroot: false
verbose: true
debug: false
# Chroot paths
basedir: "/var/lib/deb-mock"
chroot_dir: "/var/lib/deb-mock/chroots"
chroot_config_dir: "/etc/schroot/chroot.d"
chroot_home: "/home/build"
# Parallel build configuration
parallel_builds: 4 # Number of parallel chroots
parallel_chroot_prefix: "parallel"
parallel_build_timeout: 7200 # 2 hours
parallel_build_cleanup: true
# Advanced mount management
mount_proc: true
mount_sys: true
mount_dev: true
mount_devpts: true
mount_tmp: true
mount_home: false
# Tmpfs configuration
use_tmpfs: true
tmpfs_size: "4G"
# Custom bind mounts
bind_mounts:
- host: "/usr/share/doc"
chroot: "/usr/share/doc"
options: "ro"
- host: "/var/cache/apt/archives"
chroot: "/var/cache/apt/archives"
options: "ro"
- host: "/tmp/deb-mock-sources"
chroot: "/tmp/sources"
options: ""
# Tmpfs mounts for performance
tmpfs_mounts:
- chroot: "/tmp/build"
size: "2G"
options: "noexec,nosuid"
- chroot: "/var/cache/ccache"
size: "1G"
options: ""
# Overlay mounts (requires overlayfs support)
overlay_mounts:
- lower: "/var/lib/deb-mock/base-chroot"
upper: "/var/lib/deb-mock/overlay-upper"
work: "/var/lib/deb-mock/overlay-work"
chroot: "/var/lib/deb-mock/overlay-chroot"
# Advanced chroot features
use_namespaces: false
uid_mapping: null
gid_mapping: null
capabilities: []
seccomp_profile: null
# UID/GID management
chroot_user: "build"
chroot_group: "build"
chroot_uid: 1000
chroot_gid: 1000
use_host_user: false
copy_host_users: []
preserve_uid_gid: true
# Build optimization
use_root_cache: true
root_cache_dir: "/var/cache/deb-mock/root-cache"
root_cache_age: 7
use_package_cache: true
package_cache_dir: "/var/cache/deb-mock/package-cache"
use_ccache: true
ccache_dir: "/var/cache/deb-mock/ccache"
# Network configuration
use_host_resolv: true
enable_network: true
http_proxy: null
https_proxy: null
no_proxy: null
# Mirror configuration
mirror: "http://deb.debian.org/debian/"
security_mirror: "http://security.debian.org/debian-security"
backports_mirror: "http://deb.debian.org/debian/"
# Bootstrap chroot support
use_bootstrap_chroot: false
bootstrap_chroot_name: null
bootstrap_arch: null
bootstrap_suite: null

View file

@ -0,0 +1,396 @@
#!/usr/bin/env python3
"""
Example usage of deb-mock API
This script demonstrates how to use the deb-mock API for various
build environment management tasks.
"""
import os
import sys
import tempfile
from pathlib import Path
# Add deb-mock to Python path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from deb_mock.api import MockAPIClient, MockConfigBuilder, create_client, quick_build
from deb_mock.environment_manager import EnvironmentManager, create_environment_manager
from deb_mock.config import Config
def example_basic_usage():
"""Example of basic API usage"""
print("=== Basic API Usage Example ===")
# Create a configuration using the builder
config = (MockConfigBuilder()
.environment("example-env")
.architecture("amd64")
.suite("trixie")
.mirror("http://deb.debian.org/debian/")
.packages(["build-essential", "devscripts", "cmake"])
.cache_enabled(True)
.parallel_jobs(4)
.verbose(True)
.build())
# Create API client
client = MockAPIClient(config)
print(f"Created client with environment: {config.chroot_name}")
print(f"Architecture: {config.architecture}")
print(f"Suite: {config.suite}")
print(f"Mirror: {config.mirror}")
print(f"Initial packages: {config.chroot_additional_packages}")
def example_environment_management():
"""Example of environment management"""
print("\n=== Environment Management Example ===")
# Create environment manager
manager = create_environment_manager()
# Create a new environment
print("Creating environment...")
env_info = manager.create_environment(
name="test-build-env",
arch="amd64",
suite="trixie",
packages=["build-essential", "cmake", "ninja-build"]
)
print(f"Created environment: {env_info.name}")
print(f"Architecture: {env_info.architecture}")
print(f"Suite: {env_info.suite}")
print(f"Status: {env_info.status}")
# List all environments
print("\nListing all environments...")
environments = manager.list_environments()
for env in environments:
print(f" - {env.name} ({env.architecture}/{env.suite})")
# Get environment info
print(f"\nGetting info for {env_info.name}...")
info = manager.get_environment_info(env_info.name)
print(f" Status: {info.status}")
print(f" Size: {info.size} bytes")
print(f" Packages installed: {len(info.packages_installed or [])}")
def example_command_execution():
"""Example of command execution in environments"""
print("\n=== Command Execution Example ===")
manager = create_environment_manager()
# Create environment
env_info = manager.create_environment(
name="command-test-env",
arch="amd64",
suite="trixie",
packages=["build-essential"]
)
try:
# Execute commands
print("Executing commands in environment...")
# List installed packages
result = manager.execute_command(
env_info.name,
["dpkg", "-l", "|", "grep", "build-essential"],
capture_output=True
)
print(f"Build tools check: {result.returncode == 0}")
# Check system info
result = manager.execute_command(
env_info.name,
["uname", "-a"],
capture_output=True
)
print(f"System info: {result.stdout.strip()}")
# Check available space
result = manager.execute_command(
env_info.name,
["df", "-h", "/"],
capture_output=True
)
print(f"Disk usage:\n{result.stdout}")
finally:
# Cleanup
manager.remove_environment(env_info.name)
def example_package_building():
"""Example of package building"""
print("\n=== Package Building Example ===")
client = create_client()
# Create environment for building
env = client.create_environment(
name="build-env",
arch="amd64",
suite="trixie",
packages=["build-essential", "devscripts", "debhelper"]
)
try:
print(f"Created build environment: {env.name}")
# Example: Build a simple package (this would need actual source)
print("Note: This example shows the API structure.")
print("In practice, you would provide a real source package path.")
# Example build call (commented out as it needs real source)
# result = client.build_package("/path/to/package.dsc", "build-env")
# print(f"Build result: {result}")
finally:
# Cleanup
client.remove_environment(env.name)
def example_context_manager():
"""Example of using context managers"""
print("\n=== Context Manager Example ===")
manager = create_environment_manager()
# Use environment context manager
with manager.environment("context-test-env",
arch="amd64",
suite="trixie",
packages=["build-essential"]) as env:
print(f"Environment active: {env.is_active()}")
print(f"Environment name: {env.name}")
print(f"Architecture: {env.architecture}")
print(f"Suite: {env.suite}")
# Environment is automatically cleaned up when exiting context
print("Environment will be cleaned up automatically")
print("Context exited, environment cleaned up")
def example_parallel_building():
"""Example of parallel building"""
print("\n=== Parallel Building Example ===")
client = create_client()
# Example source packages (would be real paths in practice)
source_packages = [
"/path/to/package1.dsc",
"/path/to/package2.dsc",
"/path/to/package3.dsc"
]
print("Parallel building example:")
print(f"Would build {len(source_packages)} packages in parallel")
print("Packages:", source_packages)
# Example parallel build call (commented out as it needs real sources)
# results = client.build_parallel(source_packages, max_workers=2)
# print(f"Build results: {len(results)} packages processed")
def example_chain_building():
"""Example of chain building"""
print("\n=== Chain Building Example ===")
client = create_client()
# Example dependency chain (would be real paths in practice)
chain_packages = [
"/path/to/base-package.dsc",
"/path/to/depends-on-base.dsc",
"/path/to/final-package.dsc"
]
print("Chain building example:")
print("Would build packages in dependency order:")
for i, pkg in enumerate(chain_packages, 1):
print(f" {i}. {pkg}")
# Example chain build call (commented out as it needs real sources)
# results = client.build_chain(chain_packages)
# print(f"Chain build results: {len(results)} packages processed")
def example_artifact_collection():
"""Example of artifact collection"""
print("\n=== Artifact Collection Example ===")
manager = create_environment_manager()
# Create environment
env_info = manager.create_environment(
name="artifact-test-env",
arch="amd64",
suite="trixie",
packages=["build-essential"]
)
try:
print(f"Created environment: {env_info.name}")
# Example artifact collection (would work with real build artifacts)
print("Artifact collection example:")
print("Would collect artifacts like:")
print(" - *.deb files")
print(" - *.changes files")
print(" - *.buildinfo files")
print(" - *.dsc files")
print(" - Source tarballs")
# Example artifact collection call (commented out as it needs real artifacts)
# artifacts = manager.collect_artifacts(env_info.name)
# print(f"Collected {len(artifacts)} artifacts")
finally:
# Cleanup
manager.remove_environment(env_info.name)
def example_performance_monitoring():
"""Example of performance monitoring"""
print("\n=== Performance Monitoring Example ===")
client = create_client()
# Get cache statistics
cache_stats = client.get_cache_stats()
print(f"Cache statistics: {cache_stats}")
# Get performance summary (if available)
try:
perf_summary = client.get_performance_summary()
print(f"Performance summary: {perf_summary}")
except RuntimeError as e:
print(f"Performance monitoring not available: {e}")
# Export metrics (if available)
try:
metrics_file = client.export_metrics()
print(f"Metrics exported to: {metrics_file}")
except RuntimeError as e:
print(f"Metrics export not available: {e}")
def example_error_handling():
"""Example of error handling"""
print("\n=== Error Handling Example ===")
manager = create_environment_manager()
# Try to get non-existent environment
try:
manager.get_environment_info("nonexistent-env")
except ValueError as e:
print(f"Expected error: {e}")
# Try to execute command in non-existent environment
try:
manager.execute_command("nonexistent-env", ["ls"])
except ValueError as e:
print(f"Expected error: {e}")
# Try to remove non-existent environment
try:
manager.remove_environment("nonexistent-env")
except ValueError as e:
print(f"Expected error: {e}")
def example_configuration_variations():
"""Example of different configuration options"""
print("\n=== Configuration Variations Example ===")
# Ubuntu configuration
ubuntu_config = (MockConfigBuilder()
.environment("ubuntu-jammy-amd64")
.architecture("amd64")
.suite("jammy")
.mirror("http://archive.ubuntu.com/ubuntu/")
.packages(["build-essential", "cmake"])
.build())
print("Ubuntu configuration:")
print(f" Environment: {ubuntu_config.chroot_name}")
print(f" Suite: {ubuntu_config.suite}")
print(f" Mirror: {ubuntu_config.mirror}")
# ARM64 configuration
arm64_config = (MockConfigBuilder()
.environment("debian-trixie-arm64")
.architecture("arm64")
.suite("trixie")
.mirror("http://deb.debian.org/debian/")
.packages(["crossbuild-essential-arm64"])
.build())
print("\nARM64 configuration:")
print(f" Environment: {arm64_config.chroot_name}")
print(f" Architecture: {arm64_config.architecture}")
print(f" Cross-compilation packages: {arm64_config.chroot_additional_packages}")
# Development configuration
dev_config = (MockConfigBuilder()
.environment("dev-env")
.architecture("amd64")
.suite("sid") # Debian unstable
.packages(["build-essential", "devscripts", "cmake", "ninja-build", "git"])
.cache_enabled(True)
.parallel_jobs(8)
.verbose(True)
.debug(True)
.build())
print("\nDevelopment configuration:")
print(f" Environment: {dev_config.chroot_name}")
print(f" Suite: {dev_config.suite}")
print(f" Packages: {dev_config.chroot_additional_packages}")
print(f" Parallel jobs: {dev_config.parallel_jobs}")
print(f" Verbose: {dev_config.verbose}")
print(f" Debug: {dev_config.debug}")
def main():
"""Run all examples"""
print("deb-mock API Usage Examples")
print("=" * 50)
try:
example_basic_usage()
example_environment_management()
example_command_execution()
example_package_building()
example_context_manager()
example_parallel_building()
example_chain_building()
example_artifact_collection()
example_performance_monitoring()
example_error_handling()
example_configuration_variations()
print("\n" + "=" * 50)
print("All examples completed successfully!")
print("\nNote: These examples demonstrate the API structure.")
print("In practice, you would use real source packages and environments.")
except Exception as e:
print(f"\nError running examples: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
main()

View file

@ -0,0 +1,101 @@
#!/usr/bin/env python3
"""
Sample ccache plugin for deb-mock
Demonstrates the plugin system capabilities
"""
requires_api_version = "1.0"
run_in_bootstrap = False
def init(plugin_manager, conf, deb_mock):
"""Plugin entry point"""
CCachePlugin(plugin_manager, conf, deb_mock)
class CCachePlugin:
"""Enables ccache in deb-mock chroots"""
def __init__(self, plugin_manager, conf, deb_mock):
self.plugin_manager = plugin_manager
self.conf = conf
self.deb_mock = deb_mock
# Plugin configuration with defaults
self.ccache_dir = conf.get('dir', '/var/cache/deb-mock/ccache')
self.max_cache_size = conf.get('max_cache_size', '2G')
self.show_stats = conf.get('show_stats', True)
self.compress = conf.get('compress', True)
self.hashdir = conf.get('hashdir', True)
self.debug = conf.get('debug', False)
# Register hooks
self._register_hooks()
# Add ccache to build dependencies
if hasattr(deb_mock.config, 'chroot_additional_packages'):
if 'ccache' not in deb_mock.config.chroot_additional_packages:
deb_mock.config.chroot_additional_packages.append('ccache')
print(f"CCache plugin initialized: cache_dir={self.ccache_dir}, max_size={self.max_cache_size}")
def _register_hooks(self):
"""Register plugin hooks"""
self.plugin_manager.add_hook("prebuild", self._ccache_prebuild)
self.plugin_manager.add_hook("postbuild", self._ccache_postbuild)
self.plugin_manager.add_hook("prechroot_init", self._ccache_prechroot_init)
def _ccache_prebuild(self, source_package, **kwargs):
"""Setup ccache before build starts"""
print(f"CCache: Setting up ccache for {source_package}")
# Set ccache environment variables
if hasattr(self.deb_mock.config, 'build_env'):
self.deb_mock.config.build_env.update({
'CCACHE_DIR': '/var/tmp/ccache',
'CCACHE_UMASK': '002',
'CCACHE_COMPRESS': str(self.compress),
'CCACHE_HASHDIR': '1' if self.hashdir else '0',
'CCACHE_DEBUG': '1' if self.debug else '0'
})
def _ccache_postbuild(self, build_result, source_package, **kwargs):
"""Show ccache statistics after build"""
if not self.show_stats:
return
print("CCache: Build completed, showing statistics...")
# In a real implementation, you would execute ccache --show-stats in the chroot
if build_result.get('success', False):
print(f"CCache: Build successful for {source_package}")
else:
print(f"CCache: Build failed for {source_package}")
def _ccache_prechroot_init(self, chroot_name):
"""Setup ccache in chroot before initialization"""
print(f"CCache: Setting up ccache in chroot {chroot_name}")
# Create ccache directory in chroot
chroot_ccache_dir = f"/var/tmp/ccache"
# In a real implementation, you would:
# 1. Create the ccache directory in the chroot
# 2. Set proper permissions
# 3. Mount the host ccache directory if configured
print(f"CCache: Created {chroot_ccache_dir} in chroot {chroot_name}")
# Example configuration for this plugin:
# plugin_conf = {
# 'ccache_enable': True,
# 'ccache_opts': {
# 'dir': '/var/cache/deb-mock/ccache',
# 'max_cache_size': '4G',
# 'show_stats': True,
# 'compress': True,
# 'hashdir': True,
# 'debug': False
# }
# }

View file

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJDBAABCgAtFiEEa5j2N9h5xSNuJ3xcZP+QqujHCvkFAmIaVSYPHGRhcm5pckBn
bnUub3JnAAoJEGT/kKroxwr5Lp8P/AmKXnsZsdY8bMHh4iezqVaTsY3cv4WIGx3Q
3Wm2emABaig1aU6TVOut4W20LGitUK5LmNkkxjQ+lxvL7sv3giflTVPz/lRW4NBs
RibyNS5OFf4IbrYbGuXdqur+JpXe8is5o2w8JnoPxNvsPaCeDvB3YQhV26ADwpYI
f5c9goKK082F0G53DwnKWt/mYKa5Ln8KYqmgGxaBfo/RsgM237S/waztdxnRchaR
K87yeJjH6umKLoSIkaaNRacnWFDiV1o8NrPSx58XHccb4aUP6ZiXx/pYuHiflE3N
/veTH6shbXLQ1rq2XHBTlZHJM4T4YMHKXm8Uf3agA/Z5BGzNr58EIcjvYNQ7j5wK
ibCa7Lxj+CWekowvbRyO1vx7UoO2oy1QfJWlD1tnYCTzwXOyNtRp3Ae3APBFBXz/
auSIrB5hcD4WQ4eKQwSOjSVjQg/MJufGQNC8eaLoX0hKr1F3tPjC22pCC0sebHV8
V5z2BAil+MZIaFuoOPzB0cuxRkmMgFD6cXuBb4aNWAsx4P5UkKW9lH81E+BDh526
8gLM5k0N8Nkk87DqyG9aIToIVRNkNN6e3sqv3h1kMoEF9J9TfSUbdMbECZJ960NA
farBUra2dpV/p94BCxNpfQWwHCqZvOG06R2oQ3afc5lsrsMFSuVr51WrkNiAQQZm
VxBKMZ9U
=jgP8
-----END PGP SIGNATURE-----

2
debian/deb-mock-filesystem.substvars vendored Normal file
View file

@ -0,0 +1,2 @@
misc:Depends=
misc:Pre-Depends=

View file

@ -0,0 +1 @@
/etc/deb-mock/chroot.d/chroot.d/README.md

View file

@ -0,0 +1,18 @@
Package: deb-mock-filesystem
Source: mock
Version: 0.1.0-1
Architecture: all
Maintainer: Deb-Mock Team <deb-mock@raines.xyz>
Installed-Size: 26
Depends: shadow-utils
Section: devel
Priority: optional
Homepage: https://git.raines.xyz/robojerk/deb-mock
Description: Filesystem layout and chroot structure for deb-mock
This package provides the filesystem layout and chroot structure templates
for deb-mock. It includes directory structures, mount point definitions,
and filesystem configuration files needed for creating isolated build
environments.
.
This package is required by deb-mock and provides the minimal filesystem
structure needed for chroot operations.

View file

@ -0,0 +1,5 @@
ea64a10b454189d9f685f8ea986e58a0 usr/share/deb-mock/filesystem/filesystem/chroot-template.yaml
af6e6888b11e1ddbd384e987f67ad392 usr/share/deb-mock/mounts/mounts/README.md
6c2a6fdd785ed11027f91b32d5b77ca0 usr/share/deb-mock/templates/templates/README.md
d1ae06c2c12f7e3680f330d78fc2780d usr/share/doc/deb-mock-filesystem/changelog.Debian.gz
6e33bbc8d1428859f9f8b39c0e5d6010 usr/share/doc/deb-mock-filesystem/copyright

View file

@ -0,0 +1 @@
# Chroot configurations

View file

@ -0,0 +1,44 @@
# Chroot filesystem template for deb-mock
# This file defines the basic filesystem structure for chroot environments
filesystem:
directories:
- /bin
- /sbin
- /usr/bin
- /usr/sbin
- /usr/lib
- /usr/lib64
- /usr/include
- /usr/share
- /var
- /tmp
- /proc
- /sys
- /dev
- /etc
- /root
- /home
- /opt
- /srv
- /media
- /mnt
mount_points:
- source: /proc
target: /proc
type: proc
options: "nosuid,noexec,nodev"
- source: /sys
target: /sys
type: sysfs
options: "nosuid,noexec,nodev,ro"
- source: /dev
target: /dev
type: devtmpfs
options: "nosuid,strictatime,size=65536k,mode=755"
permissions:
/root: "755"
/tmp: "1777"
/var/tmp: "1777"

View file

@ -0,0 +1 @@
# Mount points

View file

@ -0,0 +1 @@
# Templates directory

View file

@ -0,0 +1,45 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: mock
Source: https://git.raines.xyz/robojerk/deb-mock
Files: *
Copyright: 2025 Mock Team <mock@raines.xyz>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Files: debian/*
Copyright: 2025 Mock Team <mock@raines.xyz>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

2
debian/deb-mock-plugins.substvars vendored Normal file
View file

@ -0,0 +1,2 @@
misc:Depends=
misc:Pre-Depends=

20
debian/deb-mock-plugins/DEBIAN/control vendored Normal file
View file

@ -0,0 +1,20 @@
Package: deb-mock-plugins
Source: mock
Version: 0.1.0-1
Architecture: all
Maintainer: Deb-Mock Team <deb-mock@raines.xyz>
Installed-Size: 119
Depends: deb-mock, python3-click
Section: devel
Priority: optional
Homepage: https://git.raines.xyz/robojerk/deb-mock
Description: Extended functionality through plugins for deb-mock
This package provides built-in plugins and extended functionality for
deb-mock. It includes caching plugins, performance optimization tools,
and various utility plugins that enhance the build process.
.
Plugins include:
* Caching and optimization plugins
* Build enhancement tools
* Debugging and monitoring plugins
* Custom build hooks

13
debian/deb-mock-plugins/DEBIAN/md5sums vendored Normal file
View file

@ -0,0 +1,13 @@
935e0fdb8c0984c307054aa9f9678e51 usr/lib/python3/dist-packages/deb_mock/plugins/plugins/__init__.py
7cd95eabffba99eef3c7519671a47d48 usr/lib/python3/dist-packages/deb_mock/plugins/plugins/base.py
00c95714409f0a5f2642d35e3e663833 usr/lib/python3/dist-packages/deb_mock/plugins/plugins/bind_mount.py
8fb789cbe00c162f59cf8f77d9fe764f usr/lib/python3/dist-packages/deb_mock/plugins/plugins/compress_logs.py
db2e92254fe7a264ca1847be35027117 usr/lib/python3/dist-packages/deb_mock/plugins/plugins/example_plugin.py
90a494ef3a475ebbe374eeb2ebdfb50e usr/lib/python3/dist-packages/deb_mock/plugins/plugins/hook_manager.py
f6209005cd825fb375e1d6e33eba33bc usr/lib/python3/dist-packages/deb_mock/plugins/plugins/registry.py
1927571e9253a047e2ad0d6e54eca243 usr/lib/python3/dist-packages/deb_mock/plugins/plugins/root_cache.py
67940e00d949efea9617187a117e3734 usr/lib/python3/dist-packages/deb_mock/plugins/plugins/tmpfs.py
886d15acc0ce977da6d8b75363013607 usr/share/deb-mock/plugins/plugins/cache_plugin.py
d1ae06c2c12f7e3680f330d78fc2780d usr/share/doc/deb-mock-plugins/changelog.Debian.gz
6e33bbc8d1428859f9f8b39c0e5d6010 usr/share/doc/deb-mock-plugins/copyright
3eaa7898c1431b167ee44c21524506ec usr/share/doc/deb-mock-plugins/plugins/README.md

View file

@ -0,0 +1,57 @@
#!/usr/bin/env python3
"""
Cache plugin for deb-mock
Provides caching functionality for build artifacts and dependencies
"""
from deb_mock.plugins.base import BasePlugin
from deb_mock.plugins.registry import PluginInfo
import os
import hashlib
import shutil
from pathlib import Path
class CachePlugin(BasePlugin):
"""Plugin for caching build artifacts and dependencies"""
def __init__(self, plugin_manager, config, deb_mock):
super().__init__(plugin_manager, config, deb_mock)
self.cache_dir = Path("/var/cache/deb-mock")
self.artifact_cache = self.cache_dir / "artifacts"
self.dependency_cache = self.cache_dir / "dependencies"
def pre_build_hook(self, environment, package_info):
"""Check cache before building"""
cache_key = self._generate_cache_key(package_info)
cached_artifact = self.artifact_cache / f"{cache_key}.deb"
if cached_artifact.exists():
self.logger.info(f"Found cached artifact: {cached_artifact}")
return {"cached": True, "artifact": cached_artifact}
return {"cached": False}
def post_build_hook(self, environment, package_info, build_result):
"""Cache build artifacts after successful build"""
if build_result.get("success"):
cache_key = self._generate_cache_key(package_info)
artifact_path = build_result.get("artifact_path")
if artifact_path and os.path.exists(artifact_path):
cached_artifact = self.artifact_cache / f"{cache_key}.deb"
shutil.copy2(artifact_path, cached_artifact)
self.logger.info(f"Cached artifact: {cached_artifact}")
def _generate_cache_key(self, package_info):
"""Generate a cache key based on package information"""
key_data = f"{package_info.get('name', '')}-{package_info.get('version', '')}-{package_info.get('architecture', '')}"
return hashlib.md5(key_data.encode()).hexdigest()
# Plugin registration
PLUGIN_INFO = PluginInfo(
name="cache",
version="1.0.0",
description="Caching plugin for build artifacts and dependencies",
author="Deb-Mock Team",
plugin_class=CachePlugin
)

View file

@ -0,0 +1,45 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: mock
Source: https://git.raines.xyz/robojerk/deb-mock
Files: *
Copyright: 2025 Mock Team <mock@raines.xyz>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Files: debian/*
Copyright: 2025 Mock Team <mock@raines.xyz>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1 @@
# Plugin documentation

10
debian/deb-mock.postinst.debhelper vendored Normal file
View file

@ -0,0 +1,10 @@
# Automatically added by dh_python3
if command -v py3compile >/dev/null 2>&1; then
py3compile -p deb-mock
fi
if command -v pypy3compile >/dev/null 2>&1; then
pypy3compile -p deb-mock || true
fi
# End automatically added section

10
debian/deb-mock.prerm.debhelper vendored Normal file
View file

@ -0,0 +1,10 @@
# Automatically added by dh_python3
if command -v py3clean >/dev/null 2>&1; then
py3clean -p deb-mock
else
dpkg -L deb-mock | sed -En -e '/^(.*)\/(.+)\.py$/s,,rm "\1/__pycache__/\2".*,e'
find /usr/lib/python3/dist-packages/ -type d -name __pycache__ -empty -print0 | xargs --null --no-run-if-empty rmdir
fi
# End automatically added section

3
debian/deb-mock.substvars vendored Normal file
View file

@ -0,0 +1,3 @@
python3:Depends=python3:any
misc:Depends=
misc:Pre-Depends=

1
debian/deb-mock/DEBIAN/conffiles vendored Normal file
View file

@ -0,0 +1 @@
/etc/deb-mock/config.yaml

28
debian/deb-mock/DEBIAN/control vendored Normal file
View file

@ -0,0 +1,28 @@
Package: deb-mock
Source: mock
Version: 0.1.0-1
Architecture: all
Maintainer: Deb-Mock Team <deb-mock@raines.xyz>
Installed-Size: 444
Depends: python3:any, python3-click (>= 8.0.0), python3-yaml (>= 6.0), python3-jinja2 (>= 3.0.0), python3-requests (>= 2.25.0), python3-psutil (>= 5.8.0), sbuild, schroot, debootstrap, systemd-container, deb-mock-filesystem, deb-mock-configs
Recommends: deb-mock-plugins, ccache, python3-pytest, python3-pytest-cov
Section: devel
Priority: optional
Homepage: https://git.raines.xyz/robojerk/deb-mock
Description: Debian package build environment manager
Deb-Mock is 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.
.
Features include:
* Isolated chroot environments for package building
* Multi-package chain building support
* Build metadata capture and storage
* Reproducible build enforcement
* Core configurations for popular distributions
* Plugin system for extensibility
* Package management within chroots
* Advanced build options and debugging tools
.
This tool is designed for developers, packagers, and CI/CD systems that need
reliable, isolated environments for building Debian packages.

33
debian/deb-mock/DEBIAN/md5sums vendored Normal file
View file

@ -0,0 +1,33 @@
1be4cd929735fed97d2480393b64bebf usr/bin/mock
69eaf685cade56df0fb31bb97610dda4 usr/lib/python3/dist-packages/deb_mock/__init__.py
9c037352dcde0f707732ca8cf2151255 usr/lib/python3/dist-packages/deb_mock/api.py
c78f86fd5308a4d81f6036fc0afd00d7 usr/lib/python3/dist-packages/deb_mock/benchmarking.py
351dc51574a5284324382736e7fa0d37 usr/lib/python3/dist-packages/deb_mock/cache.py
a57e2a4384d8256c29948cd72962ced2 usr/lib/python3/dist-packages/deb_mock/chroot.py
7adb1889863eef143356544d25470a67 usr/lib/python3/dist-packages/deb_mock/cli.py
074c4e2a384c32764681443847c243b8 usr/lib/python3/dist-packages/deb_mock/config.py
7f73e949ec4e65dbae7fb6db6f2525c8 usr/lib/python3/dist-packages/deb_mock/configs/__init__.py
6fbcd9334f6d0b934875f739c0f2252d usr/lib/python3/dist-packages/deb_mock/configs/debian-bookworm-amd64.yaml
a28570c0bbf8603381aa394af6e7acf0 usr/lib/python3/dist-packages/deb_mock/configs/debian-sid-amd64.yaml
b39f830ef9ecff0107d0dc4449cb0675 usr/lib/python3/dist-packages/deb_mock/configs/debian-trixie-amd64.yaml
24d888bad86e9f74d3406b8ae2a1182c usr/lib/python3/dist-packages/deb_mock/configs/ubuntu-jammy-amd64.yaml
0ccf439247ced5fc7509a401ae8d2898 usr/lib/python3/dist-packages/deb_mock/configs/ubuntu-noble-amd64.yaml
18df474129eaa591fe13c55722fb583d usr/lib/python3/dist-packages/deb_mock/core.py
8827c56a005baa9c80caf9701bc80ca6 usr/lib/python3/dist-packages/deb_mock/environment_manager.py
b8e195d86f3e85d28901486a361a6b3c usr/lib/python3/dist-packages/deb_mock/exceptions.py
9aed2d8734757cf076f785e3c5c61e90 usr/lib/python3/dist-packages/deb_mock/metadata.py
b8b0be1770fce5cf707dc743b9ed8bed usr/lib/python3/dist-packages/deb_mock/performance.py
762306194ff291ddffb360b3231a54c9 usr/lib/python3/dist-packages/deb_mock/plugin.py
935e0fdb8c0984c307054aa9f9678e51 usr/lib/python3/dist-packages/deb_mock/plugins/__init__.py
7cd95eabffba99eef3c7519671a47d48 usr/lib/python3/dist-packages/deb_mock/plugins/base.py
00c95714409f0a5f2642d35e3e663833 usr/lib/python3/dist-packages/deb_mock/plugins/bind_mount.py
8fb789cbe00c162f59cf8f77d9fe764f usr/lib/python3/dist-packages/deb_mock/plugins/compress_logs.py
db2e92254fe7a264ca1847be35027117 usr/lib/python3/dist-packages/deb_mock/plugins/example_plugin.py
90a494ef3a475ebbe374eeb2ebdfb50e usr/lib/python3/dist-packages/deb_mock/plugins/hook_manager.py
f6209005cd825fb375e1d6e33eba33bc usr/lib/python3/dist-packages/deb_mock/plugins/registry.py
1927571e9253a047e2ad0d6e54eca243 usr/lib/python3/dist-packages/deb_mock/plugins/root_cache.py
67940e00d949efea9617187a117e3734 usr/lib/python3/dist-packages/deb_mock/plugins/tmpfs.py
8ab121204ada12a9de6ac47c856efa84 usr/lib/python3/dist-packages/deb_mock/sbuild.py
180f9991c5e35dbd9b245f7061de88be usr/lib/python3/dist-packages/deb_mock/uid_manager.py
d1ae06c2c12f7e3680f330d78fc2780d usr/share/doc/deb-mock/changelog.Debian.gz
6e33bbc8d1428859f9f8b39c0e5d6010 usr/share/doc/deb-mock/copyright

27
debian/deb-mock/DEBIAN/postinst vendored Executable file
View file

@ -0,0 +1,27 @@
#!/bin/sh
set -e
# Create necessary directories
mkdir -p /var/lib/mock/chroots
mkdir -p /var/cache/mock
mkdir -p /etc/schroot/chroot.d
# Set proper permissions
chown root:root /var/lib/mock/chroots
chmod 755 /var/lib/mock/chroots
chown root:root /var/cache/mock
chmod 755 /var/cache/mock
# Create mock group if it doesn't exist
if ! getent group mock >/dev/null 2>&1; then
addgroup --system mock
fi
# Add users to mock group if they exist
if getent passwd build >/dev/null 2>&1; then
usermod -a -G mock build || true
fi
echo "mock package installed successfully."
echo "Users in the 'mock' group can use mock without sudo."
echo "To add a user to the mock group: sudo usermod -a -G mock <username>"

14
debian/deb-mock/DEBIAN/prerm vendored Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
set -e
# Remove users from mock group
if getent passwd build >/dev/null 2>&1; then
gpasswd -d build mock || true
fi
# Remove mock group if it's empty
if getent group mock >/dev/null 2>&1; then
if [ $(getent group mock | cut -d: -f4 | tr ',' '\n' | wc -l) -eq 0 ]; then
delgroup mock || true
fi
fi

117
debian/deb-mock/etc/deb-mock/config.yaml vendored Normal file
View file

@ -0,0 +1,117 @@
# deb-mock configuration file
# Debian's equivalent to Fedora's Mock build environment manager
# Global configuration
global:
basedir: "/var/lib/deb-mock"
rootdir: "/var/lib/deb-mock/chroots"
resultdir: "/var/lib/deb-mock/results"
cache_dir: "/var/cache/deb-mock"
log_dir: "/var/log/deb-mock"
# Default chroot configuration
defaults:
distribution: "bookworm"
architecture: "amd64"
mirror: "http://deb.debian.org/debian"
security_mirror: "http://deb.debian.org/debian-security"
updates_mirror: "http://deb.debian.org/debian"
# Package installation
install_packages:
- "build-essential"
- "fakeroot"
- "devscripts"
- "debhelper"
- "dh-make"
- "sbuild"
- "schroot"
# Build dependencies
build_dependencies:
- "build-essential"
- "fakeroot"
- "devscripts"
- "debhelper"
- "dh-make"
# Chroot profiles
profiles:
bookworm-amd64:
distribution: "bookworm"
architecture: "amd64"
mirror: "http://deb.debian.org/debian"
security_mirror: "http://deb.debian.org/debian-security"
updates_mirror: "http://deb.debian.org/debian"
components: ["main", "contrib", "non-free"]
bookworm-arm64:
distribution: "bookworm"
architecture: "arm64"
mirror: "http://deb.debian.org/debian"
security_mirror: "http://deb.debian.org/debian-security"
updates_mirror: "http://deb.debian.org/debian"
components: ["main", "contrib", "non-free"]
sid-amd64:
distribution: "sid"
architecture: "amd64"
mirror: "http://deb.debian.org/debian"
components: ["main", "contrib", "non-free"]
# Plugin configuration
plugins:
mount:
enabled: true
mount_points:
- source: "/proc"
target: "/proc"
type: "proc"
- source: "/sys"
target: "/sys"
type: "sysfs"
- source: "/dev"
target: "/dev"
type: "bind"
cache:
enabled: true
root_cache: true
package_cache: true
build_cache: true
security:
enabled: true
user_isolation: true
network_isolation: true
resource_limits: true
# Integration settings
integration:
deb_orchestrator_url: "http://localhost:8080"
deb_compose_url: "http://localhost:8080"
# Build tools
sbuild_path: "/usr/bin/sbuild"
schroot_path: "/usr/bin/schroot"
debootstrap_path: "/usr/sbin/debootstrap"
# Package managers
apt_path: "/usr/bin/apt"
dpkg_path: "/usr/bin/dpkg"
# Logging configuration
logging:
level: "INFO"
format: "text"
file: "/var/log/deb-mock/deb-mock.log"
max_size: "100MB"
max_files: 5
# Performance settings
performance:
parallel_downloads: 4
max_retries: 3
timeout: 3600
memory_limit: "2G"
disk_limit: "10G"

27
debian/deb-mock/usr/bin/mock vendored Executable file
View file

@ -0,0 +1,27 @@
#! /usr/bin/python3
"""
mock - Debian package build environment manager
Main executable entry point
"""
import sys
import os
# Add the deb_mock module to the Python path
sys.path.insert(0, '/usr/lib/python3/dist-packages')
sys.path.insert(0, '/home/joe/.local/lib/python3.13/site-packages')
# Also add current directory for development
current_dir = os.path.dirname(os.path.abspath(__file__))
project_root = os.path.dirname(current_dir)
sys.path.insert(0, project_root)
try:
from deb_mock.cli import main
if __name__ == '__main__':
main()
except ImportError as e:
print(f"Error importing deb_mock: {e}")
print("Please ensure mock is properly installed")
print("You can also run: python3 -m deb_mock.cli")
sys.exit(1)

View file

@ -0,0 +1,45 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: mock
Source: https://git.raines.xyz/robojerk/deb-mock
Files: *
Copyright: 2025 Mock Team <mock@raines.xyz>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Files: debian/*
Copyright: 2025 Mock Team <mock@raines.xyz>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

6
debian/debhelper-build-stamp vendored Normal file
View file

@ -0,0 +1,6 @@
mock
mock-filesystem
mock-configs
mock-plugins
mock-dev
mock-cache

7
debian/files vendored Normal file
View file

@ -0,0 +1,7 @@
mock-cache_0.1.0-1_all.deb devel optional
mock-configs_0.1.0-1_all.deb devel optional
mock-dev_0.1.0-1_all.deb devel optional
mock-filesystem_0.1.0-1_all.deb devel optional
mock-plugins_0.1.0-1_all.deb devel optional
mock_0.1.0-1_all.deb devel optional
mock_0.1.0-1_amd64.buildinfo devel optional

2
debian/mock-cache.substvars vendored Normal file
View file

@ -0,0 +1,2 @@
misc:Depends=
misc:Pre-Depends=

1
debian/mock-cache/DEBIAN/conffiles vendored Normal file
View file

@ -0,0 +1 @@
/etc/deb-mock/cache.d/cache.d/README.md

21
debian/mock-cache/DEBIAN/control vendored Normal file
View file

@ -0,0 +1,21 @@
Package: mock-cache
Source: mock
Version: 0.1.0-1
Architecture: all
Maintainer: Deb-Mock Team <deb-mock@raines.xyz>
Installed-Size: 25
Depends: mock, ccache
Recommends: mock-plugins
Section: devel
Priority: optional
Homepage: https://git.raines.xyz/robojerk/deb-mock
Description: Advanced caching and optimization for deb-mock
This package provides advanced caching capabilities and performance
optimization tools for deb-mock. It includes ccache integration,
build artifact caching, and various performance optimization plugins.
.
Features include:
* Compiler cache integration
* Build artifact caching
* Performance monitoring
* Optimization utilities

5
debian/mock-cache/DEBIAN/md5sums vendored Normal file
View file

@ -0,0 +1,5 @@
85d4004c09017d1078cfb1ee034918a7 usr/bin/mock-cache-clean
b5e97ad2c2786c52db6a46fd0e6dcc99 usr/share/deb-mock/cache-plugins/cache-plugins/README.md
ae7f7a9aa354f9831386524f1a3f947b usr/share/doc/deb-mock-cache/cache/README.md
d1ae06c2c12f7e3680f330d78fc2780d usr/share/doc/mock-cache/changelog.Debian.gz
6e33bbc8d1428859f9f8b39c0e5d6010 usr/share/doc/mock-cache/copyright

View file

@ -0,0 +1 @@
# Cache configurations

32
debian/mock-cache/usr/bin/mock-cache-clean vendored Executable file
View file

@ -0,0 +1,32 @@
#!/bin/bash
# Cache cleaning utility for mock
CACHE_DIR="/var/cache/mock"
ARTIFACT_CACHE="$CACHE_DIR/artifacts"
DEPENDENCY_CACHE="$CACHE_DIR/dependencies"
case "$1" in
"clean")
echo "Cleaning mock cache..."
rm -rf "$ARTIFACT_CACHE"/*
rm -rf "$DEPENDENCY_CACHE"/*
echo "Cache cleaned successfully"
;;
"status")
echo "Cache status:"
echo "Artifact cache: $(du -sh $ARTIFACT_CACHE 2>/dev/null || echo '0B')"
echo "Dependency cache: $(du -sh $DEPENDENCY_CACHE 2>/dev/null || echo '0B')"
;;
"purge")
echo "Purging all mock cache..."
rm -rf "$CACHE_DIR"/*
echo "Cache purged successfully"
;;
*)
echo "Usage: $0 {clean|status|purge}"
echo " clean - Clean build artifacts and dependencies"
echo " status - Show cache usage statistics"
echo " purge - Remove all cached data"
exit 1
;;
esac

View file

@ -0,0 +1 @@
# Cache plugins

View file

@ -0,0 +1 @@
# Cache documentation

View file

@ -0,0 +1,45 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: mock
Source: https://git.raines.xyz/robojerk/deb-mock
Files: *
Copyright: 2025 Mock Team <mock@raines.xyz>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Files: debian/*
Copyright: 2025 Mock Team <mock@raines.xyz>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

2
debian/mock-configs.substvars vendored Normal file
View file

@ -0,0 +1,2 @@
misc:Depends=
misc:Pre-Depends=

1
debian/mock-configs/DEBIAN/conffiles vendored Normal file
View file

@ -0,0 +1 @@
/etc/deb-mock/configs/default-configs/README.md

19
debian/mock-configs/DEBIAN/control vendored Normal file
View file

@ -0,0 +1,19 @@
Package: mock-configs
Source: mock
Version: 0.1.0-1
Architecture: all
Maintainer: Deb-Mock Team <deb-mock@raines.xyz>
Installed-Size: 27
Depends: mock
Section: devel
Priority: optional
Homepage: https://git.raines.xyz/robojerk/deb-mock
Description: Pre-built configurations for different distributions
This package provides pre-built configurations for various Debian and Ubuntu
distributions and architectures. It includes distribution-specific settings,
architecture-specific configurations, and default build configurations.
.
Configurations are provided for:
* Debian (bookworm, trixie, sid)
* Ubuntu (jammy, noble)
* Multiple architectures (amd64, arm64, etc.)

8
debian/mock-configs/DEBIAN/md5sums vendored Normal file
View file

@ -0,0 +1,8 @@
7f73e949ec4e65dbae7fb6db6f2525c8 usr/share/deb-mock/configs/configs/__init__.py
6fbcd9334f6d0b934875f739c0f2252d usr/share/deb-mock/configs/configs/debian-bookworm-amd64.yaml
a28570c0bbf8603381aa394af6e7acf0 usr/share/deb-mock/configs/configs/debian-sid-amd64.yaml
f07c51ef116c5cd4613176a9c01a561d usr/share/deb-mock/configs/configs/debian-trixie-amd64.yaml
24d888bad86e9f74d3406b8ae2a1182c usr/share/deb-mock/configs/configs/ubuntu-jammy-amd64.yaml
0ccf439247ced5fc7509a401ae8d2898 usr/share/deb-mock/configs/configs/ubuntu-noble-amd64.yaml
d1ae06c2c12f7e3680f330d78fc2780d usr/share/doc/mock-configs/changelog.Debian.gz
6e33bbc8d1428859f9f8b39c0e5d6010 usr/share/doc/mock-configs/copyright

View file

@ -0,0 +1 @@
# Default configurations

Some files were not shown because too many files have changed in this diff Show more