about summary refs log tree commit diff
path: root/src/store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-10-16T16·29+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-10-16T16·29+0000
commit0791282b2f42313c94dd9bc85b24428e585cd099 (patch)
tree38cb57ffea3c700aeed5836afd7927369782d315 /src/store.cc
parentab5e8767fafb2d62213e3f1558ead2882bc65c05 (diff)
* Substitutes and nix-pull now work again.
* Fixed a segfault caused by the buffering of stderr.
* Fix now allows the specification of the full output path.  This
  should be used with great care, since it by-passes the normal hash
  generation.
* Incremented the version number to 0.4 (prerelease).

Diffstat (limited to 'src/store.cc')
-rw-r--r--src/store.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/store.cc b/src/store.cc
index 7f10c6377dc6..2d223313b612 100644
--- a/src/store.cc
+++ b/src/store.cc
@@ -175,7 +175,8 @@ void registerSuccessor(const Transaction & txn,
 
     Paths revs;
     nixDB.queryStrings(txn, dbSuccessorsRev, sucPath, revs);
-    revs.push_back(srcPath);
+    if (find(revs.begin(), revs.end(), srcPath) == revs.end())
+        revs.push_back(srcPath);
 
     nixDB.setString(txn, dbSuccessors, srcPath, sucPath);
     nixDB.setStrings(txn, dbSuccessorsRev, sucPath, revs);
@@ -212,7 +213,8 @@ void registerSubstitute(const Path & srcPath, const Path & subPath)
 
     Paths revs;
     nixDB.queryStrings(txn, dbSubstitutesRev, subPath, revs);
-    revs.push_back(srcPath);
+    if (find(revs.begin(), revs.end(), srcPath) == revs.end())
+        revs.push_back(srcPath);
     
     nixDB.setStrings(txn, dbSubstitutes, srcPath, subs);
     nixDB.setStrings(txn, dbSubstitutesRev, subPath, revs);
@@ -221,6 +223,14 @@ void registerSubstitute(const Path & srcPath, const Path & subPath)
 }
 
 
+Paths querySubstitutes(const Path & srcPath)
+{
+    Paths subPaths;
+    nixDB.queryStrings(noTxn, dbSubstitutes, srcPath, subPaths);
+    return subPaths;
+}
+
+
 void registerValidPath(const Transaction & txn, const Path & _path)
 {
     Path path(canonPath(_path));