Skip to content

Commit

Permalink
repocleaner: send an email on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
lilydjwg committed Feb 12, 2025
1 parent e8ff83a commit 495e15b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions repocleaner
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
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 495e15b

Please sign in to comment.