diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-02-17T16·26+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-02-17T16·26+0000 |
commit | 889ef564fd0aca2814659f28fc7b9dc0191a6656 (patch) | |
tree | 916168bf7e9f30f1d8d0730499428a9833d69458 /src | |
parent | 345a95afe9e265bc433eea46c32c507ea84a72a4 (diff) |
* Fix the infamous NIX-17: nix-env -i prints misleading messages
("installing `foo'" followed by "uninstalling `foo'").
Diffstat (limited to 'src')
-rw-r--r-- | src/nix-env/main.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc index dd531382f0e5..4acbb6db0320 100644 --- a/src/nix-env/main.cc +++ b/src/nix-env/main.cc @@ -346,16 +346,14 @@ static void installDerivations(Globals & globals, queryInstSources(globals.state, globals.instSource, args, newElems); StringSet newNames; - for (DrvInfos::iterator i = newElems.begin(); i != newElems.end(); ++i) { - printMsg(lvlInfo, - format("installing `%1%'") % i->name); + for (DrvInfos::iterator i = newElems.begin(); i != newElems.end(); ++i) newNames.insert(DrvName(i->name).name); - } /* Add in the already installed derivations, unless they have the same name as a to-be-installed element. */ DrvInfos installedElems = queryInstalled(globals.state, profile); + DrvInfos allElems(newElems); for (DrvInfos::iterator i = installedElems.begin(); i != installedElems.end(); ++i) { @@ -363,14 +361,18 @@ static void installDerivations(Globals & globals, if (!globals.preserveInstalled && newNames.find(drvName.name) != newNames.end()) printMsg(lvlInfo, - format("uninstalling `%1%'") % i->name); + format("replacing old `%1%'") % i->name); else - newElems.push_back(*i); + allElems.push_back(*i); } + for (DrvInfos::iterator i = newElems.begin(); i != newElems.end(); ++i) + printMsg(lvlInfo, + format("installing `%1%'") % i->name); + if (globals.dryRun) return; - createUserEnv(globals.state, newElems, + createUserEnv(globals.state, allElems, profile, globals.keepDerivations); } |