diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-06-09T13·52+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-06-09T13·52+0000 |
commit | b0e92f6d474ce91d7f071f9ed62bbb2015009c58 (patch) | |
tree | c3d28be6b89dfa618df290d5c78c55897b119b6c /src/nix-store | |
parent | 4ed01ed791b3bb7a4010049c6128aa2d49a81a29 (diff) |
* Merged the no-bdb branch (-r10900:HEAD
https://svn.nixos.org/repos/nix/nix/branches/no-bdb).
Diffstat (limited to 'src/nix-store')
-rw-r--r-- | src/nix-store/dotgraph.cc | 1 | ||||
-rw-r--r-- | src/nix-store/nix-store.cc | 24 |
2 files changed, 12 insertions, 13 deletions
diff --git a/src/nix-store/dotgraph.cc b/src/nix-store/dotgraph.cc index 989945600f23..83df9e9cd0ce 100644 --- a/src/nix-store/dotgraph.cc +++ b/src/nix-store/dotgraph.cc @@ -1,7 +1,6 @@ #include "dotgraph.hh" #include "util.hh" #include "store-api.hh" -#include "db.hh" #include <iostream> diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 17b3c18fad9f..df027fcc7646 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -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); } |