testVersion: when there is a error show the whole error

before

$ nix build ".#whipper.tests.version"
whipper>   File "/nix/store/2iiyy58pmm1ys6dy8ycbmmmfm67iakv1-whipper-0.10.0/bin/.whipper-wrapped", line 6, in <module>
whipper>   File "/nix/store/2iiyy58pmm1ys6dy8ycbmmmfm67iakv1-whipper-0.10.0/lib/python3.9/site-packages/whipper/__init__.py", line 5, in <module>
note: keeping build directory '/tmp/nix-build-whipper-0.10.0-test-version.drv-7'

after
$ nix build ".#whipper.tests.version"
whipper> Traceback (most recent call last):
whipper>   File "/nix/store/2iiyy58pmm1ys6dy8ycbmmmfm67iakv1-whipper-0.10.0/bin/.whipper-wrapped", line 6, in <module>
whipper>     from whipper.command.main import main
whipper>   File "/nix/store/2iiyy58pmm1ys6dy8ycbmmmfm67iakv1-whipper-0.10.0/lib/python3.9/site-packages/whipper/__init__.py", line 5, in <module>
whipper>     from pkg_resources import (get_distribution,
whipper> ModuleNotFoundError: No module named 'pkg_resources'
note: keeping build directory '/tmp/nix-build-whipper-0.10.0-test-version.drv-34'
error: builder for '/nix/store/5lxjicdhwgmjcz9ddlxgq3s3gyaa6lz4-whipper-0.10.0-test-version.drv' failed with exit code 1;
main
Artturin 2 years ago
parent 289f38a65b
commit 390439d726
  1. 8
      pkgs/build-support/trivial-builders.nix

@ -810,7 +810,11 @@ rec {
command ? "${package.meta.mainProgram or package.pname or package.name} --version",
version ? package.version,
}: runCommand "${package.name}-test-version" { nativeBuildInputs = [ package ]; meta.timeout = 60; } ''
${command} |& grep -Fw ${version}
touch $out
if output=$(${command} 2>&1); then
grep -Fw "${version}" - <<< "$output"
touch $out
else
echo "$output" >&2 && exit 1
fi
'';
}

Loading…
Cancel
Save