better handling of failed builds

This commit is contained in:
2020-08-13 08:56:25 +02:00
parent bb344c2682
commit c02be6525e

View File

@@ -54,9 +54,20 @@ def build(pkgbuild, repo):
# build with devtools # build with devtools
os.chdir(pathlib.Path(pkgbuild).parent) 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: if res.returncode:
logging.warning("[%s/%s] Build failed: %s", repo, name, res) 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) subprocess.run(["git", "clean", "-xdf"], check=True, capture_output=True)
os.chdir(sys.path[0]) os.chdir(sys.path[0])
return return