* `nix-env -u' now allows a specific version to be specified when
upgrading. This fixes a bug reported by Martin: $ nix-env -i foo-1.0 $ nix-env -u foo-1.0 upgrading foo-1.0 to foo-1.1
This commit is contained in:
parent
2746a879e2
commit
24286e15c9
2 changed files with 10 additions and 4 deletions
|
@ -312,6 +312,9 @@ $ nix-env -f ~/foo.nix -i '*' <lineannotation>(install everything in <filename>f
|
||||||
$ nix-env --upgrade gcc
|
$ nix-env --upgrade gcc
|
||||||
upgrading `gcc-3.3.1' to `gcc-3.4'
|
upgrading `gcc-3.3.1' to `gcc-3.4'
|
||||||
|
|
||||||
|
$ nix-env -u gcc-3.3.2 --always <lineannotation>(switch to a specific version)</lineannotation>
|
||||||
|
upgrading `gcc-3.4' to `gcc-3.3.2'
|
||||||
|
|
||||||
$ nix-env --upgrade pan
|
$ nix-env --upgrade pan
|
||||||
<lineannotation>(no upgrades available, so nothing happens)</lineannotation>
|
<lineannotation>(no upgrades available, so nothing happens)</lineannotation>
|
||||||
|
|
||||||
|
|
|
@ -310,14 +310,16 @@ static void upgradeDerivations(EvalState & state,
|
||||||
i != installedDrvs.end(); ++i)
|
i != installedDrvs.end(); ++i)
|
||||||
{
|
{
|
||||||
DrvName drvName(i->second.name);
|
DrvName drvName(i->second.name);
|
||||||
|
DrvName selector;
|
||||||
|
|
||||||
/* Do we want to upgrade this derivation? */
|
/* Do we want to upgrade this derivation? */
|
||||||
bool upgrade = false;
|
bool upgrade = false;
|
||||||
for (DrvNames::iterator j = selectors.begin();
|
for (DrvNames::iterator j = selectors.begin();
|
||||||
j != selectors.end(); ++j)
|
j != selectors.end(); ++j)
|
||||||
{
|
{
|
||||||
if (j->matches(drvName)) {
|
if (j->name == "*" || j->name == drvName.name) {
|
||||||
j->hits++;
|
j->hits++;
|
||||||
|
selector = *j;
|
||||||
upgrade = true;
|
upgrade = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -344,9 +346,10 @@ static void upgradeDerivations(EvalState & state,
|
||||||
upgradeType == utLeq && d <= 0 ||
|
upgradeType == utLeq && d <= 0 ||
|
||||||
upgradeType == utAlways)
|
upgradeType == utAlways)
|
||||||
{
|
{
|
||||||
if (bestDrv == availDrvs.end() ||
|
if (selector.matches(newName) &&
|
||||||
|
(bestDrv == availDrvs.end() ||
|
||||||
compareVersions(
|
compareVersions(
|
||||||
bestName.version, newName.version) < 0)
|
bestName.version, newName.version) < 0))
|
||||||
{
|
{
|
||||||
bestDrv = j;
|
bestDrv = j;
|
||||||
bestName = newName;
|
bestName = newName;
|
||||||
|
|
Loading…
Reference in a new issue