mirror of
https://github.com/NixOS/nix
synced 2025-07-06 05:01:48 +02:00
* `nix-store --register-validity': allow a path to refer to a path
listed later in the list of new valid paths.
This commit is contained in:
parent
a04c62e0c4
commit
3f236f01ae
3 changed files with 62 additions and 24 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue