From 753730c410ebb83f78bc70e47e100b8b464abf35 Mon Sep 17 00:00:00 2001 From: regnat Date: Fri, 4 Jun 2021 15:21:03 +0200 Subject: [PATCH] Optimize the nix build caching --- src/libcmd/installables.cc | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc index c2ad3fd85..08497854c 100644 --- a/src/libcmd/installables.cc +++ b/src/libcmd/installables.cc @@ -506,31 +506,20 @@ std::tuple InstallableF *emptyArgs, *getFlakeOutputs(*state, *lockedFlake) ); - auto drvPath = state->forceString( - *findAlongAttrPath( - *state, - "drvPath", - *emptyArgs, - *drvValue).first - ); - auto outPath = state->forceString( - *findAlongAttrPath( - *state, - "outPath", - *emptyArgs, - *drvValue).first - ); - auto outputName = state->forceString( - *findAlongAttrPath( - *state, - "outputName", - *emptyArgs, - *drvValue).first - ); + Value * v = state->allocValue(); + if (!state->getAttrField(*drvValue, {state->sDrvPath}, pos, *v)) + break; + auto drvPath = state->forceString(*v); + if (!state->getAttrField(*drvValue, {state->sOutPath}, pos, *v)) + break; + auto outPath = state->forceString(*v); + if (!state->getAttrField(*drvValue, {state->sOutputName}, pos, *v)) + break; + auto outputName = state->forceString(*v); auto drvInfo = DerivationInfo{ state->store->parseStorePath(drvPath), - state->store->maybeParseStorePath(outPath), // FIXME: set to something when relevant? + state->store->maybeParseStorePath(outPath), outputName };