diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-03-06 11:21:15 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-03-06 11:21:15 +0000 |
commit | c8bfb11b34e4b8d3cfd714c54e7436c80e4d72ef (patch) | |
tree | a57b1c64bddaf7422e89031974f9c87f973c8a8b /src/nix-env | |
parent | 7ba1fd2029c1290d89f0218157e597885926ca80 (diff) |
* `nix-env (-i|-u) --dry-run' now shows exactly which missing paths
will be built or substituted.
Diffstat (limited to 'src/nix-env')
-rw-r--r-- | src/nix-env/main.cc | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc index 84c89a157..8648e4f0f 100644 --- a/src/nix-env/main.cc +++ b/src/nix-env/main.cc @@ -2,6 +2,7 @@ #include "names.hh" #include "globals.hh" #include "build.hh" +#include "misc.hh" #include "gc.hh" #include "shared.hh" #include "parser.hh" @@ -383,6 +384,33 @@ static void queryInstSources(EvalState & state, } +static void printMissing(EvalState & state, const DrvInfos & elems) +{ + PathSet targets, willBuild, willSubstitute; + for (DrvInfos::const_iterator i = elems.begin(); i != elems.end(); ++i) { + Path drvPath = i->queryDrvPath(state); + if (drvPath != "") + targets.insert(drvPath); + else + targets.insert(i->queryOutPath(state)); + } + + queryMissing(targets, willBuild, willSubstitute); + + if (!willBuild.empty()) { + printMsg(lvlInfo, format("the following derivations will be built:")); + for (PathSet::iterator i = willBuild.begin(); i != willBuild.end(); ++i) + printMsg(lvlInfo, format(" %1%") % *i); + } + + if (!willSubstitute.empty()) { + printMsg(lvlInfo, format("the following paths will be substituted:")); + for (PathSet::iterator i = willSubstitute.begin(); i != willSubstitute.end(); ++i) + printMsg(lvlInfo, format(" %1%") % *i); + } +} + + static void installDerivations(Globals & globals, const Strings & args, const Path & profile) { @@ -417,7 +445,10 @@ static void installDerivations(Globals & globals, printMsg(lvlInfo, format("installing `%1%'") % i->name); - if (globals.dryRun) return; + if (globals.dryRun) { + printMissing(globals.state, newElems); + return; + } createUserEnv(globals.state, allElems, profile, globals.keepDerivations); @@ -500,7 +531,10 @@ static void upgradeDerivations(Globals & globals, } else newElems.push_back(*i); } - if (globals.dryRun) return; + if (globals.dryRun) { + printMissing(globals.state, newElems); + return; + } createUserEnv(globals.state, newElems, profile, globals.keepDerivations); |