2003-07-14 13:23:11 +03:00
|
|
|
#ifndef __FSTATE_H
|
|
|
|
#define __FSTATE_H
|
2003-06-16 16:33:38 +03:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include <aterm2.h>
|
|
|
|
}
|
|
|
|
|
2003-07-15 19:28:54 +03:00
|
|
|
#include "store.hh"
|
2003-06-16 16:33:38 +03:00
|
|
|
|
|
|
|
|
2003-07-20 22:29:38 +03:00
|
|
|
/* Abstract syntax of fstate-expressions. */
|
2003-06-27 12:55:31 +03:00
|
|
|
|
2003-07-15 19:28:54 +03:00
|
|
|
typedef list<FSId> FSIds;
|
|
|
|
|
|
|
|
struct SliceElem
|
|
|
|
{
|
|
|
|
string path;
|
|
|
|
FSId id;
|
* Change the abstract syntax of slices. It used to be that ids were used as
keys to reference slice elements, e.g.,
Slice(["1ef7..."], [("/nix/store/1ef7...-foo", "1ef7", ["8c99..."]), ...])
This was wrong, since ids represent contents, not locations. Therefore we
now have:
Slice(["/nix/store/1ef7..."], [("/nix/store/1ef7...-foo", "1ef7", ["/nix/store/8c99-..."]), ...])
* Fix a bug in the computation of slice closures that could cause slice
elements to be duplicated.
2003-08-20 15:39:56 +03:00
|
|
|
Strings refs;
|
2003-07-15 19:28:54 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef list<SliceElem> SliceElems;
|
|
|
|
|
|
|
|
struct Slice
|
|
|
|
{
|
* Change the abstract syntax of slices. It used to be that ids were used as
keys to reference slice elements, e.g.,
Slice(["1ef7..."], [("/nix/store/1ef7...-foo", "1ef7", ["8c99..."]), ...])
This was wrong, since ids represent contents, not locations. Therefore we
now have:
Slice(["/nix/store/1ef7..."], [("/nix/store/1ef7...-foo", "1ef7", ["/nix/store/8c99-..."]), ...])
* Fix a bug in the computation of slice closures that could cause slice
elements to be duplicated.
2003-08-20 15:39:56 +03:00
|
|
|
Strings roots;
|
2003-07-15 19:28:54 +03:00
|
|
|
SliceElems elems;
|
|
|
|
};
|
2003-06-16 16:33:38 +03:00
|
|
|
|
2003-07-20 22:29:38 +03:00
|
|
|
typedef pair<string, FSId> DeriveOutput;
|
|
|
|
typedef pair<string, string> StringPair;
|
|
|
|
typedef list<DeriveOutput> DeriveOutputs;
|
|
|
|
typedef list<StringPair> StringPairs;
|
|
|
|
|
|
|
|
struct Derive
|
|
|
|
{
|
|
|
|
DeriveOutputs outputs;
|
|
|
|
FSIds inputs;
|
|
|
|
string platform;
|
2003-08-15 15:32:37 +03:00
|
|
|
string builder;
|
|
|
|
Strings args;
|
2003-07-20 22:29:38 +03:00
|
|
|
StringPairs env;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FState
|
|
|
|
{
|
|
|
|
enum { fsSlice, fsDerive } type;
|
|
|
|
Slice slice;
|
|
|
|
Derive derive;
|
|
|
|
};
|
|
|
|
|
2003-07-15 19:28:54 +03:00
|
|
|
|
2003-06-17 16:37:44 +03:00
|
|
|
/* Return a canonical textual representation of an expression. */
|
2003-06-27 16:55:12 +03:00
|
|
|
string printTerm(ATerm t);
|
2003-06-18 15:36:12 +03:00
|
|
|
|
2003-07-06 17:20:47 +03:00
|
|
|
/* Throw an exception with an error message containing the given
|
|
|
|
aterm. */
|
|
|
|
Error badTerm(const format & f, ATerm t);
|
|
|
|
|
2003-06-27 16:55:12 +03:00
|
|
|
/* Hash an aterm. */
|
|
|
|
Hash hashTerm(ATerm t);
|
2003-06-16 16:33:38 +03:00
|
|
|
|
2003-07-15 19:28:54 +03:00
|
|
|
/* Read an aterm from disk, given its id. */
|
2003-07-20 22:29:38 +03:00
|
|
|
ATerm termFromId(const FSId & id);
|
2003-07-08 16:22:08 +03:00
|
|
|
|
2003-07-06 17:20:47 +03:00
|
|
|
/* Write an aterm to the Nix store directory, and return its hash. */
|
2003-07-21 23:07:12 +03:00
|
|
|
FSId writeTerm(ATerm t, const string & suffix, FSId id = FSId());
|
2003-07-10 21:48:11 +03:00
|
|
|
|
2003-07-20 22:29:38 +03:00
|
|
|
/* Parse an fstate-expression. */
|
|
|
|
FState parseFState(ATerm t);
|
2003-07-16 14:05:59 +03:00
|
|
|
|
2003-07-20 22:29:38 +03:00
|
|
|
/* Parse an fstate-expression. */
|
|
|
|
ATerm unparseFState(const FState & fs);
|
2003-07-16 01:28:27 +03:00
|
|
|
|
2003-06-16 16:33:38 +03:00
|
|
|
|
2003-07-14 13:23:11 +03:00
|
|
|
#endif /* !__FSTATE_H */
|