1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 04:21:16 +02:00

* Pass HashType values instead of strings.

This commit is contained in:
Eelco Dolstra 2008-12-03 16:10:17 +00:00
parent 1307b22223
commit ff762fb499
11 changed files with 36 additions and 23 deletions

View file

@ -183,20 +183,21 @@ Path makeStorePath(const string & type,
Path makeFixedOutputPath(bool recursive,
string hashAlgo, Hash hash, string name)
HashType hashAlgo, Hash hash, string name)
{
return hashAlgo == "sha256" && recursive
return hashAlgo == htSHA256 && recursive
? makeStorePath("source", hash, name)
: makeStorePath("output:out", hashString(htSHA256,
"fixed:out:" + (recursive ? (string) "r:" : "") + hashAlgo + ":" + printHash(hash) + ":"),
"fixed:out:" + (recursive ? (string) "r:" : "") +
printHashType(hashAlgo) + ":" + printHash(hash) + ":"),
name);
}
std::pair<Path, Hash> computeStorePathForPath(const Path & srcPath,
bool recursive, string hashAlgo, PathFilter & filter)
bool recursive, HashType hashAlgo, PathFilter & filter)
{
HashType ht(parseHashType(hashAlgo));
HashType ht(hashAlgo);
Hash h = recursive ? hashPath(ht, srcPath, filter) : hashFile(ht, srcPath);
string name = baseNameOf(srcPath);
Path dstPath = makeFixedOutputPath(recursive, hashAlgo, h, name);