forked from kernelci/kernelci-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kci_bisect
executable file
·67 lines (57 loc) · 2.22 KB
/
kci_bisect
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
60
61
62
63
64
65
66
67
#!/usr/bin/env python3
#
# Copyright (C) 2021 Collabora Limited
# Author: Guillaume Tucker <[email protected]>
#
# This module is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import sys
from kernelci.cli import Args, Command, parse_opts
import kernelci.bisect
import kernelci.config
class cmd_get_recipients(Command):
help = "Get the list of email recipients as JSON lists for To: and Cc:"
args = [Args.kdir, Args.commit]
opt_args = [Args.to, Args.cc]
def __call__(self, configs, args):
to, cc = (
set(arg.split(' ') if arg else []) for arg in (args.to, args.cc)
)
rcpts = kernelci.bisect.get_recipients(args.kdir, args.commit, to, cc)
for header, category in [("To:", 'to'), ("Cc:", 'cc')]:
print(header)
for rcpt in rcpts[category]:
print(" {}".format(rcpt))
return True
class cmd_get_mbox(Command):
help = "Get an mbox email for a given commit"
args = [Args.kdir, Args.commit]
opt_args = [
{
'name': '--base-url',
'default': 'https://lore.kernel.org/all/?',
'help': "Skip git pull",
},
]
def __call__(self, configs, args):
mbox = kernelci.bisect.get_mbox(args.kdir, args.commit, args.base_url)
if not mbox:
return False
print(mbox)
return True
if __name__ == '__main__':
opts = parse_opts("kci_bisect", globals())
configs = kernelci.config.load(opts.get_yaml_configs())
status = opts.command(configs, opts)
sys.exit(0 if status is True else 1)