forked from lix-project/lix
Get rid of basicDerivation::findOutput
It's a tiny function which is: - hardly worth abstrating over, and also only used once. - doesn't work once we get CA drvs I rewrote the one callsite to be forwards compatable with CA derivations, and also potentially more performant: instead of reading in the derivation it can ust consult the SQLite DB in the common case.
This commit is contained in:
parent
4bfba1305e
commit
2274f63453
|
@ -7,14 +7,6 @@
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
const StorePath & BasicDerivation::findOutput(const string & id) const
|
|
||||||
{
|
|
||||||
auto i = outputs.find(id);
|
|
||||||
if (i == outputs.end())
|
|
||||||
throw Error("derivation has no output '%s'", id);
|
|
||||||
return i->second.path;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool BasicDerivation::isBuiltin() const
|
bool BasicDerivation::isBuiltin() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,10 +39,6 @@ struct BasicDerivation
|
||||||
BasicDerivation() { }
|
BasicDerivation() { }
|
||||||
virtual ~BasicDerivation() { };
|
virtual ~BasicDerivation() { };
|
||||||
|
|
||||||
/* Return the path corresponding to the output identifier `id' in
|
|
||||||
the given derivation. */
|
|
||||||
const StorePath & findOutput(const std::string & id) const;
|
|
||||||
|
|
||||||
bool isBuiltin() const;
|
bool isBuiltin() const;
|
||||||
|
|
||||||
/* Return true iff this is a fixed-output derivation. */
|
/* Return true iff this is a fixed-output derivation. */
|
||||||
|
|
|
@ -381,7 +381,8 @@ static void queryInstSources(EvalState & state,
|
||||||
|
|
||||||
if (path.isDerivation()) {
|
if (path.isDerivation()) {
|
||||||
elem.setDrvPath(state.store->printStorePath(path));
|
elem.setDrvPath(state.store->printStorePath(path));
|
||||||
elem.setOutPath(state.store->printStorePath(state.store->derivationFromPath(path).findOutput("out")));
|
auto outputs = state.store->queryDerivationOutputMap(path);
|
||||||
|
elem.setOutPath(state.store->printStorePath(outputs.at("out")));
|
||||||
if (name.size() >= drvExtension.size() &&
|
if (name.size() >= drvExtension.size() &&
|
||||||
string(name, name.size() - drvExtension.size()) == drvExtension)
|
string(name, name.size() - drvExtension.size()) == drvExtension)
|
||||||
name = string(name, 0, name.size() - drvExtension.size());
|
name = string(name, 0, name.size() - drvExtension.size());
|
||||||
|
|
Loading…
Reference in a new issue