mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
mkpkglists: Make output files configurable
Instead of writing the output to hardcoded files (relative to the document root), make the output paths of mkpkglists configurable. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
dd59eea368
commit
ec5779c824
2 changed files with 9 additions and 4 deletions
|
@ -63,3 +63,7 @@ max-blob-size = 256000
|
|||
db-path = /srv/http/aurweb/aurblup/
|
||||
sync-dbs = core extra community multilib testing community-testing
|
||||
servers = ftp://mirrors.kernel.org/archlinux/%s/os/x86_64
|
||||
|
||||
[mkpkglists]
|
||||
packagesfile = /srv/http/aurweb/web/html/packages.gz
|
||||
pkgbasefile = /srv/http/aurweb/web/html/pkgbase.gz
|
||||
|
|
|
@ -2,11 +2,12 @@
|
|||
|
||||
import datetime
|
||||
import gzip
|
||||
import os
|
||||
|
||||
import aurweb.config
|
||||
import aurweb.db
|
||||
|
||||
docroot = os.path.dirname(os.path.realpath(__file__)) + "/../web/html/"
|
||||
packagesfile = aurweb.config.get('mkpkglists', 'packagesfile')
|
||||
pkgbasefile = aurweb.config.get('mkpkglists', 'pkgbasefile')
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -16,7 +17,7 @@ def main():
|
|||
pkglist_header = "# AUR package list, generated on " + datestr
|
||||
pkgbaselist_header = "# AUR package base list, generated on " + datestr
|
||||
|
||||
with gzip.open(docroot + "packages.gz", "w") as f:
|
||||
with gzip.open(packagesfile, "w") as f:
|
||||
f.write(bytes(pkglist_header + "\n", "UTF-8"))
|
||||
cur = conn.execute("SELECT Packages.Name FROM Packages " +
|
||||
"INNER JOIN PackageBases " +
|
||||
|
@ -24,7 +25,7 @@ def main():
|
|||
"WHERE PackageBases.PackagerUID IS NOT NULL")
|
||||
f.writelines([bytes(x[0] + "\n", "UTF-8") for x in cur.fetchall()])
|
||||
|
||||
with gzip.open(docroot + "pkgbase.gz", "w") as f:
|
||||
with gzip.open(pkgbasefile, "w") as f:
|
||||
f.write(bytes(pkgbaselist_header + "\n", "UTF-8"))
|
||||
cur = conn.execute("SELECT Name FROM PackageBases " +
|
||||
"WHERE PackagerUID IS NOT NULL")
|
||||
|
|
Loading…
Add table
Reference in a new issue