mirror of
https://github.com/archlinux-jerry/buildbot
synced 2024-11-25 22:40:40 +08:00
buildbot: notify update
This commit is contained in:
parent
0e376f337b
commit
fa5d4a20ab
2 changed files with 6 additions and 4 deletions
|
@ -42,7 +42,7 @@ if __name__ == '__main__':
|
||||||
configure_logger(logger)
|
configure_logger(logger)
|
||||||
def print_log():
|
def print_log():
|
||||||
import os
|
import os
|
||||||
os.system(f'tail -f {CONSOLE_LOGFILE}')
|
os.system(f'tail -n 43 -f \"{CONSOLE_LOGFILE}\"')
|
||||||
try:
|
try:
|
||||||
actions = {
|
actions = {
|
||||||
'info': 'show buildbot info',
|
'info': 'show buildbot info',
|
||||||
|
|
8
utils.py
8
utils.py
|
@ -211,7 +211,7 @@ def get_arch_from_pkgbuild(fpath):
|
||||||
with open(fpath, 'r') as f:
|
with open(fpath, 'r') as f:
|
||||||
for line in f.read().split('\n'):
|
for line in f.read().split('\n'):
|
||||||
if line.startswith('arch='):
|
if line.startswith('arch='):
|
||||||
matches = re.findall('[()\s\'\"]([\w]+)[()\s\'\"]', line)
|
matches = re.findall(r'[()\s\'\"]([\w]+)[()\s\'\"]', line)
|
||||||
if not matches:
|
if not matches:
|
||||||
raise TypeError('Unexpected PKGBUILD format')
|
raise TypeError('Unexpected PKGBUILD format')
|
||||||
matches = [arch for arch in matches if arch in ARCHS]
|
matches = [arch for arch in matches if arch in ARCHS]
|
||||||
|
@ -274,13 +274,15 @@ def configure_logger(logger, format='%(asctime)s - %(name)-18s - %(levelname)s -
|
||||||
|
|
||||||
class ExceptionFormatter(logging.Formatter):
|
class ExceptionFormatter(logging.Formatter):
|
||||||
def __init__(self, *args, notify=False, **kwargs):
|
def __init__(self, *args, notify=False, **kwargs):
|
||||||
self.notify = notify
|
self.__notify = notify
|
||||||
|
self.__lastnt = ""
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
def format(self, record):
|
def format(self, record):
|
||||||
if record.levelno == 49:
|
if record.levelno == 49:
|
||||||
record.msg = 'Exception caught.\nPrinting stack traceback\n' + record.msg
|
record.msg = 'Exception caught.\nPrinting stack traceback\n' + record.msg
|
||||||
fmtr = super().format(record)
|
fmtr = super().format(record)
|
||||||
if self.notify:
|
if self.__notify and not (self.__lastnt == fmtr):
|
||||||
|
self.lastnt = fmtr
|
||||||
send(fmtr)
|
send(fmtr)
|
||||||
return fmtr
|
return fmtr
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue