mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat(PHP): Add packages dump file with more metadata
This commit is contained in:
parent
10fcf93991
commit
f606140050
4 changed files with 13 additions and 0 deletions
|
@ -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 " +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue