mirror of
https://github.com/NixOS/nix.git
synced 2024-11-25 00:02:25 +00:00
* Merge r6688 from the trunk.
This commit is contained in:
parent
6a64ca413d
commit
4f5be16ca4
@ -244,9 +244,11 @@ string coerceToStringWithContext(EvalState & state,
|
||||
|
||||
e = evalExpr(state, e);
|
||||
|
||||
bool isWrapped = false;
|
||||
ATermList es;
|
||||
ATerm e2;
|
||||
if (matchContext(e, es, e2)) {
|
||||
isWrapped = true;
|
||||
e = e2;
|
||||
context = ATconcat(es, context);
|
||||
}
|
||||
@ -258,7 +260,7 @@ string coerceToStringWithContext(EvalState & state,
|
||||
if (matchPath(e, s)) {
|
||||
isPath = true;
|
||||
Path path = aterm2String(s);
|
||||
if (isInStore(path)) {
|
||||
if (isInStore(path) && !isWrapped) {
|
||||
context = ATinsert(context, makePath(toATerm(toStorePath(path))));
|
||||
}
|
||||
return path;
|
||||
@ -295,16 +297,18 @@ static ATerm concatStrings(EvalState & state, const ATermVector & args)
|
||||
std::ostringstream s;
|
||||
bool isPath = false;
|
||||
|
||||
/* Note that if the first argument in the concatenation is a path,
|
||||
then the result is also a path. */
|
||||
|
||||
for (ATermVector::const_iterator i = args.begin(); i != args.end(); ++i) {
|
||||
bool isPath2;
|
||||
s << coerceToStringWithContext(state, context, *i, isPath2);
|
||||
if (i == args.begin()) isPath = isPath2;
|
||||
}
|
||||
|
||||
Expr result = isPath
|
||||
return wrapInContext(context, isPath
|
||||
? makePath(toATerm(canonPath(s.str())))
|
||||
: makeStr(toATerm(s.str()));
|
||||
return wrapInContext(context, result);
|
||||
: makeStr(toATerm(s.str())));
|
||||
}
|
||||
|
||||
|
||||
|
@ -159,8 +159,15 @@ void toString(EvalState & state, Expr e,
|
||||
else if (matchPath(e, s)) {
|
||||
Path path(canonPath(aterm2String(s)));
|
||||
|
||||
if (!isInStore(path)) {
|
||||
if (isStorePath(path) || (isWrapped && isInStore(path))) {
|
||||
result += path;
|
||||
/* !!! smells hacky. Check whether this is the Right
|
||||
Thing To Do. */
|
||||
if (!isWrapped)
|
||||
context = ATinsert(context, makePath(toATerm(toStorePath(path))));
|
||||
}
|
||||
|
||||
else {
|
||||
if (isDerivation(path))
|
||||
throw EvalError(format("file names are not allowed to end in `%1%'")
|
||||
% drvExtension);
|
||||
@ -178,14 +185,6 @@ void toString(EvalState & state, Expr e,
|
||||
result += dstPath;
|
||||
context = ATinsert(context, makePath(toATerm(dstPath)));
|
||||
}
|
||||
|
||||
else {
|
||||
result += path;
|
||||
/* !!! smells hacky. Check whether this is the Right
|
||||
Thing To Do. */
|
||||
if (!isWrapped)
|
||||
context = ATinsert(context, makePath(toATerm(toStorePath(path))));
|
||||
}
|
||||
}
|
||||
|
||||
else if (matchList(e, es)) {
|
||||
|
Loading…
Reference in New Issue
Block a user