feat(PHP): Add packages dump file with more metadata

This commit is contained in:
Kristian Klausen 2021-10-15 20:14:31 +02:00 committed by Kevin Morris
parent 10fcf93991
commit f606140050
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
4 changed files with 13 additions and 0 deletions

View file

@ -2,11 +2,13 @@
import datetime
import gzip
import json
import aurweb.config
import aurweb.db
packagesfile = aurweb.config.get('mkpkglists', 'packagesfile')
packagesmetafile = aurweb.config.get('mkpkglists', 'packagesmetafile')
pkgbasefile = aurweb.config.get('mkpkglists', 'pkgbasefile')
userfile = aurweb.config.get('mkpkglists', 'userfile')
@ -27,6 +29,14 @@ def main():
"WHERE PackageBases.PackagerUID IS NOT NULL")
f.writelines([bytes(x[0] + "\n", "UTF-8") for x in cur.fetchall()])
with gzip.open(packagesmetafile, "wt") as f:
cur = conn.execute("SELECT * FROM Packages")
json.dump({
"warning": "This is a experimental! It can be removed or modified without warning!",
"columns": [d[0] for d in cur.description],
"data": cur.fetchall()
}, f)
with gzip.open(pkgbasefile, "w") as f:
f.write(bytes(pkgbaselist_header + "\n", "UTF-8"))
cur = conn.execute("SELECT Name FROM PackageBases " +