fix: add retry logic for AUR clone, use Europe/Berlin timezone in package index

This commit is contained in:
2026-06-28 18:37:01 +02:00
parent e9361dbd77
commit b5c39d2ac2
2 changed files with 20 additions and 5 deletions
+15 -1
View File
@@ -4,6 +4,7 @@ import os
import shutil
import glob
import sys
import time
LOCAL_REPO = "/tmp/pkgout"
@@ -59,7 +60,20 @@ for pkg in pkgs:
if os.path.exists(local_pkgbuild):
shutil.copytree(f"packages/{pkg}", build_dir)
else:
subprocess.run(["git", "clone", f"https://aur.archlinux.org/{pkg}.git", build_dir])
url = f"https://aur.archlinux.org/{pkg}.git"
for attempt in range(3):
r = subprocess.run(["git", "clone", url, build_dir], capture_output=True)
if r.returncode == 0:
break
print(f"AUR clone attempt {attempt+1}/3 failed for {pkg}, retrying...")
try:
shutil.rmtree(build_dir)
except FileNotFoundError:
pass
time.sleep(2)
else:
print(f"::error::FAILED to clone AUR package: {pkg}")
sys.exit(1)
subprocess.run(["chown", "-R", "builder:builder", build_dir])
+5 -4
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import json, os, re, subprocess
from datetime import datetime, timezone
from datetime import datetime
import zoneinfo
PKG_DIR = 'packages'
REPO_DIR = 'repo'
@@ -52,7 +53,7 @@ for f in sorted(os.listdir(REPO_DIR)):
fpath = os.path.join(REPO_DIR, f)
size = os.path.getsize(fpath)
mtime = os.path.getmtime(fpath)
mtime_dt = datetime.fromtimestamp(mtime, tz=timezone.utc)
mtime_dt = datetime.fromtimestamp(mtime, tz=zoneinfo.ZoneInfo('Europe/Berlin'))
# strip .pkg.tar.zst and arch to get base name
base = re.sub(r'-[^-]+-x86_64\.pkg\.tar\.zst$', '', f)
@@ -81,7 +82,7 @@ for f in sorted(os.listdir(REPO_DIR)):
'arch': arch,
'size': size,
'mtime': mtime_dt.isoformat(),
'mtime_display': mtime_dt.strftime('%Y-%m-%d %H:%M UTC'),
'mtime_display': mtime_dt.strftime('%Y-%m-%d %H:%M CET/CEST'),
'category': cat,
'cat_color': cat_colors.get(cat, '#7F8C8D'),
'description': meta.get('pkgdesc', ''),
@@ -94,7 +95,7 @@ pkgs.sort(key=lambda p: p['name'])
rows_json = json.dumps(pkgs)
total_size_mb = sum(p['size'] for p in pkgs) / 1024 / 1024
generated = datetime.now(tz=timezone.utc).strftime('%Y-%m-%d %H:%M UTC')
generated = datetime.now(tz=zoneinfo.ZoneInfo('Europe/Berlin')).strftime('%Y-%m-%d %H:%M CET/CEST')
html = f'''<!DOCTYPE html>
<html lang="en">