2012-07-18 20:59:03 +02:00
|
|
|
#pragma once
|
2006-02-08 14:21:16 +01:00
|
|
|
|
2010-10-04 19:55:38 +02:00
|
|
|
#include "eval.hh"
|
|
|
|
|
2006-02-08 14:21:16 +01:00
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
|
2006-09-04 23:06:23 +02:00
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
|
2006-02-08 14:21:16 +01:00
|
|
|
struct DrvInfo
|
|
|
|
{
|
2012-11-28 13:49:44 +01:00
|
|
|
public:
|
|
|
|
typedef std::map<string, Path> Outputs;
|
|
|
|
|
2006-02-08 14:21:16 +01:00
|
|
|
private:
|
2013-11-19 14:09:03 +01:00
|
|
|
EvalState * state;
|
|
|
|
|
2006-02-08 14:21:16 +01:00
|
|
|
string drvPath;
|
|
|
|
string outPath;
|
2012-11-26 17:39:09 +01:00
|
|
|
string outputName;
|
2012-11-28 13:49:44 +01:00
|
|
|
Outputs outputs;
|
2010-04-19 14:10:04 +02:00
|
|
|
|
2012-07-11 16:14:06 +02:00
|
|
|
bool failed; // set if we get an AssertionError
|
2012-11-28 13:49:44 +01:00
|
|
|
|
2013-11-19 14:09:03 +01:00
|
|
|
Bindings * attrs, * meta;
|
|
|
|
|
|
|
|
Bindings * getMeta();
|
|
|
|
|
2013-11-19 14:29:39 +01:00
|
|
|
bool checkMeta(Value & v);
|
|
|
|
|
2006-02-08 14:21:16 +01:00
|
|
|
public:
|
|
|
|
string name;
|
2006-07-25 18:40:38 +02:00
|
|
|
string attrPath; /* path towards the derivation */
|
2006-02-08 14:21:16 +01:00
|
|
|
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();
|
2006-02-08 14:21:16 +01:00
|
|
|
|
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);
|
2010-04-19 14:10:04 +02:00
|
|
|
|
2013-11-19 14:09:03 +01:00
|
|
|
/*
|
2006-03-10 17:20:42 +01:00
|
|
|
MetaInfo queryMetaInfo(EvalState & state) const;
|
2009-06-30 17:53:39 +02:00
|
|
|
MetaValue queryMetaInfo(EvalState & state, const string & name) const;
|
2013-11-19 14:09:03 +01:00
|
|
|
*/
|
2006-02-08 14:21:16 +01:00
|
|
|
|
|
|
|
void setDrvPath(const string & s)
|
|
|
|
{
|
|
|
|
drvPath = s;
|
|
|
|
}
|
2012-11-28 13:49:44 +01:00
|
|
|
|
2006-02-08 14:21:16 +01:00
|
|
|
void setOutPath(const string & s)
|
|
|
|
{
|
|
|
|
outPath = s;
|
|
|
|
}
|
2007-02-02 02:52:42 +01:00
|
|
|
|
2012-07-11 16:14:06 +02:00
|
|
|
void setFailed() { failed = true; };
|
|
|
|
bool hasFailed() { return failed; };
|
2006-02-08 14:21:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-11-25 14:47:34 +01:00
|
|
|
#if HAVE_BOEHMGC
|
|
|
|
typedef list<DrvInfo, traceable_allocator<DrvInfo> > DrvInfos;
|
|
|
|
#else
|
2006-02-08 14:21:16 +01:00
|
|
|
typedef list<DrvInfo> DrvInfos;
|
2010-11-25 14:47:34 +01:00
|
|
|
#endif
|
2006-02-08 14:21:16 +01:00
|
|
|
|
|
|
|
|
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. */
|
2012-10-04 21:22:25 +02:00
|
|
|
bool getDerivation(EvalState & state, Value & v, DrvInfo & drv,
|
|
|
|
bool ignoreAssertionFailures);
|
2006-02-08 14:21:16 +01:00
|
|
|
|
2010-03-31 17:38:03 +02:00
|
|
|
void getDerivations(EvalState & state, Value & v, const string & pathPrefix,
|
2012-10-04 21:22:25 +02:00
|
|
|
Bindings & autoArgs, DrvInfos & drvs,
|
|
|
|
bool ignoreAssertionFailures);
|
2006-02-08 14:21:16 +01:00
|
|
|
|
2012-11-28 13:49:44 +01:00
|
|
|
|
2006-09-04 23:06:23 +02:00
|
|
|
}
|