Skip to content

Commit 495e15b

Browse files
committed
repocleaner: send an email on failure
1 parent e8ff83a commit 495e15b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

repocleaner

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python3
1+
#!/usr/bin/python3
22

33
import os
44
from collections import defaultdict
@@ -9,6 +9,7 @@ from pathlib import Path
99
from typing import Tuple
1010

1111
import archpkg
12+
import mailutils
1213

1314
repo_path: Path = Path('/data/repo')
1415
gitrepo_path: Path = Path('~/archgitrepo').expanduser()
@@ -148,10 +149,17 @@ def main() -> None:
148149
out = e.output
149150
error = True
150151
for line in out.decode('utf-8', errors='backslashreplace').splitlines():
151-
if 'Already up-to-date.' in line:
152+
if 'Already up to date.' in line:
152153
continue
153154
print(line)
154155
if error:
156+
mail = mailutils.assemble_mail(
157+
'repocleaner error!',
158+
'依云 <[email protected]>',
159+
'repocleaner <[email protected]>',
160+
text = out.decode('utf-8', errors='backslashreplace'),
161+
)
162+
mailutils.sendmail(mail)
155163
sys.exit(1)
156164

157165
all_packages = get_all_pkgnames()

0 commit comments

Comments
 (0)