Compare commits

...

6 commits

Author SHA1 Message Date
Eelco Dolstra 6f7efe438c * Release notes. 2006-10-11 10:56:35 +00:00
Eelco Dolstra 4f5be16ca4 * Merge r6688 from the trunk. 2006-10-11 10:46:12 +00:00
Eelco Dolstra 6a64ca413d * Bump the version number to 0.10.1. 2006-10-10 15:11:15 +00:00
Eelco Dolstra 47f2e407be * Merged r6683 from the trunk. 2006-10-10 15:10:41 +00:00
Eelco Dolstra 3c11534341 * Create a 0.10 maintenance branch. 2006-10-10 15:09:33 +00:00
Eelco Dolstra 9962197fc5 * Release branch for 0.10. 2006-10-06 10:00:13 +00:00
4 changed files with 43 additions and 27 deletions

View file

@ -1,4 +1,4 @@
AC_INIT(nix, 0.10) AC_INIT(nix, 0.10.1)
AC_CONFIG_SRCDIR(README) AC_CONFIG_SRCDIR(README)
AC_CONFIG_AUX_DIR(config) AC_CONFIG_AUX_DIR(config)
AM_INIT_AUTOMAKE([dist-bzip2 foreign]) AM_INIT_AUTOMAKE([dist-bzip2 foreign])

View file

@ -5,6 +5,18 @@
<!--==================================================================-->
<section><title>Release 0.10.1 (October 11, 2006)</title>
<para>This release fixes two somewhat obscure bugs that occur when
evaluating Nix expressions that are stored inside the Nix store
(<literal>NIX-67</literal>). These do not affect most users.</para>
</section>
<!--==================================================================--> <!--==================================================================-->
<section><title>Release 0.10 (October 6, 2006)</title> <section><title>Release 0.10 (October 6, 2006)</title>

View file

@ -244,9 +244,11 @@ string coerceToStringWithContext(EvalState & state,
e = evalExpr(state, e); e = evalExpr(state, e);
bool isWrapped = false;
ATermList es; ATermList es;
ATerm e2; ATerm e2;
if (matchContext(e, es, e2)) { if (matchContext(e, es, e2)) {
isWrapped = true;
e = e2; e = e2;
context = ATconcat(es, context); context = ATconcat(es, context);
} }
@ -258,7 +260,7 @@ string coerceToStringWithContext(EvalState & state,
if (matchPath(e, s)) { if (matchPath(e, s)) {
isPath = true; isPath = true;
Path path = aterm2String(s); Path path = aterm2String(s);
if (isInStore(path)) { if (isInStore(path) && !isWrapped) {
context = ATinsert(context, makePath(toATerm(toStorePath(path)))); context = ATinsert(context, makePath(toATerm(toStorePath(path))));
} }
return path; return path;
@ -295,16 +297,18 @@ static ATerm concatStrings(EvalState & state, const ATermVector & args)
std::ostringstream s; std::ostringstream s;
bool isPath = false; 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) { for (ATermVector::const_iterator i = args.begin(); i != args.end(); ++i) {
bool isPath2; bool isPath2;
s << coerceToStringWithContext(state, context, *i, isPath2); s << coerceToStringWithContext(state, context, *i, isPath2);
if (i == args.begin()) isPath = isPath2; if (i == args.begin()) isPath = isPath2;
} }
Expr result = isPath return wrapInContext(context, isPath
? makePath(toATerm(canonPath(s.str()))) ? makePath(toATerm(canonPath(s.str())))
: makeStr(toATerm(s.str())); : makeStr(toATerm(s.str())));
return wrapInContext(context, result);
} }

View file

@ -13,6 +13,16 @@
namespace nix { namespace nix {
static Expr unwrapContext(EvalState & state, Expr e, ATermList & context)
{
context = ATempty;
e = evalExpr(state, e);
if (matchContext(e, context, e))
e = evalExpr(state, e);
return e;
}
static Expr primBuiltins(EvalState & state, const ATermVector & args) static Expr primBuiltins(EvalState & state, const ATermVector & args)
{ {
/* Return an attribute set containing all primops. This allows /* Return an attribute set containing all primops. This allows
@ -43,8 +53,9 @@ static Expr primImport(EvalState & state, const ATermVector & args)
{ {
ATermList es; ATermList es;
Path path; Path path;
ATermList context; /* don't care the context */
Expr arg = evalExpr(state, args[0]), arg2;
Expr arg = unwrapContext(state, args[0], context), arg2;
if (matchPath(arg, arg2)) if (matchPath(arg, arg2))
path = aterm2String(arg2); path = aterm2String(arg2);
@ -67,7 +78,7 @@ static Expr primImport(EvalState & state, const ATermVector & args)
} }
} }
else throw TypeError("`import' requires a path or derivation as its argument"); else throw TypeError(format("argument of `import' is %1% while a path or derivation is required") % showType(arg));
return evalFile(state, path); return evalFile(state, path);
} }
@ -148,8 +159,15 @@ void toString(EvalState & state, Expr e,
else if (matchPath(e, s)) { else if (matchPath(e, s)) {
Path path(canonPath(aterm2String(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)) if (isDerivation(path))
throw EvalError(format("file names are not allowed to end in `%1%'") throw EvalError(format("file names are not allowed to end in `%1%'")
% drvExtension); % drvExtension);
@ -167,14 +185,6 @@ void toString(EvalState & state, Expr e,
result += dstPath; result += dstPath;
context = ATinsert(context, makePath(toATerm(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)) { else if (matchList(e, es)) {
@ -513,16 +523,6 @@ static Expr primToXML(EvalState & state, const ATermVector & args)
} }
static Expr unwrapContext(EvalState & state, Expr e, ATermList & context)
{
context = ATempty;
e = evalExpr(state, e);
if (matchContext(e, context, e))
e = evalExpr(state, e);
return e;
}
/* Store a string in the Nix store as a source file that can be used /* Store a string in the Nix store as a source file that can be used
as an input by derivations. */ as an input by derivations. */
static Expr primToFile(EvalState & state, const ATermVector & args) static Expr primToFile(EvalState & state, const ATermVector & args)