mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 06:52:43 +01:00
* Sync with the trunk.
This commit is contained in:
commit
bf87cc44b4
16 changed files with 140 additions and 16 deletions
|
|
@ -59,6 +59,7 @@ std::ostream & operator << (std::ostream & str, const Value & v)
|
|||
str << "]";
|
||||
break;
|
||||
case tThunk:
|
||||
case tApp:
|
||||
case tCopy:
|
||||
str << "<CODE>";
|
||||
break;
|
||||
|
|
@ -901,12 +902,18 @@ string EvalState::forceString(Value & v)
|
|||
}
|
||||
|
||||
|
||||
string EvalState::forceString(Value & v, PathSet & context)
|
||||
void copyContext(const Value & v, PathSet & context)
|
||||
{
|
||||
string s = forceString(v);
|
||||
if (v.string.context)
|
||||
for (const char * * p = v.string.context; *p; ++p)
|
||||
context.insert(*p);
|
||||
}
|
||||
|
||||
|
||||
string EvalState::forceString(Value & v, PathSet & context)
|
||||
{
|
||||
string s = forceString(v);
|
||||
copyContext(v, context);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
@ -937,9 +944,7 @@ string EvalState::coerceToString(Value & v, PathSet & context,
|
|||
string s;
|
||||
|
||||
if (v.type == tString) {
|
||||
if (v.string.context)
|
||||
for (const char * * p = v.string.context; *p; ++p)
|
||||
context.insert(*p);
|
||||
copyContext(v, context);
|
||||
return v.string.s;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -163,6 +163,8 @@ void mkString(Value & v, const char * s);
|
|||
void mkString(Value & v, const string & s, const PathSet & context = PathSet());
|
||||
void mkPath(Value & v, const char * s);
|
||||
|
||||
void copyContext(const Value & v, PathSet & context);
|
||||
|
||||
|
||||
typedef std::map<Path, Hash> DrvHashes;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ MakeError(AssertionError, EvalError)
|
|||
MakeError(ThrownError, AssertionError)
|
||||
MakeError(Abort, EvalError)
|
||||
MakeError(TypeError, EvalError)
|
||||
MakeError(ImportError, EvalError) // error building an imported derivation
|
||||
|
||||
|
||||
/* Position objects. */
|
||||
|
|
|
|||
|
|
@ -37,7 +37,11 @@ static void prim_import(EvalState & state, Value * * args, Value & v)
|
|||
throw EvalError(format("cannot import `%1%', since path `%2%' is not valid")
|
||||
% path % *i);
|
||||
if (isDerivation(*i))
|
||||
store->buildDerivations(singleton<PathSet>(*i));
|
||||
try {
|
||||
store->buildDerivations(singleton<PathSet>(*i));
|
||||
} catch (Error & e) {
|
||||
throw ImportError(e.msg());
|
||||
}
|
||||
}
|
||||
|
||||
state.evalFile(path, v);
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ static void printValueAsXML(EvalState & state, bool strict, bool location,
|
|||
|
||||
case tString:
|
||||
/* !!! show the context? */
|
||||
copyContext(v, context);
|
||||
doc.writeEmptyElement("string", singletonAttrs("value", v.string.s));
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue