aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build.hh
blob: 52e7c9b9d5dea6866581716762646fedb9054525 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef __BUILD_H
#define __BUILD_H

#include "derivations.hh"

/* Ensure that the output paths of the derivation are valid.  If they
   are already valid, this is a no-op.  Otherwise, validity can
   be reached in two ways.  First, if the output paths have
   substitutes, then those can be used.  Second, the output paths can
   be created by running the builder, after recursively building any
   sub-derivations. */
void buildDerivations(const PathSet & drvPaths);

/* Ensure that a path is valid.  If it is not currently valid, it may
   be made valid by running a substitute (if defined for the path). */
void ensurePath(const Path & storePath);

/* Read a derivation, after ensuring its existence through
   ensurePath(). */
Derivation derivationFromPath(const Path & drvPath);

/* Place in `paths' the set of all store paths in the file system
   closure of `storePath'; that is, all paths than can be directly or
   indirectly reached from it.  `paths' is not cleared.  If
   `flipDirection' is true, the set of paths that can reach
   `storePath' is returned; that is, the closures under the `referers'
   relation instead of the `references' relation is returned. */
void computeFSClosure(const Path & storePath,
    PathSet & paths, bool flipDirection = false);

/* Place in `paths' the set of paths that are required to `realise'
   the given store path, i.e., all paths necessary for valid
   deployment of the path.  For a derivation, this is the union of
   requisites of the inputs, plus the derivation; for other store
   paths, it is the set of paths in the FS closure of the path.  If
   `includeOutputs' is true, include the requisites of the output
   paths of derivations as well.

   Note that this function can be used to implement three different
   deployment policies:

   - Source deployment (when called on a derivation).
   - Binary deployment (when called on an output path).
   - Source/binary deployment (when called on a derivation with
     `includeOutputs' set to true).
*/
void storePathRequisites(const Path & storePath,
    bool includeOutputs, PathSet & paths);

#endif /* !__BUILD_H */