1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-27 04:30:59 +01:00

Merged R8864

This commit is contained in:
Wouter den Breejen 2007-10-08 10:26:21 +00:00
parent 854e155b2c
commit 546ca6e8bc
17 changed files with 113 additions and 50 deletions

View file

@ -478,7 +478,7 @@ LocalNoInline(Expr evalCall(EvalState & state, Expr fun, Expr arg))
}
else throwTypeError(
"the left-hand side of the function call is neither a function nor a primop (built-in operation) but %1%",
"attempt to call something which is neither a function nor a primop (built-in operation) but %1%",
showType(fun));
}

View file

@ -249,6 +249,7 @@ expr_list
formals
: formal ',' formals { $$ = ATinsert($3, $1); } /* idem - right recursive */
| formal { $$ = ATinsert(ATempty, $1); }
| { $$ = ATempty; }
;
formal

View file

@ -116,6 +116,18 @@ static Expr prim_isNull(EvalState & state, const ATermVector & args)
}
/* Determine whether the argument is a function. */
static Expr prim_isFunction(EvalState & state, const ATermVector & args)
{
Expr e = evalExpr(state, args[0]);
ATermList formals;
ATerm name, body, pos;
return makeBool(
matchFunction(e, formals, body, pos) ||
matchFunction1(e, name, body, pos));
}
static Path findDependency(Path dir, string dep)
{
if (dep[0] == '/') throw EvalError(
@ -1032,6 +1044,7 @@ void EvalState::addPrimOps()
// Miscellaneous
addPrimOp("import", 1, prim_import);
addPrimOp("isNull", 1, prim_isNull);
addPrimOp("__isFunction", 1, prim_isFunction);
addPrimOp("dependencyClosure", 1, prim_dependencyClosure);
addPrimOp("abort", 1, prim_abort);
addPrimOp("throw", 1, prim_throw);

View file

@ -145,6 +145,15 @@ Database::~Database()
void openEnv(DbEnv * & env, const string & path, u_int32_t flags)
{
try {
createDirs(path);
} catch (SysError & e) {
if (e.errNo == EPERM || e.errNo == EACCES)
throw DbNoPermission(format("cannot create the Nix database in `%1%'") % path);
else
throw;
}
try {
env->open(path.c_str(),
DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN |

View file

@ -97,6 +97,11 @@ Path addPermRoot(const Path & _storePath, const Path & _gcRoot,
Path gcRoot(canonPath(_gcRoot));
assertStorePath(storePath);
if (isInStore(gcRoot))
throw Error(format(
"creating a garbage collector root (%1%) in the Nix store is forbidden "
"(are you running nix-build inside the store?)") % gcRoot);
if (indirect) {
createSymlink(gcRoot, storePath, true);
store->addIndirectRoot(gcRoot);
@ -114,7 +119,6 @@ Path addPermRoot(const Path & _storePath, const Path & _gcRoot,
}
createSymlink(gcRoot, storePath, false);
}
/* Check that the root can be found by the garbage collector. */

View file

@ -13,7 +13,7 @@ class Transaction;
/* Nix store and database schema version. Version 1 (or 0) was Nix <=
0.7. Version 2 was Nix 0.8 and 0.8. Version 3 is Nix 0.10 and
0.7. Version 2 was Nix 0.8 and 0.9. Version 3 is Nix 0.10 and
up. */
const int nixSchemaVersion = 3;