2006-02-08 14:21:16 +01:00
|
|
|
#ifndef __GET_DRVS_H
|
|
|
|
#define __GET_DRVS_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
|
2006-05-02 19:12:03 +02:00
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
2006-02-08 14:21:16 +01:00
|
|
|
#include "eval.hh"
|
|
|
|
|
|
|
|
|
2006-09-04 23:06:23 +02:00
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
|
|
|
|
typedef std::map<string, string> MetaInfo;
|
2006-03-10 17:20:42 +01:00
|
|
|
|
|
|
|
|
2006-02-08 14:21:16 +01:00
|
|
|
struct DrvInfo
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
string drvPath;
|
|
|
|
string outPath;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2007-02-02 02:52:42 +01:00
|
|
|
/* !!! these should really be hidden, and setMetaInfo() should
|
|
|
|
make a copy since the ATermMap can be shared between multiple
|
|
|
|
DrvInfos. */
|
2006-09-04 23:06:23 +02:00
|
|
|
boost::shared_ptr<ATermMap> attrs;
|
2006-02-08 14:21:16 +01:00
|
|
|
|
2006-03-10 17:20:42 +01:00
|
|
|
string queryDrvPath(EvalState & state) const;
|
|
|
|
string queryOutPath(EvalState & state) const;
|
|
|
|
MetaInfo queryMetaInfo(EvalState & state) const;
|
2007-05-01 22:33:18 +02:00
|
|
|
string queryMetaInfo(EvalState & state, const string & name) const;
|
2006-02-08 14:21:16 +01:00
|
|
|
|
|
|
|
void setDrvPath(const string & s)
|
|
|
|
{
|
|
|
|
drvPath = s;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setOutPath(const string & s)
|
|
|
|
{
|
|
|
|
outPath = s;
|
|
|
|
}
|
2007-02-02 02:52:42 +01:00
|
|
|
|
|
|
|
void setMetaInfo(const MetaInfo & meta);
|
2006-02-08 14:21:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef list<DrvInfo> DrvInfos;
|
|
|
|
|
|
|
|
|
|
|
|
/* Evaluate expression `e'. If it evaluates to a derivation, store
|
|
|
|
information about the derivation in `drv' and return true.
|
|
|
|
Otherwise, return false. */
|
|
|
|
bool getDerivation(EvalState & state, Expr e, DrvInfo & drv);
|
|
|
|
|
2006-07-26 17:05:15 +02:00
|
|
|
void getDerivations(EvalState & state, Expr e, const string & pathPrefix,
|
2006-07-28 18:03:28 +02:00
|
|
|
const ATermMap & autoArgs, DrvInfos & drvs);
|
2006-02-08 14:21:16 +01:00
|
|
|
|
2006-09-04 23:06:23 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-02-08 14:21:16 +01:00
|
|
|
|
|
|
|
#endif /* !__GET_DRVS_H */
|