about summary refs log tree commit diff
path: root/src/nix-store/main.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-03-23T13·07+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-03-23T13·07+0000
commit3f236f01ae7e9abe58a591071698a9a9840af7c2 (patch)
treefe2226d88b57ab9362016e610365dd2719f64262 /src/nix-store/main.cc
parenta04c62e0c4f0f8d3bd9cda21173a0193be9eda8a (diff)
* `nix-store --register-validity': allow a path to refer to a path
  listed later in the list of new valid paths.

Diffstat (limited to 'src/nix-store/main.cc')
-rw-r--r--src/nix-store/main.cc25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/nix-store/main.cc b/src/nix-store/main.cc
index 956cbb4fbbe4..42783e108a2f 100644
--- a/src/nix-store/main.cc
+++ b/src/nix-store/main.cc
@@ -405,31 +405,32 @@ static void opRegisterValidity(Strings opFlags, Strings opArgs)
     if (!opFlags.empty()) throw UsageError("unknown flag");
     if (!opArgs.empty()) throw UsageError("no arguments expected");
 
-    Transaction txn;
-    createStoreTransaction(txn);
-
+    ValidPathInfos infos;
+    
     while (1) {
-        Path path;
-        Path deriver;
-        PathSet references;
-        getline(cin, path);
+        ValidPathInfo info;
+        getline(cin, info.path);
         if (cin.eof()) break;
-        getline(cin, deriver);
+        getline(cin, info.deriver);
         string s; int n;
         getline(cin, s);
         if (!string2Int(s, n)) throw Error("number expected");
         while (n--) {
             getline(cin, s);
-            references.insert(s);
+            info.references.insert(s);
         }
         if (!cin || cin.eof()) throw Error("missing input");
-        if (!isValidPathTxn(txn, path)) {
+        if (!isValidPath(info.path)) {
             /* !!! races */
-            canonicalisePathMetaData(path);
-            registerValidPath(txn, path, hashPath(htSHA256, path), references, deriver);
+            canonicalisePathMetaData(info.path);
+            info.hash = hashPath(htSHA256, info.path);
+            infos.push_back(info);
         }
     }
 
+    Transaction txn;
+    createStoreTransaction(txn);
+    registerValidPaths(txn, infos);
     txn.commit();
 }