2003-11-18 06:22:29 -05:00
|
|
|
#ifndef __STOREEXPR_H
|
|
|
|
#define __STOREEXPR_H
|
2003-06-16 09:33:38 -04:00
|
|
|
|
2003-11-16 12:46:31 -05:00
|
|
|
#include "aterm.hh"
|
2003-07-15 12:28:54 -04:00
|
|
|
#include "store.hh"
|
2003-06-16 09:33:38 -04:00
|
|
|
|
|
|
|
|
2003-11-18 06:22:29 -05:00
|
|
|
/* Abstract syntax of store expressions. */
|
2003-06-27 05:55:31 -04:00
|
|
|
|
2003-10-07 08:27:49 -04:00
|
|
|
struct ClosureElem
|
2003-07-15 12:28:54 -04:00
|
|
|
{
|
2003-10-08 11:06:59 -04:00
|
|
|
PathSet refs;
|
2003-07-15 12:28:54 -04:00
|
|
|
};
|
|
|
|
|
2003-10-08 11:06:59 -04:00
|
|
|
typedef map<Path, ClosureElem> ClosureElems;
|
2003-07-15 12:28:54 -04:00
|
|
|
|
2003-10-07 08:27:49 -04:00
|
|
|
struct Closure
|
2003-07-15 12:28:54 -04:00
|
|
|
{
|
2003-10-08 11:06:59 -04:00
|
|
|
PathSet roots;
|
2003-10-07 08:27:49 -04:00
|
|
|
ClosureElems elems;
|
2003-07-15 12:28:54 -04:00
|
|
|
};
|
2003-06-16 09:33:38 -04:00
|
|
|
|
2003-08-20 10:11:40 -04:00
|
|
|
typedef map<string, string> StringPairs;
|
2003-07-20 15:29:38 -04:00
|
|
|
|
2003-10-07 08:27:49 -04:00
|
|
|
struct Derivation
|
2003-07-20 15:29:38 -04:00
|
|
|
{
|
2003-10-08 11:06:59 -04:00
|
|
|
PathSet outputs;
|
2003-11-18 06:22:29 -05:00
|
|
|
PathSet inputs; /* Store expressions, not actual inputs */
|
2003-07-20 15:29:38 -04:00
|
|
|
string platform;
|
2003-10-08 11:06:59 -04:00
|
|
|
Path builder;
|
2003-08-15 08:32:37 -04:00
|
|
|
Strings args;
|
2003-07-20 15:29:38 -04:00
|
|
|
StringPairs env;
|
|
|
|
};
|
|
|
|
|
2003-11-18 06:22:29 -05:00
|
|
|
struct StoreExpr
|
2003-07-20 15:29:38 -04:00
|
|
|
{
|
2003-10-07 08:27:49 -04:00
|
|
|
enum { neClosure, neDerivation } type;
|
|
|
|
Closure closure;
|
|
|
|
Derivation derivation;
|
2003-07-20 15:29:38 -04:00
|
|
|
};
|
|
|
|
|
2003-07-15 12:28:54 -04:00
|
|
|
|
2003-06-27 09:55:12 -04:00
|
|
|
/* Hash an aterm. */
|
|
|
|
Hash hashTerm(ATerm t);
|
2003-06-16 09:33:38 -04:00
|
|
|
|
2003-10-08 11:06:59 -04:00
|
|
|
/* Write an aterm to the Nix store directory, and return its path. */
|
|
|
|
Path writeTerm(ATerm t, const string & suffix);
|
2003-07-10 14:48:11 -04:00
|
|
|
|
2003-11-18 06:22:29 -05:00
|
|
|
/* Parse a store expression. */
|
|
|
|
StoreExpr parseStoreExpr(ATerm t);
|
2003-07-16 07:05:59 -04:00
|
|
|
|
2003-11-18 06:22:29 -05:00
|
|
|
/* Parse a store expression. */
|
|
|
|
ATerm unparseStoreExpr(const StoreExpr & ne);
|
2003-07-15 18:28:27 -04:00
|
|
|
|
2003-06-16 09:33:38 -04:00
|
|
|
|
2003-11-18 06:22:29 -05:00
|
|
|
#endif /* !__STOREEXPR_H */
|