exit on failure, add per-class logging
All checks were successful
Check Nix flake / Perform Nix flake checks (ubuntu-latest) (pull_request) Successful in 3m26s
Check flake.lock / Check health of `flake.lock` (pull_request) Successful in 20s
Check Nix flake / Build nix outputs (ubuntu-latest) (pull_request) Successful in 2m21s
Check Nix formatting / Perform Nix format checks (pull_request) Successful in 1m41s

Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
2025-03-26 11:22:29 -04:00
parent 4438e93037
commit 607f3f9f76
5 changed files with 42 additions and 31 deletions

View File

@ -11,6 +11,7 @@ from flupdt.common import bash_wrapper
drv_re = re.compile(r".*(/nix/store/.*\.drv).*")
OUTPUT_DIR = mkdtemp(prefix="flupdt-outputs-")
logger = logging.getLogger(__name__)
def build_output(path: str, output: str) -> str | None:
@ -20,16 +21,16 @@ def build_output(path: str, output: str) -> str | None:
:param output: flake output to be built
:returns the .drv path on success or None on failure
"""
logging.info(f"build {output}")
logging.debug(f"outputting to {OUTPUT_DIR}/{output}.nixoutput")
logger.info(f"build {output}")
logger.debug(f"outputting to {OUTPUT_DIR}/{output}.nixoutput")
out = bash_wrapper(f"nix build {path}#{output} -o {OUTPUT_DIR}/{output}.nixoutput")
logging.debug("output")
logging.debug(out[0])
logging.debug("error")
logging.debug(out[1])
logging.debug("statuscode")
logging.debug(out[2])
logger.debug("output")
logger.debug(out[0])
logger.debug("error")
logger.debug(out[1])
logger.debug("statuscode")
logger.debug(out[2])
if out[2] != 0:
logging.warning(f"output {output} did not build correctly")
logger.warning(f"output {output} did not build correctly")
return None
return ""