2006-02-08 13:21:16 +00:00
|
|
|
#ifndef __GET_DRVS_H
|
|
|
|
#define __GET_DRVS_H
|
|
|
|
|
2010-10-04 17:55:38 +00:00
|
|
|
#include "eval.hh"
|
|
|
|
|
2006-02-08 13:21:16 +00:00
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
|
2006-05-02 17:12:03 +00:00
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
2006-02-08 13:21:16 +00:00
|
|
|
|
2006-09-04 21:06:23 +00:00
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
|
2009-06-30 15:53:39 +00:00
|
|
|
struct MetaValue
|
|
|
|
{
|
|
|
|
enum { tpNone, tpString, tpStrings, tpInt } type;
|
|
|
|
string stringValue;
|
|
|
|
Strings stringValues;
|
|
|
|
int intValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef std::map<string, MetaValue> MetaInfo;
|
2006-03-10 16:20:42 +00:00
|
|
|
|
|
|
|
|
2006-02-08 13:21:16 +00:00
|
|
|
struct DrvInfo
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
string drvPath;
|
|
|
|
string outPath;
|
2010-04-19 12:10:04 +00:00
|
|
|
|
|
|
|
bool metaInfoRead;
|
|
|
|
MetaInfo meta;
|
2006-02-08 13:21:16 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
string name;
|
2006-07-25 16:40:38 +00:00
|
|
|
string attrPath; /* path towards the derivation */
|
2006-02-08 13:21:16 +00:00
|
|
|
string system;
|
|
|
|
|
2010-03-31 15:38:03 +00:00
|
|
|
/* !!! make this private */
|
|
|
|
Bindings * attrs;
|
2006-02-08 13:21:16 +00:00
|
|
|
|
2010-04-21 15:08:58 +00:00
|
|
|
DrvInfo() : metaInfoRead(false), attrs(0) { };
|
2010-04-19 12:10:04 +00:00
|
|
|
|
2006-03-10 16:20:42 +00:00
|
|
|
string queryDrvPath(EvalState & state) const;
|
|
|
|
string queryOutPath(EvalState & state) const;
|
|
|
|
MetaInfo queryMetaInfo(EvalState & state) const;
|
2009-06-30 15:53:39 +00:00
|
|
|
MetaValue queryMetaInfo(EvalState & state, const string & name) const;
|
2006-02-08 13:21:16 +00:00
|
|
|
|
|
|
|
void setDrvPath(const string & s)
|
|
|
|
{
|
|
|
|
drvPath = s;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setOutPath(const string & s)
|
|
|
|
{
|
|
|
|
outPath = s;
|
|
|
|
}
|
2007-02-02 01:52:42 +00:00
|
|
|
|
|
|
|
void setMetaInfo(const MetaInfo & meta);
|
2006-02-08 13:21:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-11-25 13:47:34 +00:00
|
|
|
#if HAVE_BOEHMGC
|
|
|
|
typedef list<DrvInfo, traceable_allocator<DrvInfo> > DrvInfos;
|
|
|
|
#else
|
2006-02-08 13:21:16 +00:00
|
|
|
typedef list<DrvInfo> DrvInfos;
|
2010-11-25 13:47:34 +00:00
|
|
|
#endif
|
2006-02-08 13:21:16 +00:00
|
|
|
|
|
|
|
|
2010-03-31 15:38:03 +00: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);
|
2006-02-08 13:21:16 +00:00
|
|
|
|
2010-03-31 15:38:03 +00:00
|
|
|
void getDerivations(EvalState & state, Value & v, const string & pathPrefix,
|
2010-10-22 14:47:42 +00:00
|
|
|
Bindings & autoArgs, DrvInfos & drvs);
|
2006-02-08 13:21:16 +00:00
|
|
|
|
2006-09-04 21:06:23 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-02-08 13:21:16 +00:00
|
|
|
|
|
|
|
#endif /* !__GET_DRVS_H */
|