summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-09-20 08:48:34 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-09-29 22:07:06 +0200
commitb8318d25873f2294fc04bb98f14fbcbd55a4dc8a (patch)
tree03d5f589d5c6b130444c02ded3cfd1e3818345a4
parent3a352435e95207fd395a9dbd19227da57f243047 (diff)
downloadaur-b8318d25873f2294fc04bb98f14fbcbd55a4dc8a.tar.gz
aur-b8318d25873f2294fc04bb98f14fbcbd55a4dc8a.tar.xz
git-serve: Pass user and privileges as parameters
Move the main program logic of git-server to a main() method such that it can be used as a module and easily be invoked by setuptools wrapper scripts. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rwxr-xr-xgit-interface/git-serve.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/git-interface/git-serve.py b/git-interface/git-serve.py
index 47e7df9a..ddec1444 100755
--- a/git-interface/git-serve.py
+++ b/git-interface/git-serve.py
@@ -76,7 +76,7 @@ def create_pkgbase(pkgbase, user):
conn.close()
-def pkgbase_adopt(pkgbase):
+def pkgbase_adopt(pkgbase, user, privileged):
pkgbase_id = pkgbase_from_name(pkgbase)
if not pkgbase_id:
die('{:s}: package base not found: {:s}'.format(action, pkgbase))
@@ -124,7 +124,7 @@ def pkgbase_get_comaintainers(pkgbase):
return [row[0] for row in cur.fetchall()]
-def pkgbase_set_comaintainers(pkgbase, userlist):
+def pkgbase_set_comaintainers(pkgbase, userlist, user, privileged):
pkgbase_id = pkgbase_from_name(pkgbase)
if not pkgbase_id:
die('{:s}: package base not found: {:s}'.format(action, pkgbase))
@@ -183,7 +183,7 @@ def pkgbase_set_comaintainers(pkgbase, userlist):
conn.close()
-def pkgbase_disown(pkgbase):
+def pkgbase_disown(pkgbase, user, privileged):
pkgbase_id = pkgbase_from_name(pkgbase)
if not pkgbase_id:
die('{:s}: package base not found: {:s}'.format(action, pkgbase))
@@ -211,7 +211,7 @@ def pkgbase_disown(pkgbase):
new_maintainer_userid = cur.fetchone()[0]
comaintainers.remove(new_maintainer)
- pkgbase_set_comaintainers(pkgbase, comaintainers)
+ pkgbase_set_comaintainers(pkgbase, comaintainers, user, privileged)
cur = conn.execute("UPDATE PackageBases SET MaintainerUID = ? " +
"WHERE ID = ?", [new_maintainer_userid, pkgbase_id])
@@ -365,7 +365,7 @@ elif action == 'adopt':
die_with_help("{:s}: too many arguments".format(action))
pkgbase = cmdargv[1]
- pkgbase_adopt(pkgbase)
+ pkgbase_adopt(pkgbase, user, privileged)
elif action == 'disown':
if len(cmdargv) < 2:
die_with_help("{:s}: missing repository name".format(action))
@@ -373,14 +373,14 @@ elif action == 'disown':
die_with_help("{:s}: too many arguments".format(action))
pkgbase = cmdargv[1]
- pkgbase_disown(pkgbase)
+ pkgbase_disown(pkgbase, user, privileged)
elif action == 'set-comaintainers':
if len(cmdargv) < 2:
die_with_help("{:s}: missing repository name".format(action))
pkgbase = cmdargv[1]
userlist = cmdargv[2:]
- pkgbase_set_comaintainers(pkgbase, userlist)
+ pkgbase_set_comaintainers(pkgbase, userlist, user, privileged)
elif action == 'help':
cmds = {
"adopt <name>": "Adopt a package base.",