mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 20:20:58 +01:00
Merged R8864
This commit is contained in:
parent
854e155b2c
commit
546ca6e8bc
17 changed files with 113 additions and 50 deletions
|
|
@ -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 |
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue