Skip to main content

Debian Repository Manager for multi-distribution package management

Project description

Debian Repository Manager (debrepomanager)

A system for managing multiple Debian-like repositories with support for multiple distributions, architectures, and package collections, featuring atomic updates and GitHub Actions integration.

Tests PyPI version Python Coverage

Features

  • 🚀 Atomic updates via aptly snapshots
  • 🔄 Multi-codename: bookworm, noble, trixie, jammy, etc.
  • 🏗️ Multi-architecture: amd64, arm64, riscv64
  • 📦 Multi-component: various package collections
  • 🔐 GPG signing for all repositories
  • 🧹 Retention policies: automatic cleanup of old versions
  • 🤖 GitHub Actions: CI/CD pipeline integration
  • 🔍 Verification: repository consistency checks
  • 🔀 Dual format: old and new APT URL formats support

Architecture

Built on top of aptly with:

  • Multi-root isolation (separate aptly root per codename)
  • Snapshots for atomic operations
  • Python CLI for easy management
  • GitHub Actions for automation

See ARCHITECTURE.md for detailed description.

Requirements

Server

  • aptly >= 1.5.0
  • gpg (GnuPG) >= 2.2
  • Python >= 3.11
  • rsync (for GitHub Actions)
  • SSH server (for GitHub Actions)

Development

  • Python >= 3.11 (tested on 3.11, 3.12, 3.13)
  • pip
  • virtualenv (recommended)
  • Docker (for integration tests)

Installation

From PyPI

pip install debrepomanager

From source

git clone https://github.com/jethome-iot/repomanager.git
cd repomanager
pip install -e .

For development

git clone https://github.com/jethome-iot/repomanager.git
cd repomanager

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -e ".[dev]"

# Run tests
pytest

Quick Start

# Create repository
debrepomanager create-repo --codename bookworm --component jethome-tools

# Add packages
debrepomanager add --codename bookworm --component jethome-tools --package-dir /path/to/packages/

# List repositories
debrepomanager list

# List packages in repository
debrepomanager list --codename bookworm --component jethome-tools

Configuration

Main configuration file: config.yaml

gpg:
  key_id: "1234567890ABCDEF"
  use_agent: true

aptly:
  root_base: "/srv/aptly"
  publish_base: "/srv/repo/public"

retention:
  default:
    min_versions: 5
    max_age_days: 90

repositories:
  codenames:
    - bookworm
    - noble
    - trixie
    - jammy
  components:
    - jethome-tools
    - jethome-armbian
  architectures:
    - amd64
    - arm64
    - riscv64
  auto_create: true
  dual_format:
    enabled: true
    method: symlink
    auto_symlink: true

See config.yaml.example for all available options.

Usage

Create repository

debrepomanager create-repo --codename bookworm --component jethome-tools

Add packages

# Add specific packages
debrepomanager add --codename bookworm --component jethome-tools \
    --packages package1.deb package2.deb

# Add all packages from directory
debrepomanager add --codename bookworm --component jethome-tools \
    --package-dir /path/to/packages/

List repositories and packages

# List all repositories
debrepomanager list

# List repositories for specific codename
debrepomanager list --codename bookworm

# List packages in repository
debrepomanager list --codename bookworm --component jethome-tools

Delete repository

debrepomanager delete-repo --codename bookworm --component old-component --confirm

Client Configuration

Debian Bookworm

# Import GPG key
wget -qO - http://repo.site.com/pubkey.gpg | \
    sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/jethome.gpg

# Add repository (new format)
echo "deb http://repo.site.com/bookworm jethome-tools main" | \
    sudo tee /etc/apt/sources.list.d/jethome.list

# Update
sudo apt update

# Install packages
sudo apt install your-package

Ubuntu Noble

# Import GPG key
wget -qO - http://repo.site.com/pubkey.gpg | \
    sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/jethome.gpg

# Add repository
echo "deb http://repo.site.com/noble jethome-tools main" | \
    sudo tee /etc/apt/sources.list.d/jethome.list

# Update
sudo apt update

Dual Format Support

The system supports both old and new APT URL formats simultaneously:

Old format (backward compatibility):

deb http://repo.site.com bookworm jethome-tools

New format (recommended):

deb http://repo.site.com/bookworm jethome-tools main

