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
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:
@ -9,6 +9,8 @@ from flupdt.common import bash_wrapper
|
||||
|
||||
drv_re = re.compile(r".*(/nix/store/.*\.drv).*")
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def evaluate_output(path: str, output: str) -> str | None:
|
||||
"""Evaluates a given output in a flake.
|
||||
@ -18,19 +20,19 @@ def evaluate_output(path: str, output: str) -> str | None:
|
||||
:returns the .drv path on success or None on failure
|
||||
:raises RuntimeError: evaluation succeeds but no derivation is found
|
||||
"""
|
||||
logging.info(f"evaluating {output}")
|
||||
logger.info(f"evaluating {output}")
|
||||
out = bash_wrapper(f"nix eval {path}#{output}")
|
||||
logging.debug(out[0])
|
||||
logging.debug(out[1])
|
||||
logging.debug(out[2])
|
||||
logger.debug(out[0])
|
||||
logger.debug(out[1])
|
||||
logger.debug(out[2])
|
||||
if out[2] != 0:
|
||||
logging.warning(f"output {output} did not evaluate correctly")
|
||||
logger.warning(f"output {output} did not evaluate correctly")
|
||||
return None
|
||||
drv_match = drv_re.match(out[0])
|
||||
if drv_match is None:
|
||||
out_msg = "derivation succeeded but output derivation does not contain a derivation"
|
||||
raise RuntimeError(out_msg)
|
||||
drv = drv_match.group(1)
|
||||
logging.debug(f"derivation evaluated to {drv}")
|
||||
logger.debug(f"derivation evaluated to {drv}")
|
||||
|
||||
return drv
|
||||
|
Reference in New Issue
Block a user