diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-03-23T13·07+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-03-23T13·07+0000 |
commit | 3f236f01ae7e9abe58a591071698a9a9840af7c2 (patch) | |
tree | fe2226d88b57ab9362016e610365dd2719f64262 /src/nix-store/main.cc | |
parent | a04c62e0c4f0f8d3bd9cda21173a0193be9eda8a (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.cc | 25 |
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(); } |