Skip to content
Snippets Groups Projects
Commit d9883ee6 authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

mkpkglists: Generate a list of user names


In addition to the packages list and the package base list, also create
a list of registered user names.

Signed-off-by: default avatarLukas Fleischer <lfleischer@archlinux.org>
parent e06773ad
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ import aurweb.db
packagesfile = aurweb.config.get('mkpkglists', 'packagesfile')
pkgbasefile = aurweb.config.get('mkpkglists', 'pkgbasefile')
userfile = aurweb.config.get('mkpkglists', 'userfile')
def main():
......@@ -16,6 +17,7 @@ def main():
datestr = datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")
pkglist_header = "# AUR package list, generated on " + datestr
pkgbaselist_header = "# AUR package base list, generated on " + datestr
userlist_header = "# AUR user name list, generated on " + datestr
with gzip.open(packagesfile, "w") as f:
f.write(bytes(pkglist_header + "\n", "UTF-8"))
......@@ -31,6 +33,11 @@ def main():
"WHERE PackagerUID IS NOT NULL")
f.writelines([bytes(x[0] + "\n", "UTF-8") for x in cur.fetchall()])
with gzip.open(userfile, "w") as f:
f.write(bytes(userlist_header + "\n", "UTF-8"))
cur = conn.execute("SELECT UserName FROM Users")
f.writelines([bytes(x[0] + "\n", "UTF-8") for x in cur.fetchall()])
conn.close()
......
......@@ -71,3 +71,4 @@ server = 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
userfile = /srv/http/aurweb/web/html/users.gz
......@@ -61,6 +61,7 @@ server = file://$(pwd)/remote/
[mkpkglists]
packagesfile = packages.gz
pkgbasefile = pkgbase.gz
userfile = users.gz
EOF
cat >sendmail.sh <<-\EOF
......
......@@ -44,4 +44,22 @@ test_expect_success 'Test package list generation.' '
test_cmp actual expected
'
test_expect_success 'Test user list generation.' '
"$MKPKGLISTS" &&
cat <<-EOD >expected &&
dev
tu
tu2
tu3
tu4
user
user2
user3
user4
EOD
gunzip users.gz &&
sed "/^#/d" users >actual &&
test_cmp actual expected
'
test_done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment