* Give a useful error message when an evaluation error occurs while

trying to upgrade a package.
This commit is contained in:
Eelco Dolstra 2009-10-13 09:30:17 +00:00
parent 53a4981fa2
commit 6f7d7bc1de

View file

@ -704,18 +704,20 @@ static void upgradeDerivations(Globals & globals,
foreach (DrvInfos::iterator, i, installedElems) {
DrvName drvName(i->name);
try {
MetaInfo meta = i->queryMetaInfo(globals.state);
if (keep(meta)) {
newElems.push_back(*i);
continue;
}
/* Find the derivation in the input Nix expression with
the same name that satisfies the version constraints
specified by upgradeType. If there are multiple
matches, take the one with the highest priority. If
there are still multiple matches, take the one with the
highest version. */
/* Find the derivation in the input Nix expression
with the same name that satisfies the version
constraints specified by upgradeType. If there are
multiple matches, take the one with the highest
priority. If there are still multiple matches,
take the one with the highest version. */
DrvInfos::iterator bestElem = availElems.end();
DrvName bestName;
foreach (DrvInfos::iterator, j, availElems) {
@ -750,6 +752,11 @@ static void upgradeDerivations(Globals & globals,
% i->name % bestElem->name);
newElems.push_back(*bestElem);
} else newElems.push_back(*i);
} catch (Error & e) {
e.addPrefix(format("while trying to find an upgrade for `%1%':\n") % i->name);
throw;
}
}
printMissing(globals.state, newElems);