From c02be6525e1ad65cbd95c2390911668e8fe9652e Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Thu, 13 Aug 2020 08:56:25 +0200 Subject: [PATCH] better handling of failed builds --- master.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/master.py b/master.py index 31346f3..8dd794d 100644 --- a/master.py +++ b/master.py @@ -54,9 +54,20 @@ def build(pkgbuild, repo): # build with devtools os.chdir(pathlib.Path(pkgbuild).parent) - res = subprocess.run(["sudo", "extra-x86_64-build"], capture_output=True) + res = subprocess.run(["sudo", "extra-x86_64-build"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) if res.returncode: logging.warning("[%s/%s] Build failed: %s", repo, name, res) + # write packagename to failed list + with open(os.path.join(config["basedir"]["repo"], repo + "_failed.txt"), "a") as f: + f.write(name + "\n") + + # write logs to file + if not os.path.exists(os.path.join(config["basedir"]["repo"], "logs", repo)): + os.mkdir(os.path.join(config["basedir"]["repo"], "logs", repo)) + + with open(os.path.join(config["basedir"]["repo"], "logs", repo, name + ".log"), "w") as l: + l.write(res.stdout.decode()) + subprocess.run(["git", "clean", "-xdf"], check=True, capture_output=True) os.chdir(sys.path[0]) return