Aller au contenu

Référence des distributions

Une distribution dans Repod correspond à une version cible d'un système d'exploitation. Lors de l'upload d'un paquet, vous l'affectez à une distribution. Les paquets ne sont visibles que par les clients (apt, dnf, zypper, apk) configurés pour cette distribution spécifique.

Les distributions disponibles dépendent de REPO_FORMAT (apt, rpm, apk, both, ou all) — voir Démarrage rapide — Étape 2 (anglais).


Distributions APT (.deb)

Actives quand REPO_FORMAT vaut apt, both, ou all.

Codename OS Architecture Component
jammy Ubuntu 22.04 LTS amd64 main
noble Ubuntu 24.04 LTS amd64 main
focal Ubuntu 20.04 LTS amd64 main
bookworm Debian 12 amd64 main

Structure du dépôt APT

Pour chaque distribution, reprepro gère l'arborescence suivante sous /repos/dists/, servie par depot-apt :

/repos/dists/
└── jammy/
    ├── InRelease          ← Index signé GPG (vérifié par les clients apt)
    ├── Release
    ├── Release.gpg
    └── main/
        ├── binary-amd64/
        │   ├── Packages
        │   ├── Packages.gz
        │   └── Packages.xz
        └── Contents-amd64.gz

Configuration du client APT

# Importer la clé de signature
curl -fsSL http://VOTRE_HOTE:80/repos/gpg.key \
  | gpg --dearmor \
  | sudo tee /etc/apt/trusted.gpg.d/repod.gpg > /dev/null

# Ajouter la source
echo "deb http://VOTRE_HOTE:80/repos jammy main" \
  | sudo tee /etc/apt/sources.list.d/repod.list

sudo apt update

Distributions RPM (.rpm)

Actives quand REPO_FORMAT vaut rpm, both, ou all.

Codename OS Architecture Gestionnaire de paquets Grype distro ID
almalinux8 AlmaLinux 8 x86_64 dnf almalinux:8
almalinux9 AlmaLinux 9 x86_64 dnf almalinux:9
rocky8 Rocky Linux 8 x86_64 dnf rockylinux:8
rocky9 Rocky Linux 9 x86_64 dnf rockylinux:9
centos-stream9 CentOS Stream 9 x86_64 dnf centos:9
oraclelinux8 Oracle Linux 8 x86_64 dnf oraclelinux:8
fedora Fedora 42 x86_64 dnf fedora:42
opensuse-leap-15.6 openSUSE Leap 15.6 x86_64 zypper opensuse/leap:15.6
opensuse-tumbleweed openSUSE Tumbleweed (rolling) x86_64 zypper opensuse/tumbleweed:latest

Grype distro ID

Le Grype distro ID est l'identifiant transmis à grype lors du scan d'un paquet pour cette distribution. Il détermine quels avis CVE sont considérés comme pertinents — un CVE corrigé sous AlmaLinux 9 peut rester ouvert sous AlmaLinux 8, d'où l'importance de ce distro ID pour un matching précis.

Structure du dépôt RPM

Pour chaque distribution, createrepo_c gère l'arborescence suivante sous /repos/rpm/, servie par depot-rpm :

/repos/rpm/
└── almalinux9/
    └── x86_64/
        ├── repodata/
        │   ├── repomd.xml            ← Index principal
        │   ├── repomd.xml.asc        ← Signature GPG détachée
        │   ├── primary.xml.gz        ← Métadonnées des paquets
        │   ├── filelists.xml.gz
        │   └── other.xml.gz
        └── *.rpm                     ← Binaires des paquets

Configuration du client DNF / YUM

/etc/yum.repos.d/repod.repo
[repod-almalinux9]
name=Repod Private Repository — AlmaLinux 9
baseurl=http://VOTRE_HOTE:8080/repos/almalinux9/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://VOTRE_HOTE:8080/repos/gpg.key
repo_gpgcheck=0
sudo rpm --import http://VOTRE_HOTE:8080/repos/gpg.key
sudo dnf makecache

Configuration du client Zypper (openSUSE)

sudo zypper addrepo \
  --gpgcheck \
  http://VOTRE_HOTE:8080/repos/opensuse-leap-15.6/x86_64/ \
  repod

sudo rpm --import http://VOTRE_HOTE:8080/repos/gpg.key
sudo zypper refresh repod

Distributions APK (Alpine .apk)

Actives quand REPO_FORMAT vaut apk ou all.

Codename OS Architecture
alpine3.18 Alpine Linux 3.18 x86_64
alpine3.19 Alpine Linux 3.19 x86_64
alpine3.20 Alpine Linux 3.20 x86_64
alpine3.21 Alpine Linux 3.21 x86_64

Structure du dépôt APK

apk index gère l'arborescence suivante sous /repos/apk/, servie par depot-apt sous /apk/ :

/repos/apk/
└── alpine3.20/
    └── main/
        └── x86_64/
            ├── APKINDEX.tar.gz    ← Index de paquets signé
            └── *.apk              ← Binaires des paquets

Configuration du client APK

# Importer la clé de signature
curl -fsSL http://VOTRE_HOTE:80/apk/repod.rsa.pub \
  -o /etc/apk/keys/repod.rsa.pub

# Ajouter le dépôt
echo "http://VOTRE_HOTE:80/apk/alpine3.20/main" \
  | sudo tee -a /etc/apk/repositories

sudo apk update

Ajouter une distribution

Les distributions sont initialisées automatiquement au premier démarrage (auto_init_distributions()), pour chaque format activé par REPO_FORMAT. Pour ré-initialiser manuellement (par ex. après restauration d'une sauvegarde sans les arborescences de distribution sur disque) :

curl -X POST http://localhost:8000/api/v1/distributions/init \
  -H "Authorization: Bearer $TOKEN"

Modifier la liste des codenames pris en charge

Les codenames ci-dessus sont codés en dur dans services/distributions_apt.py, services/distributions_rpm.py, et services/distributions_apk.py. Ajouter un codename non pris en charge nécessite d'éditer le fichier source concerné et de reconstruire l'image backend-api, puis d'appeler /api/v1/distributions/init. Ceci est intentionnel — cela évite une prolifération accidentelle de distributions en production.


Promotion de distribution

Repod permet de promouvoir un paquet d'une distribution à une autre sans le ré-uploader ni le re-scanner — la décision CVE et sa justification sont préservées. L'endpoint de promotion copie le binaire du paquet et relance reprepro includedeb (APT), createrepo_c --update (RPM), ou reconstruit APKINDEX.tar.gz (APK) dans la distribution cible.

curl -X POST http://localhost:8000/api/v1/distributions/promote \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"package":"mypackage","from_dist":"jammy","to_dist":"noble"}'

Rôle requis

La promotion nécessite le rôle maintainer ou admin.


Migration de distribution

Pour migrer tous les paquets d'une distribution vers une autre (utile lors d'une mise à niveau de votre socle OS) :

curl -X POST http://localhost:8000/api/v1/distributions/migrate \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"from_dist":"focal","to_dist":"jammy"}'

La migration ne supprime pas la source

La distribution source reste intacte après la migration. Supprimez les paquets manuellement si nécessaire.