Skip to content

Multi-distro package support with extended naming convention #28

@mairas

Description

@mairas

Problem Statement

The apt.hatlabs.fi repository workflow has critical metadata issues during full rebuilds:

  1. Metadata loss: No information about target distro/channel/component during full rebuild
  2. Incorrect routing: Same packages copied to all 6 distributions
  3. Missing unstable packages: Pre-releases not properly detected

During dispatch-based updates (when component repos trigger updates), metadata is provided in the payload. During full rebuilds, this metadata doesn't exist, causing incorrect package placement.

Solution: Extended Naming Convention

Filename Format: {package}_{version}_{arch}+{distro}+{component}.deb

Examples:

  • halpi2-daemon_1.0.0-1_all+any+hatlabs.deb
  • signalk-server-container_2.17.2-1_all+trixie+main.deb
  • cockpit-apt_0.2.0-1_all+trixie+main.deb

Why channel is omitted: Channel (stable/unstable) is determined by GitHub release type, not at build time. The same binary can be in both a pre-release (unstable) and a release (stable).

Design Decisions

Three-Dimensional Routing: (distro, channel, component)

Distro dimension:

  • any - Deploy to ALL current and future distros (bookworm, trixie, forky)
  • trixie, bookworm, forky - Specific distro only

Channel dimension (from GitHub release type):

  • stable - Regular GitHub releases
  • unstable - Pre-releases

Component dimension:

  • main - General packages (marine apps, third-party software)
  • hatlabs - Hat Labs product packages (HALPI2 daemon, firmware)

Special Routing Rules

Legacy compatibility (stable/main and unstable/main):

These repos are ONLY for Hat Labs product packages. Routing to legacy repos happens ONLY when:

  • component = "hatlabs" AND
  • distro = "any"

Example: halpi2-daemon+any+hatlabs.deb (pre-release) routes to:

  • unstable/main (legacy)
  • bookworm-unstable/hatlabs
  • trixie-unstable/hatlabs
  • forky-unstable/hatlabs (when available)

Example: signalk+trixie+main.deb routes ONLY to:

  • trixie-stable/main (if release) OR
  • trixie-unstable/main (if pre-release)

Suffix Stripping

The suffix is stripped when packages are stored in the APT repository.

  1. Download: halpi2-daemon_1.0.0-1_all+any+hatlabs.deb
  2. Parse suffix for routing: distro=any, component=hatlabs
  3. Extract canonical metadata from .deb control file
  4. Rename to: halpi2-daemon_1.0.0-1_all.deb
  5. Store in appropriate pool directories

Rationale: The suffix is routing metadata. Once routed to the correct pool/dist location, it's no longer needed. APT repository maintains standard Debian naming.

Fallback Behavior

For packages without suffix (backward compatibility):

  • Route to bare stable/ or unstable/ repos
  • Future: Require suffix, reject packages without

Implementation Phases

  1. Core Infrastructure - Update apt.hatlabs.fi workflow
  2. Pilot - Test with cockpit-apt
  3. Rollout - Update all 7 component repos
  4. Cleanup - Remove non-hatlabs packages from stable/main

References

Implementation Requirements

MANDATORY: Follow docs/IMPLEMENTATION_CHECKLIST.md during implementation.

This includes:

  • Exploration phase WITHOUT coding
  • Planning with "think hard"
  • Test-Driven Development (write tests first)
  • Verification with subagents
  • References to SPEC.md and ARCHITECTURE.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions