aboutsummaryrefslogtreecommitdiff
path: root/src/nix-store
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-08-04 13:44:46 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-08-04 13:44:46 +0000
commita1d310b6b5c710215265c1cd0d5893248ed50f92 (patch)
treebf35d52f339ee027fc749bb63cc3d2bbe5a23f49 /src/nix-store
parent42043953c3558f054dc5b9bb3da605a4a3ed6314 (diff)
* `nix-store --realise': print what paths will be built/downloaded,
just like nix-env. * `nix-store --realise': --dry-run option.
Diffstat (limited to 'src/nix-store')
-rw-r--r--src/nix-store/nix-store.cc29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index b59ff27bb..0030745b4 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -77,23 +77,26 @@ static Path realisePath(const Path & path)
/* Realise the given paths. */
static void opRealise(Strings opFlags, Strings opArgs)
{
- if (!opFlags.empty()) throw UsageError("unknown flag");
+ bool dryRun = false;
+
+ foreach (Strings::iterator, i, opFlags)
+ if (*i == "--dry-run") dryRun = true;
+ else throw UsageError(format("unknown flag `%1%'") % *i);
- for (Strings::iterator i = opArgs.begin();
- i != opArgs.end(); ++i)
+ foreach (Strings::iterator, i, opArgs)
*i = followLinksToStorePath(*i);
- if (opArgs.size() > 1) {
- PathSet drvPaths;
- for (Strings::iterator i = opArgs.begin();
- i != opArgs.end(); ++i)
- if (isDerivation(*i))
- drvPaths.insert(*i);
- store->buildDerivations(drvPaths);
- }
+ printMissing(PathSet(opArgs.begin(), opArgs.end()));
+
+ if (dryRun) return;
+
+ /* Build all derivations at the same time to exploit parallelism. */
+ PathSet drvPaths;
+ foreach (Strings::iterator, i, opArgs)
+ if (isDerivation(*i)) drvPaths.insert(*i);
+ store->buildDerivations(drvPaths);
- for (Strings::iterator i = opArgs.begin();
- i != opArgs.end(); ++i)
+ foreach (Strings::iterator, i,opArgs)
cout << format("%1%\n") % realisePath(*i);
}