about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-11-30T18·02+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-11-30T18·02+0000
commit6ecb840fd118019f879de60007e13321b7c080d3 (patch)
tree29f9db5fbf0da0b3e08af282db1a0fedba81decf /src/libstore
parente2ef5e07fdc142670f7f3161d3133ff04e99d342 (diff)
* Put building in the store API.
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/Makefile.am2
-rw-r--r--src/libstore/build.cc5
-rw-r--r--src/libstore/build.hh30
-rw-r--r--src/libstore/globals.hh1
-rw-r--r--src/libstore/local-store.hh7
-rw-r--r--src/libstore/misc.cc3
-rw-r--r--src/libstore/store-api.hh13
7 files changed, 24 insertions, 37 deletions
diff --git a/src/libstore/Makefile.am b/src/libstore/Makefile.am
index 209a1e69291c..4d25c2d68961 100644
--- a/src/libstore/Makefile.am
+++ b/src/libstore/Makefile.am
@@ -5,7 +5,7 @@ libstore_la_SOURCES = \
  db.cc references.cc pathlocks.cc gc.cc 
 
 pkginclude_HEADERS = \
- store-api.hh local-store.cc derivations.hh build.hh misc.hh globals.hh \
+ store-api.hh local-store.cc derivations.hh misc.hh globals.hh \
  db.hh references.hh pathlocks.hh gc.hh 
 
 libstore_la_LIBADD = ../libutil/libutil.la ../boost/format/libformat.la
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index a78d5010cb66..54c48cf91fc7 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1,4 +1,3 @@
-#include "build.hh"
 #include "references.hh"
 #include "pathlocks.hh"
 #include "misc.hh"
@@ -2195,7 +2194,7 @@ void Worker::waitForInput()
 //////////////////////////////////////////////////////////////////////
 
 
-void buildDerivations(const PathSet & drvPaths)
+void LocalStore::buildDerivations(const PathSet & drvPaths)
 {
     startNest(nest, lvlDebug,
         format("building %1%") % showPaths(drvPaths));
@@ -2222,7 +2221,7 @@ void buildDerivations(const PathSet & drvPaths)
 }
 
 
-void ensurePath(const Path & path)
+void LocalStore::ensurePath(const Path & path)
 {
     /* If the path is already valid, we're done. */
     if (store->isValidPath(path)) return;
diff --git a/src/libstore/build.hh b/src/libstore/build.hh
deleted file mode 100644
index 71895c0a9c32..000000000000
--- a/src/libstore/build.hh
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef __BUILD_H
-#define __BUILD_H
-
-
-#include "types.hh"
-
-
-namespace nix {
-
-    
-extern string drvsLogDir;
-
-
-/* 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);
-
-    
-}
-
-
-#endif /* !__BUILD_H */
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index 9441dc344a73..b93f5d62c1ef 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -33,7 +33,6 @@ extern string nixConfDir;
 extern string nixLibexecDir;
 
 
-
 /* Misc. global flags. */
 
 /* Whether to keep temporary directories of failed builds. */
diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh
index 2fd45cd7a521..e41e4368397f 100644
--- a/src/libstore/local-store.hh
+++ b/src/libstore/local-store.hh
@@ -18,6 +18,9 @@ class Transaction;
 const int nixSchemaVersion = 3;
 
 
+extern string drvsLogDir;
+
+
 class LocalStore : public StoreAPI
 {
 public:
@@ -56,6 +59,10 @@ public:
     Path addTextToStore(const string & suffix, const string & s,
         const PathSet & references);
 
+    void buildDerivations(const PathSet & drvPaths);
+
+    void ensurePath(const Path & storePath);
+
 private:
     Path _addToStore(bool fixed, bool recursive,
         string hashAlgo, const Path & _srcPath);
diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc
index b442bd4c2157..6849e2c1a64c 100644
--- a/src/libstore/misc.cc
+++ b/src/libstore/misc.cc
@@ -1,6 +1,5 @@
 #include "misc.hh"
 #include "store-api.hh"
-#include "build.hh"
 #include "db.hh"
 
 #include <aterm2.h>
@@ -12,7 +11,7 @@ namespace nix {
 Derivation derivationFromPath(const Path & drvPath)
 {
     assertStorePath(drvPath);
-    ensurePath(drvPath);
+    store->ensurePath(drvPath);
     ATerm t = ATreadFromNamedFile(drvPath.c_str());
     if (!t) throw Error(format("cannot read aterm from `%1%'") % drvPath);
     return parseDerivation(t);
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh
index 91beba50f7d2..abf27a346f31 100644
--- a/src/libstore/store-api.hh
+++ b/src/libstore/store-api.hh
@@ -72,6 +72,19 @@ public:
        a regular file containing the given string. */
     virtual Path addTextToStore(const string & suffix, const string & s,
         const PathSet & references) = 0;
+
+    /* 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. */
+    virtual void buildDerivations(const PathSet & drvPaths) = 0;
+
+    /* 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). */
+    virtual void ensurePath(const Path & storePath) = 0;
 };