From 9bd93f76069fdf25688ce984a17798ab0834202f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 19 Oct 2006 17:39:02 +0000 Subject: [PATCH] * toFile: maintain the references. --- src/libexpr/primops.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 19d233922..d5708f96b 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -370,17 +370,11 @@ static Expr primToFile(EvalState & state, const ATermVector & args) PathSet refs; -#if 0 - /* !!! */ - for (ATermIterator i(context); i; ++i) { - ATerm s; - if (matchPath(*i, s)) { - assert(isStorePath(aterm2String(s))); - refs.insert(aterm2String(s)); - } - else throw EvalError("in `toFile': the file cannot contain references to derivation outputs"); + for (PathSet::iterator i = context.begin(); i != context.end(); ++i) { + if (isDerivation(*i)) + throw EvalError("in `toFile': the file cannot refer to derivation outputs"); + refs.insert(*i); } -#endif Path storePath = addTextToStore(name, contents, refs);