about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-09-03T11·04+0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-09-03T11·04+0000
commit06bb2d95b4d8232ef0cd0059d2609d2211d0e3e6 (patch)
tree034681664f0e3623006d0c09e76b6315e0e88b3c /src
parent6f809194d7448c4ad50174bed9ba2419e2114352 (diff)
Reformat
Diffstat (limited to 'src')
-rw-r--r--src/nix-instantiate/nix-instantiate.cc68
1 files changed, 35 insertions, 33 deletions
diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc
index 69fedb2a6a25..0f0710d680cb 100644
--- a/src/nix-instantiate/nix-instantiate.cc
+++ b/src/nix-instantiate/nix-instantiate.cc
@@ -39,44 +39,46 @@ void processExpr(EvalState & state, const Strings & attrPaths,
     bool parseOnly, bool strict, Bindings & autoArgs,
     bool evalOnly, bool xmlOutput, bool location, Expr * e)
 {
-    if (parseOnly)
+    if (parseOnly) {
         std::cout << format("%1%\n") % *e;
-    else
-        foreach (Strings::const_iterator, i, attrPaths) {
-            Value v;
-            findAlongAttrPath(state, *i, autoArgs, e, v);
-            state.forceValue(v);
-
-            PathSet context;
-            if (evalOnly)
-                if (xmlOutput)
-                    printValueAsXML(state, strict, location, v, std::cout, context);
-                else {
-                    if (strict) state.strictForceValue(v);
-                    std::cout << v << std::endl;
-                }
+        return;
+    }
+
+    foreach (Strings::const_iterator, i, attrPaths) {
+        Value v;
+        findAlongAttrPath(state, *i, autoArgs, e, v);
+        state.forceValue(v);
+
+        PathSet context;
+        if (evalOnly)
+            if (xmlOutput)
+                printValueAsXML(state, strict, location, v, std::cout, context);
             else {
-                DrvInfos drvs;
-                getDerivations(state, v, "", autoArgs, drvs, false);
-                foreach (DrvInfos::iterator, i, drvs) {
-                    Path drvPath = i->queryDrvPath(state);
-
-                    /* What output do we want? */
-                    string outputName = i->queryOutputName(state);
-                    if (outputName == "")
-                        throw Error(format("derivation `%1%' lacks an `outputName' attribute ") % drvPath);
-
-                    if (gcRoot == "")
-                        printGCWarning();
-                    else {
-                        Path rootName = gcRoot;
-                        if (++rootNr > 1) rootName += "-" + int2String(rootNr);
-                        drvPath = addPermRoot(*store, drvPath, rootName, indirectRoot);
-                    }
-                    std::cout << format("%1%%2%\n") % drvPath % (outputName != "out" ? "!" + outputName : "");
+                if (strict) state.strictForceValue(v);
+                std::cout << v << std::endl;
+            }
+        else {
+            DrvInfos drvs;
+            getDerivations(state, v, "", autoArgs, drvs, false);
+            foreach (DrvInfos::iterator, i, drvs) {
+                Path drvPath = i->queryDrvPath(state);
+
+                /* What output do we want? */
+                string outputName = i->queryOutputName(state);
+                if (outputName == "")
+                    throw Error(format("derivation `%1%' lacks an `outputName' attribute ") % drvPath);
+
+                if (gcRoot == "")
+                    printGCWarning();
+                else {
+                    Path rootName = gcRoot;
+                    if (++rootNr > 1) rootName += "-" + int2String(rootNr);
+                    drvPath = addPermRoot(*store, drvPath, rootName, indirectRoot);
                 }
+                std::cout << format("%1%%2%\n") % drvPath % (outputName != "out" ? "!" + outputName : "");
             }
         }
+    }
 }