-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repocleaner: send an email on failure
- Loading branch information
Showing
1 changed file
with
10 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python3 | ||
#!/usr/bin/python3 | ||
|
||
import os | ||
from collections import defaultdict | ||
|
@@ -9,6 +9,7 @@ from pathlib import Path | |
from typing import Tuple | ||
|
||
import archpkg | ||
import mailutils | ||
|
||
repo_path: Path = Path('/data/repo') | ||
gitrepo_path: Path = Path('~/archgitrepo').expanduser() | ||
|
@@ -148,10 +149,17 @@ def main() -> None: | |
out = e.output | ||
error = True | ||
for line in out.decode('utf-8', errors='backslashreplace').splitlines(): | ||
if 'Already up-to-date.' in line: | ||
if 'Already up to date.' in line: | ||
continue | ||
print(line) | ||
if error: | ||
mail = mailutils.assemble_mail( | ||
'repocleaner error!', | ||
'依云 <[email protected]>', | ||
'repocleaner <[email protected]>', | ||
text = out.decode('utf-8', errors='backslashreplace'), | ||
) | ||
mailutils.sendmail(mail) | ||
sys.exit(1) | ||
|
||
all_packages = get_all_pkgnames() | ||
|