aboutsummaryrefslogtreecommitdiffstats
path: root/MgaRepo/commands/maintdb.py
blob: 0bd4d560aa21aae42540902e2f7db4275c589121 (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
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")
    maintdb_helper = get_helper("maintdb")
    command = ["ssh", host, maintdb_helper] + maintdb_args
    execcmd(command, show=True)
    sys.exit(0)

def main():
    do_command(parse_options, maintdb)

# vim:et:ts=4:sw=4