about summary refs log tree commit diff
path: root/src/nix-env/main.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-06-28T13·37+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-06-28T13·37+0000
commit24286e15c9822833c39d268e521522b9933db28e (patch)
tree5802bd6c7b81210ed0597ee4b99b4b8a3aabe55e /src/nix-env/main.cc
parent2746a879e23a97639b23fe6e5335e0cfcc7d5085 (diff)
* `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
  

Diffstat (limited to 'src/nix-env/main.cc')
-rw-r--r--src/nix-env/main.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc
index c57f03cce007..1f16e72ae0f1 100644
--- a/src/nix-env/main.cc
+++ b/src/nix-env/main.cc
@@ -310,14 +310,16 @@ static void upgradeDerivations(EvalState & state,
          i != installedDrvs.end(); ++i)
     {
         DrvName drvName(i->second.name);
+        DrvName selector;
 
         /* Do we want to upgrade this derivation? */
         bool upgrade = false;
         for (DrvNames::iterator j = selectors.begin();
              j != selectors.end(); ++j)
         {
-            if (j->matches(drvName)) {
+            if (j->name == "*" || j->name == drvName.name) {
                 j->hits++;
+                selector = *j;
                 upgrade = true;
                 break;
             }
@@ -344,9 +346,10 @@ static void upgradeDerivations(EvalState & state,
                     upgradeType == utLeq && d <= 0 ||
                     upgradeType == utAlways)
                 {
-                    if (bestDrv == availDrvs.end() ||
-                        compareVersions(
-                            bestName.version, newName.version) < 0)
+                    if (selector.matches(newName) &&
+                        (bestDrv == availDrvs.end() ||
+                         compareVersions(
+                             bestName.version, newName.version) < 0))
                     {
                         bestDrv = j;
                         bestName = newName;