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>2006-06-27T12·17+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-06-27T12·17+0000
commita945fb7905597ff67f285b39004f607f737b14e9 (patch)
treef87e445b667637a17eec3ff8dfa8e09e4ace66d0 /src/nix-env/main.cc
parentf4a3a280dbd5c723d13cf74d71aab1993d0f0a9e (diff)
* `nix-env --upgrade --eq': only upgrade if the old version is equal
  to the new version.  This is actually useful.

Diffstat (limited to 'src/nix-env/main.cc')
-rw-r--r--src/nix-env/main.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc
index 0198aed575c9..400bb0d87734 100644
--- a/src/nix-env/main.cc
+++ b/src/nix-env/main.cc
@@ -476,7 +476,7 @@ static void opInstall(Globals & globals,
 }
 
 
-typedef enum { utLt, utLeq, utAlways } UpgradeType;
+typedef enum { utLt, utLeq, utEq, utAlways } UpgradeType;
 
 
 static void upgradeDerivations(Globals & globals,
@@ -520,6 +520,7 @@ static void upgradeDerivations(Globals & globals,
                 int d = compareVersions(drvName.version, newName.version);
                 if (upgradeType == utLt && d < 0 ||
                     upgradeType == utLeq && d <= 0 ||
+                    upgradeType == utEq && d == 0 ||
                     upgradeType == utAlways)
                 {
                     if ((bestElem == availElems.end() ||
@@ -562,6 +563,7 @@ static void opUpgrade(Globals & globals,
          i != opFlags.end(); ++i)
         if (*i == "--lt") upgradeType = utLt;
         else if (*i == "--leq") upgradeType = utLeq;
+        else if (*i == "--eq") upgradeType = utEq;
         else if (*i == "--always") upgradeType = utAlways;
         else throw UsageError(format("unknown flag `%1%'") % *i);