Both formats work simultaneously via symlinks. See DUAL_FORMAT.md for technical details.

Repository URL Structure

Repositories are accessible via:

http://repo.site.com/{codename}/{component}

Examples:

http://repo.site.com/bookworm/jethome-tools
http://repo.site.com/noble/jethome-armbian
http://repo.site.com/trixie/jethome-bookworm

Development

Project Structure

debrepomanager/
├── debrepomanager/        # Main package
│   ├── __init__.py
│   ├── cli.py            # CLI interface
│   ├── aptly.py          # Aptly wrapper
│   ├── config.py         # Configuration management
│   ├── gpg.py            # GPG operations
│   └── utils.py          # Utilities
├── tests/                # Tests
├── docs/                 # Documentation
├── .github/workflows/    # GitHub Actions
└── config.yaml.example   # Configuration example

Running Tests

# All tests
pytest

# With coverage
pytest --cov=debrepomanager --cov-report=html

# Specific module
pytest tests/test_config.py

# Verbose
pytest -v

Code Quality

Project uses:

  • Black for formatting (spaces, not tabs)
  • flake8 for linting
  • mypy for type checking
# Format
black debrepomanager/

# Lint
flake8 debrepomanager/

# Type check
mypy debrepomanager/

Documentation

For Users

For Administrators

For Developers

Troubleshooting

GPG signing fails

# Check key availability
gpg --list-secret-keys

# Check gpg-agent
gpg-connect-agent 'keyinfo --list' /bye

# Restart gpg-agent
gpgconf --kill gpg-agent
gpg-connect-agent /bye

Aptly errors

# Check repository status
debrepomanager list

# Check snapshots (via aptly directly)
aptly -config /srv/aptly/bookworm/aptly.conf snapshot list

# Check published repositories
aptly -config /srv/aptly/bookworm/aptly.conf publish list

Permission issues

# Check permissions
ls -la /srv/aptly/
ls -la /srv/repo/public/

# Fix permissions
chown -R repomanager:repomanager /srv/aptly/
chown -R www-data:repomanager /srv/repo/public/
chmod -R g+w /srv/aptly/ /srv/repo/public/

GitHub Actions Integration

For CI/CD workflows, configure GitHub Secrets:

  • SSH_PRIVATE_KEY: SSH key for server access
  • SSH_HOST: Server address (e.g., repo.site.com)
  • SSH_USER: SSH user (e.g., repomanager)
  • GPG_PRIVATE_KEY: GPG private key (base64 encoded)
  • GPG_PASSPHRASE: GPG key password
  • GPG_KEY_ID: GPG key ID

See WORKFLOWS.md for detailed GitHub Actions documentation.

License

MIT License - see LICENSE

Authors

JetHome Team

Contributing

Pull requests are welcome! Please make sure to:

  1. Add tests for new functionality
  2. Update documentation
  3. Follow code style (black, flake8)
  4. Ensure all tests pass

Links

Project Status

  • Version: 0.1.2
  • Status: Production Ready (95% MVP)
  • Tests: 194 tests, 93% coverage
  • Python: 3.11, 3.12, 3.13 supported

Made with ❤️ by JetHome Team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

debrepomanager-0.1.3.tar.gz (181.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

debrepomanager-0.1.3-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file debrepomanager-0.1.3.tar.gz.

File metadata

  • Download URL: debrepomanager-0.1.3.tar.gz
  • Upload date:
  • Size: 181.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for debrepomanager-0.1.3.tar.gz
Algorithm Hash digest
SHA256 bb96fee17e385b5e562ef8cb80eefd0a4f8e4c778b82f8eeb4621cfe2696f119
MD5 7d085d7aa191d7db9e8a130aae6ccc7c
BLAKE2b-256 45eec6b2d191a1c8bff7dab108ada84cc6982a35bac0ed9de9abd61b9aeda7b9

See more details on using hashes here.

File details

Details for the file debrepomanager-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: debrepomanager-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for debrepomanager-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b7ef2b609dbf9d22e8a8fad6fb10f8d42694ab5e65e05da4f44f2054a28575b5
MD5 d0d867f0521928a2c42bf84572ef782d
BLAKE2b-256 18b72bf75acb24f46ab12a9b3173ff1e4880c5d65414e1ac3a9a3abda004ba60

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page