about summary refs log tree commit diff
path: root/src/nix-env
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-21T14·30+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-21T14·30+0100
commit81628a6ccc6ce496735b22492bee15c9ad46f072 (patch)
treed1ec18b84514d2f44700082f8d800efb929a7678 /src/nix-env
parentb1db599dd05e86f65e73dc40584913e6e78c2bac (diff)
parent5ef8508a92997dbd7f8aa501b64fd283fb1c7bb8 (diff)
Merge branch 'master' into make
Conflicts:
	src/libexpr/eval.cc
Diffstat (limited to 'src/nix-env')
-rw-r--r--src/nix-env/nix-env.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index cf74747dacdd..e2781e540bf2 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -233,6 +233,15 @@ static bool isPrebuilt(EvalState & state, DrvInfo & elem)
 }
 
 
+static void checkSelectorUse(DrvNames & selectors)
+{
+    /* Check that all selectors have been used. */
+    foreach (DrvNames::iterator, i, selectors)
+        if (i->hits == 0 && i->fullName != "*")
+            throw Error(format("selector `%1%' matches no derivations") % i->fullName);
+}
+
+
 static DrvInfos filterBySelector(EvalState & state, const DrvInfos & allElems,
     const Strings & args, bool newestOnly)
 {
@@ -315,11 +324,7 @@ static DrvInfos filterBySelector(EvalState & state, const DrvInfos & allElems,
             }
     }
 
-    /* Check that all selectors have been used. */
-    foreach (DrvNames::iterator, i, selectors)
-        if (i->hits == 0 && i->fullName != "*")
-            throw Error(format("selector `%1%' matches no derivations")
-                % i->fullName);
+    checkSelectorUse(selectors);
 
     return elems;
 }
@@ -673,11 +678,14 @@ static void opSetFlag(Globals & globals,
             foreach (DrvNames::iterator, j, selectors)
                 if (j->matches(drvName)) {
                     printMsg(lvlInfo, format("setting flag on `%1%'") % i->name);
+                    j->hits++;
                     setMetaFlag(globals.state, *i, flagName, flagValue);
                     break;
                 }
         }
 
+        checkSelectorUse(selectors);
+
         /* Write the new user environment. */
         if (createUserEnv(globals.state, installedElems,
                 globals.profile, settings.envKeepDerivations, lockToken)) break;
@@ -887,7 +895,6 @@ static void queryJSON(Globals & globals, vector<DrvInfo> & elems)
 static void opQuery(Globals & globals,
     Strings args, Strings opFlags, Strings opArgs)
 {
-    typedef vector< map<string, string> > ResultSet;
     Strings remaining;
     string attrPath;