-
Notifications
You must be signed in to change notification settings - Fork 5
/
debug.py
executable file
·60 lines (43 loc) · 1.66 KB
/
debug.py
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
#!/usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sys
import argparse
from automation import Updatebot
from components.utilities import Struct
# ====================================================================
# ====================================================================
def die(msg):
print(msg)
sys.exit(-1)
if __name__ == "__main__":
try:
from localconfig import localconfig
except ImportError as e:
print("Execution requires a local configuration to be defined.")
print(e)
sys.exit(1)
parser = argparse.ArgumentParser()
parser.add_argument('mode', type=str, help='Debug command')
parser.add_argument('--revision', default="", required=False)
args = parser.parse_args()
u = Updatebot(localconfig)
if args.mode == "try-comments":
if not args.revision:
die("--revision is required")
import tests.library
fake_library = tests.library.LIBRARIES[0]
from components.dbmodels import Job
fake_job = Job()
fake_job.id = 1
fake_job.library_shortname = fake_library.name
fake_job.try_runs = [Struct(**{'revision': args.revision})]
(no_build_failures, results, comment_lines) = u.taskRunners['vendoring']._get_comments_on_push(fake_library, fake_job)
if not no_build_failures:
print("Build failures")
else:
for c in comment_lines:
print(c)
else:
die("Unknown mode provided")