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-09-25T14·00+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-09-25T14·00+0000
commit3632019b737d1c570a3c30f4f3f07763b5b1d23c (patch)
tree0c966c09000394dc5404771816ccd2a20902af0f /src/nix-env/main.cc
parentd43565c3e837feea478aaa71bad7e0a92c1911f0 (diff)
* Quick hack to let nix-install-package set the package name properly
  (e.g., "java-front-0.9pre15899" instead of "java-front";
  particularly important when doing upgrades later on).

Diffstat (limited to 'src/nix-env/main.cc')
-rw-r--r--src/nix-env/main.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc
index 416f89bcc1..6a40387150 100644
--- a/src/nix-env/main.cc
+++ b/src/nix-env/main.cc
@@ -59,6 +59,7 @@ struct Globals
     bool dryRun;
     bool preserveInstalled;
     bool keepDerivations;
+    string forceName;
 };
 
 
@@ -448,8 +449,15 @@ static void installDerivations(Globals & globals,
     queryInstSources(globals.state, globals.instSource, args, newElems, true);
 
     StringSet newNames;
-    for (DrvInfos::iterator i = newElems.begin(); i != newElems.end(); ++i)
+    for (DrvInfos::iterator i = newElems.begin(); i != newElems.end(); ++i) {
+        /* `forceName' is a hack to get package names right in some
+           one-click installs, namely those where the name used in the
+           path is not the one we want (e.g., `java-front' versus
+           `java-front-0.9pre15899'). */
+        if (globals.forceName != "")
+            i->name = globals.forceName;
         newNames.insert(DrvName(i->name).name);
+    }
 
     /* Add in the already installed derivations, unless they have the
        same name as a to-be-installed element. */
@@ -1139,6 +1147,8 @@ void run(Strings args)
             Expr value = parseExprFromString(globals.state, *i, absPath("."));
             globals.instSource.autoArgs.set(toATerm(name), value);
         }
+        else if (arg == "--force-name") // undocumented flag for nix-install-package
+            globals.forceName = needArg(i, args, arg);
         else if (arg == "--uninstall" || arg == "-e")
             op = opUninstall;
         else if (arg == "--upgrade" || arg == "-u")