about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/fix.cc4
-rw-r--r--src/fstate.cc (renamed from src/eval.cc)4
-rw-r--r--src/fstate.hh (renamed from src/eval.hh)0
-rw-r--r--src/nix.cc4
-rw-r--r--src/store.cc (renamed from src/values.cc)63
-rw-r--r--src/store.hh (renamed from src/values.hh)0
7 files changed, 17 insertions, 60 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 22b27d88a8a7..5488e133a142 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,7 +20,7 @@ test_LDADD = libnix.a -ldb_cxx-4 -lATerm
 noinst_LIBRARIES = libnix.a
 
 libnix_a_SOURCES = util.cc hash.cc archive.cc md5.c \
- eval.cc values.cc globals.cc db.cc
+ fstate.cc store.cc globals.cc db.cc
 
 install-data-local:
 	$(INSTALL) -d $(localstatedir)/nix
diff --git a/src/fix.cc b/src/fix.cc
index 33bcdd9a1372..fdf12ffef5fe 100644
--- a/src/fix.cc
+++ b/src/fix.cc
@@ -2,8 +2,8 @@
 #include <iostream>
 
 #include "globals.hh"
-#include "eval.hh"
-#include "values.hh"
+#include "fstate.hh"
+#include "store.hh"
 #include "shared.hh"
 
 
diff --git a/src/eval.cc b/src/fstate.cc
index 354ecb6cc7fa..8003a1b38105 100644
--- a/src/eval.cc
+++ b/src/fstate.cc
@@ -7,9 +7,9 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-#include "eval.hh"
+#include "fstate.hh"
 #include "globals.hh"
-#include "values.hh"
+#include "store.hh"
 #include "db.hh"
 
 
diff --git a/src/eval.hh b/src/fstate.hh
index b04588e7b35b..b04588e7b35b 100644
--- a/src/eval.hh
+++ b/src/fstate.hh
diff --git a/src/nix.cc b/src/nix.cc
index f2d00394f9d7..dc9d04148d14 100644
--- a/src/nix.cc
+++ b/src/nix.cc
@@ -1,8 +1,8 @@
 #include <iostream>
 
 #include "globals.hh"
-#include "values.hh"
-#include "eval.hh"
+#include "store.hh"
+#include "fstate.hh"
 #include "archive.hh"
 #include "shared.hh"
 
diff --git a/src/values.cc b/src/store.cc
index 5db04036c4de..68a1cd1e2879 100644
--- a/src/values.cc
+++ b/src/store.cc
@@ -3,7 +3,7 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 
-#include "values.hh"
+#include "store.hh"
 #include "globals.hh"
 #include "db.hh"
 #include "archive.hh"
@@ -105,28 +105,6 @@ void addToStore(string srcPath, string & dstPath, Hash & hash)
 }
 
 
-#if 0
-/* Download object referenced by the given URL into the sources
-   directory.  Return the file name it was downloaded to. */
-string fetchURL(string url)
-{
-    string filename = baseNameOf(url);
-    string fullname = nixSourcesDir + "/" + filename;
-    struct stat st;
-    if (stat(fullname.c_str(), &st)) {
-        cerr << "fetching " << url << endl;
-        /* !!! quoting */
-        string shellCmd =
-            "cd " + nixSourcesDir + " && wget --quiet -N \"" + url + "\"";
-        int res = system(shellCmd.c_str());
-        if (WEXITSTATUS(res) != 0)
-            throw Error("cannot fetch " + url);
-    }
-    return fullname;
-}
-#endif
-
-
 void deleteFromStore(const string & path)
 {
     string prefix = nixStore + "/";
@@ -139,37 +117,16 @@ void deleteFromStore(const string & path)
 
 string queryFromStore(Hash hash)
 {
-    bool checkedNet = false;
-
-    while (1) {
-
-        string fn, url;
-
-        if (queryDB(nixDB, dbRefs, hash, fn)) {
+    string fn, url;
 
-            /* Verify that the file hasn't changed. !!! race !!! slow */
-            if (hashPath(fn) != hash)
-                throw Error("file " + fn + " is stale");
-
-            return fn;
-        }
-
-        throw Error("a file with hash " + (string) hash + " is required, "
-            "but it is not known to exist locally or on the network");
-#if 0
-        if (checkedNet)
-            throw Error("consistency problem: file fetched from " + url + 
-                " should have hash " + (string) hash + ", but it doesn't");
-
-        if (!queryDB(nixDB, dbNetSources, hash, url))
-            throw Error("a file with hash " + (string) hash + " is required, "
-                "but it is not known to exist locally or on the network");
-
-        checkedNet = true;
-        
-        fn = fetchURL(url);
+    if (queryDB(nixDB, dbRefs, hash, fn)) {
         
-        setDB(nixDB, dbRefs, hash, fn);
-#endif
+        /* Verify that the file hasn't changed. !!! race !!! slow */
+        if (hashPath(fn) != hash)
+            throw Error("file " + fn + " is stale");
+
+        return fn;
     }
+
+    throw Error(format("don't know a path with hash `%1%'") % (string) hash);
 }
diff --git a/src/values.hh b/src/store.hh
index b96fa30ba8e9..b96fa30ba8e9 100644
--- a/src/values.hh
+++ b/src/store.hh