fix: add retry logic for AUR clone, use Europe/Berlin timezone in package index
This commit is contained in:
+15
-1
@@ -4,6 +4,7 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
import glob
|
import glob
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
LOCAL_REPO = "/tmp/pkgout"
|
LOCAL_REPO = "/tmp/pkgout"
|
||||||
|
|
||||||
@@ -59,7 +60,20 @@ for pkg in pkgs:
|
|||||||
if os.path.exists(local_pkgbuild):
|
if os.path.exists(local_pkgbuild):
|
||||||
shutil.copytree(f"packages/{pkg}", build_dir)
|
shutil.copytree(f"packages/{pkg}", build_dir)
|
||||||
else:
|
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])
|
subprocess.run(["chown", "-R", "builder:builder", build_dir])
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import json, os, re, subprocess
|
import json, os, re, subprocess
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime
|
||||||
|
import zoneinfo
|
||||||
|
|
||||||
PKG_DIR = 'packages'
|
PKG_DIR = 'packages'
|
||||||
REPO_DIR = 'repo'
|
REPO_DIR = 'repo'
|
||||||
@@ -52,7 +53,7 @@ for f in sorted(os.listdir(REPO_DIR)):
|
|||||||
fpath = os.path.join(REPO_DIR, f)
|
fpath = os.path.join(REPO_DIR, f)
|
||||||
size = os.path.getsize(fpath)
|
size = os.path.getsize(fpath)
|
||||||
mtime = os.path.getmtime(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
|
# strip .pkg.tar.zst and arch to get base name
|
||||||
base = re.sub(r'-[^-]+-x86_64\.pkg\.tar\.zst$', '', f)
|
base = re.sub(r'-[^-]+-x86_64\.pkg\.tar\.zst$', '', f)
|
||||||
@@ -81,7 +82,7 @@ for f in sorted(os.listdir(REPO_DIR)):
|
|||||||
'arch': arch,
|
'arch': arch,
|
||||||
'size': size,
|
'size': size,
|
||||||
'mtime': mtime_dt.isoformat(),
|
'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,
|
'category': cat,
|
||||||
'cat_color': cat_colors.get(cat, '#7F8C8D'),
|
'cat_color': cat_colors.get(cat, '#7F8C8D'),
|
||||||
'description': meta.get('pkgdesc', ''),
|
'description': meta.get('pkgdesc', ''),
|
||||||
@@ -94,7 +95,7 @@ pkgs.sort(key=lambda p: p['name'])
|
|||||||
|
|
||||||
rows_json = json.dumps(pkgs)
|
rows_json = json.dumps(pkgs)
|
||||||
total_size_mb = sum(p['size'] for p in pkgs) / 1024 / 1024
|
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 = f'''<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|||||||
Reference in New Issue
Block a user