tvl-depot/src/libexpr/get-drvs.hh

92 lines
2.1 KiB
C++
Raw Normal View History

#pragma once
#include "eval.hh"
#include <string>
#include <map>
namespace nix {
struct DrvInfo
{
public:
typedef std::map<string, Path> Outputs;
private:
2013-11-19 14:09:03 +01:00
EvalState * state;
string drvPath;
string outPath;
string outputName;
Outputs outputs;
bool failed; // set if we get an AssertionError
2013-11-19 14:09:03 +01:00
Bindings * attrs, * meta;
Bindings * getMeta();
bool checkMeta(Value & v);
public:
string name;
string attrPath; /* path towards the derivation */
string system;
2013-11-19 14:09:03 +01:00
DrvInfo(EvalState & state) : state(&state), failed(false), attrs(0), meta(0) { };
DrvInfo(EvalState & state, const string & name, const string & attrPath, const string & system, Bindings * attrs)
: state(&state), failed(false), attrs(attrs), meta(0), name(name), attrPath(attrPath), system(system) { };
string queryDrvPath();
string queryOutPath();
string queryOutputName();
Outputs queryOutputs();
2013-11-19 14:09:03 +01:00
StringSet queryMetaNames();
Value * queryMeta(const string & name);
string queryMetaString(const string & name);
int queryMetaInt(const string & name, int def);
bool queryMetaBool(const string & name, bool def);
void setMeta(const string & name, Value * v);
2013-11-19 14:09:03 +01:00
/*
MetaInfo queryMetaInfo(EvalState & state) const;
MetaValue queryMetaInfo(EvalState & state, const string & name) const;
2013-11-19 14:09:03 +01:00
*/
void setDrvPath(const string & s)
{
drvPath = s;
}
void setOutPath(const string & s)
{
outPath = s;
}
void setFailed() { failed = true; };
bool hasFailed() { return failed; };
};
#if HAVE_BOEHMGC
typedef list<DrvInfo, traceable_allocator<DrvInfo> > DrvInfos;
#else
typedef list<DrvInfo> DrvInfos;
#endif
2010-03-31 17:38:03 +02:00
/* If value `v' denotes a derivation, store information about the
derivation in `drv' and return true. Otherwise, return false. */
bool getDerivation(EvalState & state, Value & v, DrvInfo & drv,
bool ignoreAssertionFailures);
2010-03-31 17:38:03 +02:00
void getDerivations(EvalState & state, Value & v, const string & pathPrefix,
Bindings & autoArgs, DrvInfos & drvs,
bool ignoreAssertionFailures);
}