From 3a2c3f0cf265075b130d9d2a25b9c8334c560b33 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 22 Feb 2005 21:14:41 +0000 Subject: * Support for fixed-output hashes over directory trees (i.e., over the NAR dump of the path). --- src/libexpr/primops.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/libexpr/primops.cc') diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index da9d1e635811..a2f27b4dc87f 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, -- cgit 1.4.1