2012-07-18 21:59:03 +03:00
|
|
|
#pragma once
|
2006-02-08 15:21:16 +02:00
|
|
|
|
2010-10-04 20:55:38 +03:00
|
|
|
#include "eval.hh"
|
|
|
|
|
2006-02-08 15:21:16 +02:00
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
|
2006-05-02 20:12:03 +03:00
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
2006-02-08 15:21:16 +02:00
|
|
|
|
2006-09-05 00:06:23 +03:00
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
|
2009-06-30 18:53:39 +03:00
|
|
|
struct MetaValue
|
|
|
|
{
|
|
|
|
enum { tpNone, tpString, tpStrings, tpInt } type;
|
|
|
|
string stringValue;
|
|
|
|
Strings stringValues;
|
|
|
|
int intValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef std::map<string, MetaValue> MetaInfo;
|
2006-03-10 18:20:42 +02:00
|
|
|
|
|
|
|
|
2006-02-08 15:21:16 +02:00
|
|
|
struct DrvInfo
|
|
|
|
{
|
2012-11-28 14:49:44 +02:00
|
|
|
public:
|
|
|
|
typedef std::map<string, Path> Outputs;
|
|
|
|
|
2006-02-08 15:21:16 +02:00
|
|
|
private:
|
|
|
|
string drvPath;
|
|
|
|
string outPath;
|
2012-11-26 18:39:09 +02:00
|
|
|
string outputName;
|
2012-11-28 14:49:44 +02:00
|
|
|
Outputs outputs;
|
2010-04-19 15:10:04 +03:00
|
|
|
|
|
|
|
bool metaInfoRead;
|
|
|
|
MetaInfo meta;
|
2012-07-11 17:14:06 +03:00
|
|
|
|
|
|
|
bool failed; // set if we get an AssertionError
|
2012-11-28 14:49:44 +02:00
|
|
|
|
2006-02-08 15:21:16 +02:00
|
|
|
public:
|
|
|
|
string name;
|
2006-07-25 19:40:38 +03:00
|
|
|
string attrPath; /* path towards the derivation */
|
2006-02-08 15:21:16 +02:00
|
|
|
string system;
|
|
|
|
|
2010-03-31 18:38:03 +03:00
|
|
|
/* !!! make this private */
|
|
|
|
Bindings * attrs;
|
2006-02-08 15:21:16 +02:00
|
|
|
|
2012-07-11 17:14:06 +03:00
|
|
|
DrvInfo() : metaInfoRead(false), failed(false), attrs(0) { };
|
2010-04-19 15:10:04 +03:00
|
|
|
|
2006-03-10 18:20:42 +02:00
|
|
|
string queryDrvPath(EvalState & state) const;
|
|
|
|
string queryOutPath(EvalState & state) const;
|
2012-11-26 18:39:09 +02:00
|
|
|
string queryOutputName(EvalState & state) const;
|
2012-11-28 14:49:44 +02:00
|
|
|
Outputs queryOutputs(EvalState & state);
|
2006-03-10 18:20:42 +02:00
|
|
|
MetaInfo queryMetaInfo(EvalState & state) const;
|
2009-06-30 18:53:39 +03:00
|
|
|
MetaValue queryMetaInfo(EvalState & state, const string & name) const;
|
2006-02-08 15:21:16 +02:00
|
|
|
|
|
|
|
void setDrvPath(const string & s)
|
|
|
|
{
|
|
|
|
drvPath = s;
|
|
|
|
}
|
2012-11-28 14:49:44 +02:00
|
|
|
|
2006-02-08 15:21:16 +02:00
|
|
|
void setOutPath(const string & s)
|
|
|
|
{
|
|
|
|
outPath = s;
|
|
|
|
}
|
2007-02-02 03:52:42 +02:00
|
|
|
|
|
|
|
void setMetaInfo(const MetaInfo & meta);
|
2012-07-11 17:14:06 +03:00
|
|
|
|
|
|
|
void setFailed() { failed = true; };
|
|
|
|
bool hasFailed() { return failed; };
|
2006-02-08 15:21:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-11-25 15:47:34 +02:00
|
|
|
#if HAVE_BOEHMGC
|
|
|
|
typedef list<DrvInfo, traceable_allocator<DrvInfo> > DrvInfos;
|
|
|
|
#else
|
2006-02-08 15:21:16 +02:00
|
|
|
typedef list<DrvInfo> DrvInfos;
|
2010-11-25 15:47:34 +02:00
|
|
|
#endif
|
2006-02-08 15:21:16 +02:00
|
|
|
|
|
|
|
|
2010-03-31 18:38:03 +03:00
|
|
|
/* If value `v' denotes a derivation, store information about the
|
|
|
|
derivation in `drv' and return true. Otherwise, return false. */
|
2012-10-04 22:22:25 +03:00
|
|
|
bool getDerivation(EvalState & state, Value & v, DrvInfo & drv,
|
|
|
|
bool ignoreAssertionFailures);
|
2006-02-08 15:21:16 +02:00
|
|
|
|
2010-03-31 18:38:03 +03:00
|
|
|
void getDerivations(EvalState & state, Value & v, const string & pathPrefix,
|
2012-10-04 22:22:25 +03:00
|
|
|
Bindings & autoArgs, DrvInfos & drvs,
|
|
|
|
bool ignoreAssertionFailures);
|
2006-02-08 15:21:16 +02:00
|
|
|
|
2012-11-28 14:49:44 +02:00
|
|
|
|
2006-09-05 00:06:23 +03:00
|
|
|
}
|