refactor(server)!: rename archrepo to repo

The repository, its Python service, its systemd units, its token file and
its environment prefix still carried the old name, which matches nothing
public any more. Paths, units, user and variables now use repo: REPO_*,
/etc/repo/token, /var/lib/repo, repo.service and repo-prune.timer.

A server installed before this change keeps the old user, paths and token:
run server/install.sh again to recreate them.
This commit is contained in:
Gianmarco-Ruberti committed 2026-12-03 12:02:42 +01:00
1 parent b689351535
commit 30cb9c9fc2
8 files changed
+80 -77

No files matched your search

+14 -14
View File
@@ -1,10 +1,10 @@
#!/usr/bin/env python3
"""archrepo — petit serveur pour un dépôt pacman auto-hébergé.
"""repo — petit serveur pour un dépôt pacman auto-hébergé.
Gère l'interface d'administration (/admin/) et l'API JSON (/api/*) qui permet
d'envoyer des paquets, de les supprimer et de reconstruire <repo>.db / .files.
Les paquets et les bases eux-mêmes sont servis directement par Caddy depuis
$ARCHREPO_ROOT/$ARCHREPO_ARCH, ce processus ne traite que l'administration.
$REPO_ROOT/$REPO_ARCH, ce processus ne traite que l'administration.
Dépendances : Python >= 3.10 et les binaires zstd / xz (selon les formats reçus).
"""
@@ -68,15 +68,15 @@ def _split_bind(value: str) -> tuple[str, int]:
class Config:
def __init__(self) -> None:
env = os.environ.get
self.root = os.path.abspath(env("ARCHREPO_ROOT", "/var/www/fws"))
self.arch = env("ARCHREPO_ARCH", "x86_64")
self.name = env("ARCHREPO_NAME", "fws")
self.root = os.path.abspath(env("REPO_ROOT", "/var/www/fws"))
self.arch = env("REPO_ARCH", "x86_64")
self.name = env("REPO_NAME", "fws")
self.bind_host, self.bind_port = _split_bind(
env("ARCHREPO_BIND", "127.0.0.1:8099")
env("REPO_BIND", "127.0.0.1:8099")
)
self.token_file = env("ARCHREPO_TOKEN_FILE", "/etc/archrepo/token")
self.state_dir = os.path.abspath(env("ARCHREPO_STATE_DIR", "/var/lib/archrepo"))
self.max_upload = _int(env("ARCHREPO_MAX_UPLOAD"), 4 * 1024 ** 3)
self.token_file = env("REPO_TOKEN_FILE", "/etc/repo/token")
self.state_dir = os.path.abspath(env("REPO_STATE_DIR", "/var/lib/repo"))
self.max_upload = _int(env("REPO_MAX_UPLOAD"), 4 * 1024 ** 3)
self.static_dir = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "static"
)
@@ -125,7 +125,7 @@ class App:
if not os.path.exists(config.db_file):
try:
self.rebuild()
print("archrepo: base initiale créée", flush=True)
print("repo: base initiale créée", flush=True)
except Exception:
traceback.print_exc()
@@ -185,7 +185,7 @@ def _public(pkg: dict) -> dict:
# --------------------------------------------------------------------------
class Handler(BaseHTTPRequestHandler):
server_version = "archrepo/1.0"
server_version = "repo/1.0"
protocol_version = "HTTP/1.1"
@property
@@ -475,7 +475,7 @@ def main() -> int:
try:
app = App(config)
except RuntimeError as exc:
print(f"archrepo: {exc}", file=sys.stderr, flush=True)
print(f"repo: {exc}", file=sys.stderr, flush=True)
return 1
server = ThreadingHTTPServer((config.bind_host, config.bind_port), Handler)
@@ -489,7 +489,7 @@ def main() -> int:
signal.signal(signal.SIGINT, stop)
print(
f"archrepo: {config.packages_dir} — http://{config.bind_host}:"
f"repo: {config.packages_dir} — http://{config.bind_host}:"
f"{config.bind_port}/admin/ (dépôt {config.name}/{config.arch})",
flush=True,
)
@@ -497,7 +497,7 @@ def main() -> int:
server.serve_forever()
finally:
server.server_close()
print("archrepo: arrêt", flush=True)
print("repo: arrêt", flush=True)
return 0