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

+1 -1
View File
@@ -253,7 +253,7 @@ def scan_packages(directory: str, cache: dict[str, dict] | None = None) -> dict[
try:
found[name] = read_package_metadata(path, name)
except (OSError, ValueError) as exc:
print(f"archrepo: paquet ignoré {name} : {exc}", flush=True)
print(f"repo: paquet ignoré {name} : {exc}", flush=True)
return found
+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
+6 -6
View File
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex">
<title>archrepo — publication de paquets</title>
<title>repo — publication de paquets</title>
<style>
:root {
--bg: #0d1117;
@@ -110,7 +110,7 @@
<div class="brand">
<span class="logo">◧</span>
<div>
<h1 id="repo-name">archrepo</h1>
<h1 id="repo-name">repo</h1>
<p class="sub" id="repo-sub">dépôt pacman</p>
</div>
</div>
@@ -125,7 +125,7 @@
<button id="save-token" class="primary">Enregistrer</button>
<button id="forget-token" class="ghost">Oublier</button>
</div>
<p class="hint">Le jeton se trouve sur le serveur dans <code>/etc/archrepo/token</code>. Il n'est conservé que dans ce navigateur.</p>
<p class="hint">Le jeton se trouve sur le serveur dans <code>/etc/repo/token</code>. Il n'est conservé que dans ce navigateur.</p>
</section>
<section class="card">
@@ -165,11 +165,11 @@
</section>
</main>
<footer>archrepo — les paquets et bases sont servis par Caddy, les publications passent par cette interface.</footer>
<footer>repo — les paquets et bases sont servis par Caddy, les publications passent par cette interface.</footer>
<div id="toast" class="toast"></div>
<script>
const TOKEN_KEY = 'archrepo.token';
const TOKEN_KEY = 'repo.token';
const state = {
token: localStorage.getItem(TOKEN_KEY) || '',
health: null,
@@ -235,7 +235,7 @@ async function loadHealth() {
function renderPacmanConf() {
const arch = (state.health && state.health.arch) || 'x86_64';
const repo = (state.health && state.health.repo) || 'archrepo';
const repo = (state.health && state.health.repo) || 'repo';
const conf = `[${repo}]\nServer = ${window.location.origin}/${arch}\nSigLevel = Optional TrustAll`;
$('pacman-conf').textContent = conf;
}