1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

* `nix-store --realise': print what paths will be built/downloaded,

just like nix-env.
* `nix-store --realise': --dry-run option.
This commit is contained in:
Eelco Dolstra 2008-08-04 13:44:46 +00:00
parent 42043953c3
commit a1d310b6b5
4 changed files with 50 additions and 37 deletions

View file

@ -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);
}