1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-04 15:31:47 +02:00

* Merged the no-bdb branch (-r10900:HEAD

https://svn.nixos.org/repos/nix/nix/branches/no-bdb).
This commit is contained in:
Eelco Dolstra 2008-06-09 13:52:45 +00:00
parent 4ed01ed791
commit b0e92f6d47
24 changed files with 923 additions and 739 deletions

View file

@ -1,7 +1,6 @@
#include "dotgraph.hh"
#include "util.hh"
#include "store-api.hh"
#include "db.hh"
#include <iostream>

View file

@ -7,7 +7,6 @@
#include "shared.hh"
#include "dotgraph.hh"
#include "local-store.hh"
#include "db.hh"
#include "util.hh"
#include "help.txt.hh"
@ -31,6 +30,14 @@ static int rootNr = 0;
static bool indirectRoot = false;
LocalStore & ensureLocalStore()
{
LocalStore * store2(dynamic_cast<LocalStore *>(store.get()));
if (!store2) throw Error("you don't have sufficient rights to use --verify");
return *store2;
}
static Path useDeriver(Path path)
{
if (!isDerivation(path)) {
@ -430,10 +437,7 @@ static void registerValidity(bool reregister, bool hashGiven, bool canonicalise)
}
}
Transaction txn;
createStoreTransaction(txn);
registerValidPaths(txn, infos);
txn.commit();
ensureLocalStore().registerValidPaths(infos);
}
@ -641,11 +645,10 @@ static void opVerify(Strings opFlags, Strings opArgs)
if (*i == "--check-contents") checkContents = true;
else throw UsageError(format("unknown flag `%1%'") % *i);
verifyStore(checkContents);
ensureLocalStore().verifyStore(checkContents);
}
static void showOptimiseStats(OptimiseStats & stats)
{
printMsg(lvlError,
@ -671,12 +674,9 @@ static void opOptimise(Strings opFlags, Strings opArgs)
if (*i == "--dry-run") dryRun = true;
else throw UsageError(format("unknown flag `%1%'") % *i);
LocalStore * store2(dynamic_cast<LocalStore *>(store.get()));
if (!store2) throw Error("you don't have sufficient rights to use --optimise");
OptimiseStats stats;
try {
store2->optimiseStore(dryRun, stats);
ensureLocalStore().optimiseStore(dryRun, stats);
} catch (...) {
showOptimiseStats(stats);
throw;
@ -755,7 +755,7 @@ void run(Strings args)
if (!op) throw UsageError("no operation specified");
if (op != opDump && op != opRestore) /* !!! hack */
store = openStore(op != opGC);
store = openStore();
op(opFlags, opArgs);
}