1 : #ifndef __GET_DRVS_H
2 : #define __GET_DRVS_H
3 :
4 : #include <string>
5 : #include <map>
6 :
7 : #include <boost/shared_ptr.hpp>
8 :
9 : #include "eval.hh"
10 :
11 :
12 : namespace nix {
13 :
14 :
15 : typedef std::map<string, string> MetaInfo;
16 :
17 :
18 : struct DrvInfo
19 4133 : {
20 : private:
21 : string drvPath;
22 : string outPath;
23 :
24 : public:
25 : string name;
26 : string attrPath; /* path towards the derivation */
27 : string system;
28 :
29 : /* !!! these should really be hidden, and setMetaInfo() should
30 : make a copy since the ATermMap can be shared between multiple
31 : DrvInfos. */
32 : boost::shared_ptr<ATermMap> attrs;
33 :
34 : string queryDrvPath(EvalState & state) const;
35 : string queryOutPath(EvalState & state) const;
36 : MetaInfo queryMetaInfo(EvalState & state) const;
37 : string queryMetaInfo(EvalState & state, const string & name) const;
38 :
39 0 : void setDrvPath(const string & s)
40 : {
41 0 : drvPath = s;
42 0 : }
43 :
44 8 : void setOutPath(const string & s)
45 : {
46 8 : outPath = s;
47 8 : }
48 :
49 : void setMetaInfo(const MetaInfo & meta);
50 : };
51 :
52 :
53 : typedef list<DrvInfo> DrvInfos;
54 :
55 :
56 : /* Evaluate expression `e'. If it evaluates to a derivation, store
57 : information about the derivation in `drv' and return true.
58 : Otherwise, return false. */
59 : bool getDerivation(EvalState & state, Expr e, DrvInfo & drv);
60 :
61 : void getDerivations(EvalState & state, Expr e, const string & pathPrefix,
62 : const ATermMap & autoArgs, DrvInfos & drvs);
63 :
64 :
65 : }
66 :
67 :
68 : #endif /* !__GET_DRVS_H */
|