diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-02-22 21:14:41 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-02-22 21:14:41 +0000 |
commit | 3a2c3f0cf265075b130d9d2a25b9c8334c560b33 (patch) | |
tree | 5647390d868e6ea2607d065974ec932e5dcb47f1 /src/libexpr | |
parent | eda2c3c2537562e3b18c02a47b19e47ba3d37598 (diff) |
* Support for fixed-output hashes over directory trees (i.e., over the
NAR dump of the path).
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/primops.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index da9d1e635..a2f27b4dc 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -194,6 +194,7 @@ static Expr primDerivation(EvalState & state, const ATermVector & _args) string outputHash; string outputHashAlgo; + bool outputHashRecursive = false; for (ATermIterator i(attrs.keys()); i; ++i) { string key = aterm2String(*i); @@ -228,6 +229,11 @@ static Expr primDerivation(EvalState & state, const ATermVector & _args) else if (key == "name") drvName = s; else if (key == "outputHash") outputHash = s; else if (key == "outputHashAlgo") outputHashAlgo = s; + else if (key == "outputHashMode") { + if (s == "recursive") outputHashRecursive = true; + else if (s == "flat") outputHashRecursive = false; + else throw Error(format("invalid value `%1%' for `outputHashMode' attribute") % s); + } } } @@ -255,6 +261,7 @@ static Expr primDerivation(EvalState & state, const ATermVector & _args) h = parseHash32(ht, outputHash); string s = outputHash; outputHash = printHash(h); + if (outputHashRecursive) outputHashAlgo = "r:" + outputHashAlgo; } /* Check the derivation name. It shouldn't contain whitespace, |