9 docroot
= os
.path
.dirname(os
.path
.realpath(__file__
)) + "/../web/html/"
11 config
= configparser
.RawConfigParser()
12 config
.read(os
.path
.dirname(os
.path
.realpath(__file__
)) + "/../conf/config")
14 aur_db_host
= config
.get('database', 'host')
15 aur_db_name
= config
.get('database', 'name')
16 aur_db_user
= config
.get('database', 'user')
17 aur_db_pass
= config
.get('database', 'password')
18 aur_db_socket
= config
.get('database', 'socket')
20 db
= mysql
.connector
.connect(host
=aur_db_host
, user
=aur_db_user
,
21 passwd
=aur_db_pass
, db
=aur_db_name
,
22 unix_socket
=aur_db_socket
, buffered
=True)
25 datestr
= datetime
.datetime
.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")
26 pkglist_header
= "# AUR package list, generated on " + datestr
27 pkgbaselist_header
= "# AUR package base list, generated on " + datestr
29 with gzip
.open(docroot
+ "packages.gz", "w") as f
:
30 f
.write(bytes(pkglist_header
+ "\n", "UTF-8"))
31 cur
.execute("SELECT Name FROM Packages")
32 f
.writelines([bytes(x
[0] + "\n", "UTF-8") for x
in cur
.fetchall()])
34 with gzip
.open(docroot
+ "pkgbase.gz", "w") as f
:
35 f
.write(bytes(pkgbaselist_header
+ "\n", "UTF-8"))
36 cur
.execute("SELECT Name FROM PackageBases")
37 f
.writelines([bytes(x
[0] + "\n", "UTF-8") for x
in cur
.fetchall()])