From aef635da78d33bf679f49fd10e7130d918a82549 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 21 Jan 2020 21:14:13 +0100 Subject: Fix derivation computation with __structuredAttrs and multiple outputs Fixes error: derivation '/nix/store/klivma7r7h5lndb99f7xxmlh5whyayvg-zlib-1.2.11.drv' has incorrect output '/nix/store/fv98nnx5ykgbq8sqabilkgkbc4169q05-zlib-1.2.11-dev', should be '/nix/store/adm7pilzlj3z5k249s8b4wv3scprhzi1-zlib-1.2.11-dev' --- tests/structured-attrs.nix | 6 +++++- tests/structured-attrs.sh | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/structured-attrs.nix b/tests/structured-attrs.nix index 6c77a4391..c39c3a346 100644 --- a/tests/structured-attrs.nix +++ b/tests/structured-attrs.nix @@ -16,6 +16,8 @@ mkDerivation { __structuredAttrs = true; + outputs = [ "out" "dev" ]; + buildCommand = '' set -x @@ -30,8 +32,9 @@ mkDerivation { [[ -v nothing ]] [[ -z $nothing ]] - mkdir ''${outputs[out]} + mkdir ''${outputs[out]} ''${outputs[dev]} echo bar > $dest + echo foo > $dest2 json=$(cat .attrs.json) [[ $json =~ '"narHash":"sha256:1r7yc43zqnzl5b0als5vnyp649gk17i37s7mj00xr8kc47rjcybk"' ]] @@ -57,6 +60,7 @@ mkDerivation { nothing = null; dest = "${placeholder "out"}/foo"; + dest2 = "${placeholder "dev"}/foo"; "foo bar" = "BAD"; "1foobar" = "BAD"; diff --git a/tests/structured-attrs.sh b/tests/structured-attrs.sh index 9ba2672b6..646bdb876 100644 --- a/tests/structured-attrs.sh +++ b/tests/structured-attrs.sh @@ -2,6 +2,7 @@ source common.sh clearStore -outPath=$(nix-build structured-attrs.nix --no-out-link) +nix-build structured-attrs.nix -A all -o $TEST_ROOT/result -[[ $(cat $outPath/foo) = bar ]] +[[ $(cat $TEST_ROOT/result/foo) = bar ]] +[[ $(cat $TEST_ROOT/result-dev/foo) = foo ]] -- cgit v1.2.3