summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2017-08-01 07:08:29 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2017-08-01 07:08:29 +0200
commitd9883ee64215ee91bfe1cc3e75c83ec6e6875671 (patch)
treea63cb58f6dec8f1bd92ad5a4c0108c7fd7e0697d
parente06773add6bbecdf9ce797412ff0125780ba635d (diff)
downloadaur-d9883ee64215ee91bfe1cc3e75c83ec6e6875671.tar.gz
aur-d9883ee64215ee91bfe1cc3e75c83ec6e6875671.zip
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: Lukas Fleischer <lfleischer@archlinux.org>
-rwxr-xr-xaurweb/scripts/mkpkglists.py7
-rw-r--r--conf/config.proto1
-rw-r--r--test/setup.sh1
-rwxr-xr-xtest/t2100-mkpkglists.sh18
4 files changed, 27 insertions, 0 deletions
diff --git a/aurweb/scripts/mkpkglists.py b/aurweb/scripts/mkpkglists.py
index 8a0f2e9..686ee7d 100755
--- a/aurweb/scripts/mkpkglists.py
+++ b/aurweb/scripts/mkpkglists.py
@@ -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()
diff --git a/conf/config.proto b/conf/config.proto
index 6c637b0..1750929 100644
--- a/conf/config.proto
+++ b/conf/config.proto
@@ -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
diff --git a/test/setup.sh b/test/setup.sh
index efa1ab8..d98c49c 100644
--- a/test/setup.sh
+++ b/test/setup.sh
@@ -61,6 +61,7 @@ server = file://$(pwd)/remote/
[mkpkglists]
packagesfile = packages.gz
pkgbasefile = pkgbase.gz
+userfile = users.gz
EOF
cat >sendmail.sh <<-\EOF
diff --git a/test/t2100-mkpkglists.sh b/test/t2100-mkpkglists.sh
index 1e2edc3..fc11d07 100755
--- a/test/t2100-mkpkglists.sh
+++ b/test/t2100-mkpkglists.sh
@@ -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