#!/usr/bin/env python3 import json, os, re, subprocess from datetime import datetime import zoneinfo PKG_DIR = 'packages' REPO_DIR = 'repo' def parse_pkgbuild(path): data = {} with open(path) as f: text = f.read() for key in ('pkgname', 'pkgver', 'pkgrel', 'pkgdesc', 'url', 'license', 'arch'): m = re.search(rf'^{key}=[\'"]?(.+?)[\'"]?$', text, re.M) if m: val = m.group(1).strip("'\"") if key == 'arch': val = val.strip('()').replace("'", '').replace('"', '').strip() data[key] = val deps = re.search(r'^depends=\((.*?)\)', text, re.DOTALL | re.M) if deps: raw = deps.group(1) data['depends'] = [d.strip("'\" ") for d in raw.strip().split('\n') if d.strip()] return data def category_for(pkgname): if pkgname.startswith('calamares'): return 'installer' if pkgname.startswith('antergos-wallpaper') or pkgname.startswith('antergos-next-desktop'): return 'branding' if pkgname in ('antergos-live', 'antergos-release', 'antergos-next-keyring', 'antergos-next-mirrorlist'): return 'core' if pkgname in ('antergos-welcome', 'antergos-next-memes', 'antergos-grub-theme'): return 'desktop' if pkgname == 'hal': return 'tool' return 'other' cat_colors = { 'installer': '#4A9EFF', 'branding': '#9B59B6', 'core': '#2ECC71', 'desktop': '#F39C12', 'tool': '#E74C3C', 'other': '#7F8C8D', } pkgs = [] for f in sorted(os.listdir(REPO_DIR)): if not f.endswith('.pkg.tar.zst') or '-debug-' in f: continue fpath = os.path.join(REPO_DIR, f) size = os.path.getsize(fpath) mtime = os.path.getmtime(fpath) 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) base = re.sub(r'-any\.pkg\.tar\.zst$', '', base) # remove version suffix to match directory dirname = re.sub(r'-\d+[\d.]*-\d+$', '', base) if dirname == 'calamares-branding-antergos-next': dirname = 'calamares-branding-antergos-next' pkgbuild_path = os.path.join(PKG_DIR, dirname, 'PKGBUILD') meta = parse_pkgbuild(pkgbuild_path) if os.path.exists(pkgbuild_path) else {} # extract version from filename: name-ver-rel-arch.pkg.tar.zst ver_match = re.match(r'.+-(\d+[\d.]*)-(\d+)-(any|x86_64)\.pkg\.tar\.zst', f) pkgver = ver_match.group(1) if ver_match else (meta.get('pkgver', '?')) pkgrel = ver_match.group(2) if ver_match else (meta.get('pkgrel', '?')) arch = ver_match.group(3) if ver_match else (meta.get('arch', '?')) pkgname = meta.get('pkgname', dirname) cat = category_for(pkgname) pkgs.append({ 'file': f, 'name': pkgname, 'version': f'{pkgver}-{pkgrel}', 'arch': arch, 'size': size, 'mtime': mtime_dt.isoformat(), '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', ''), 'url': meta.get('url', ''), 'license': meta.get('license', ''), 'depends': meta.get('depends', []), }) 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=zoneinfo.ZoneInfo('Europe/Berlin')).strftime('%Y-%m-%d %H:%M CET/CEST') html = f'''
Custom package repository for Antergos NeXT ISO builds.
Packages are built automatically via CI.
pacman.conf
# /etc/pacman.conf [antergos-pkgs] SigLevel = Optional TrustAll Server = https://antergos-next.github.io/antergos-packages/$repo/os/$arch
| Package ▼ | Category ▼ |
|---|