mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
See doc/git-archive.md for general Git archive specifications See doc/repos/metadata-repo.md for info and direction related to the new Git metadata archive
32 lines
851 B
Python
32 lines
851 B
Python
from typing import Iterable
|
|
|
|
import orjson
|
|
|
|
from aurweb import config, db
|
|
from aurweb.models import PackageBase
|
|
|
|
from .base import GitInfo, SpecBase, SpecOutput
|
|
|
|
ORJSON_OPTS = orjson.OPT_SORT_KEYS | orjson.OPT_INDENT_2
|
|
|
|
|
|
class Spec(SpecBase):
|
|
def __init__(self) -> "Spec":
|
|
self.pkgbases_repo = GitInfo(config.get("git-archive", "pkgbases-repo"))
|
|
|
|
def generate(self) -> Iterable[SpecOutput]:
|
|
filt = PackageBase.PackagerUID.isnot(None)
|
|
query = (
|
|
db.query(PackageBase.Name)
|
|
.filter(filt)
|
|
.order_by(PackageBase.Name.asc())
|
|
.all()
|
|
)
|
|
pkgbases = [pkgbase.Name for pkgbase in query]
|
|
|
|
self.add_output(
|
|
"pkgbase.json",
|
|
self.pkgbases_repo,
|
|
orjson.dumps(pkgbases, option=ORJSON_OPTS),
|
|
)
|
|
return self.outputs
|