blob: c926ec28e28fc347dc1b2bb5f8e46b36a47252dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/usr/bin/python
from MgaRepo import Error, config
from MgaRepo.command import *
from MgaRepo.util import execcmd, get_helper
import sys
HELP = """\
Usage:
Take maintainership of one package :
mgarepo maintdb set [package] [login]
Remove yourself from maintainer of a package :
mgarepo maintdb set [package] nobody
See who is maintainer of a package :
mgarepo maintdb get [package]
See the list of all packages with their maintainer :
mgarepo maintdb get
"""
def parse_options():
parser = OptionParser(help=HELP)
opts, args = parser.parse_args()
if len(args):
opts.maintdb_args = args
else:
raise Error("you need to provide arguments, see them with --help")
return opts
def maintdb(maintdb_args):
host = config.get("maintdb", "host", "maintdb.mageia.org")
if (maintdb_args[0] == 'get' and len(maintdb_args)>=2):
url = config.get("maintdb", "url", "http://maintdb.mageia.org/")
import urllib.request
try:
page=urllib.request.urlopen(url + maintdb_args[1])
rep = page.read().decode('utf8')
except urllib.error.HTTPError as e:
if e.code == 404 :
rep = "There is no package named {}".format(maintdb_args[1])
else:
rep = e.reason
except Exception as e:
rep = "Error trying to query the database : {}. Have you active Internet connection?".format(e.reason)
print(rep)
else:
maintdb_helper = get_helper("maintdb")
cmd_args = ' '.join(maintdb_args)
command = "ssh %s %s %s" % (host, maintdb_helper, cmd_args)
execcmd(command, show=True)
sys.exit(0)
def main():
do_command(parse_options, maintdb)
# vim:et:ts=4:sw=4
|