modified logging of build process

This commit is contained in:
2020-08-12 10:22:44 +02:00
parent f6b23cd770
commit 377ef0d50c

View File

@@ -43,7 +43,7 @@ def find_all_files_for_pkg(name, repo):
def build(pkgbuild, repo): def build(pkgbuild, repo):
start_time = time.time() start_time = time.time()
logging.info("[%s] Build starting", pathlib.Path(pkgbuild).parts[-4]) logging.info("[%s-%s] Build starting", repo, pathlib.Path(pkgbuild).parts[-4])
# setup buildflags # setup buildflags
setup_makepkg(repo) setup_makepkg(repo)
@@ -52,7 +52,7 @@ def build(pkgbuild, repo):
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"], capture_output=True)
if res.returncode: if res.returncode:
logging.warning("[%s] Build failed: %s", pathlib.Path(pkgbuild).parts[-4], str(res.stderr)) logging.warning("[%s-%s] Build failed: %s", repo, pathlib.Path(pkgbuild).parts[-4], str(res.stderr))
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
@@ -62,7 +62,7 @@ def build(pkgbuild, repo):
for pkg in pkgs: for pkg in pkgs:
s_res = subprocess.run(["gpg", "--batch", "--detach-sign", pkg], capture_output=True) s_res = subprocess.run(["gpg", "--batch", "--detach-sign", pkg], capture_output=True)
if s_res.returncode: if s_res.returncode:
logging.error("[%s] Signing failed: %s", pathlib.Path(pkgbuild).parts[-4], s_res.stderr) logging.error("[%s-%s] Signing failed: %s", repo, pathlib.Path(pkgbuild).parts[-4], s_res.stderr)
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
@@ -70,7 +70,7 @@ def build(pkgbuild, repo):
# copying # copying
pkgs.append(glob.glob("*.pkg.tar.zst.sig")) pkgs.append(glob.glob("*.pkg.tar.zst.sig"))
for pkg in pkgs: for pkg in pkgs:
logging.debug("[%s] Copy %s to %s", pathlib.Path(pkgbuild).parts[-4], pkg, logging.debug("[%s-%s] Copy %s to %s", repo, pathlib.Path(pkgbuild).parts[-4], pkg,
os.path.join(config["basedir"]["repo"], repo, "os", config["arch"] + "/")) os.path.join(config["basedir"]["repo"], repo, "os", config["arch"] + "/"))
shutil.copy2(pkg, os.path.join(config["basedir"]["repo"], repo, "os", config["arch"] + "/")) shutil.copy2(pkg, os.path.join(config["basedir"]["repo"], repo, "os", config["arch"] + "/"))
@@ -79,7 +79,7 @@ def build(pkgbuild, repo):
os.path.join(config["basedir"]["repo"], repo, "os", config["arch"], repo + ".db.tar.xz"), os.path.join(config["basedir"]["repo"], repo, "os", config["arch"], repo + ".db.tar.xz"),
pkgs[0]], capture_output=True) pkgs[0]], capture_output=True)
if r_res.returncode: if r_res.returncode:
logging.error("[%s] Repo action failed: %s", pathlib.Path(pkgbuild).parts[-4], r_res) logging.error("[%s-%s] Repo action failed: %s", repo, pathlib.Path(pkgbuild).parts[-4], r_res)
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
@@ -88,7 +88,7 @@ def build(pkgbuild, repo):
["paccache", "-rc", "-k 1", os.path.join(config["basedir"]["repo"], repo, "os", config["arch"])], ["paccache", "-rc", "-k 1", os.path.join(config["basedir"]["repo"], repo, "os", config["arch"])],
capture_output=True) capture_output=True)
if p_res.returncode: if p_res.returncode:
logging.error("[%s] Repo cleanup failed: %s", pathlib.Path(pkgbuild).parts[-4], p_res) logging.error("[%s-%s] Repo cleanup failed: %s", repo, pathlib.Path(pkgbuild).parts[-4], p_res)
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
@@ -96,7 +96,7 @@ def build(pkgbuild, repo):
# cleanup # cleanup
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])
logging.info("[%s] Build successful (%s)", pathlib.Path(pkgbuild).parts[-4], time.time() - start_time) logging.info("[%s-%s] Build successful (%s)", repo, pathlib.Path(pkgbuild).parts[-4], time.time() - start_time)
def setup_makepkg(repo): def setup_makepkg(repo):