about summary refs log tree commit diff
path: root/src/nix-store/main.cc
diff options
context:
space:
mode:
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();
 }