[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
300/376: import derivation: cleanup
From: |
Ludovic Courtès |
Subject: |
300/376: import derivation: cleanup |
Date: |
Wed, 28 Jan 2015 22:05:45 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit b0c5c2ac346965f18224b105032df0c679112cab
Author: Shea Levy <address@hidden>
Date: Thu Nov 20 22:48:12 2014 -0500
import derivation: cleanup
Before this there was a bug where a `find` was being called on a
not-yet-sorted set. The code was just a mess before anyway, so I cleaned
it up while fixing it.
---
src/libexpr/primops.cc | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 6203a11..e6edffa 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -84,16 +84,19 @@ static void prim_scopedImport(EvalState & state, const Pos
& pos, Value * * args
Derivation drv = readDerivation(path);
Value & w = *state.allocValue();
state.mkAttrs(w, 2 + drv.outputs.size());
- mkString(*state.allocAttr(w, state.sDrvPath), path,
singleton<PathSet>("=" + path));
- state.mkList(*state.allocAttr(w, state.symbols.create("outputs")),
drv.outputs.size());
+ Value * v2 = state.allocAttr(w, state.sDrvPath);
+ mkString(*v2, path, singleton<PathSet>("=" + path));
+ Value * outputsVal =
+ state.allocAttr(w, state.symbols.create("outputs"));
+ state.mkList(*outputsVal, drv.outputs.size());
unsigned int outputs_index = 0;
- Value * outputsVal =
w.attrs->find(state.symbols.create("outputs"))->value;
- foreach (DerivationOutputs::iterator, i, drv.outputs) {
- mkString(*state.allocAttr(w, state.symbols.create(i->first)),
- i->second.path, singleton<PathSet>("!" + i->first + "!" +
path));
- mkString(*(outputsVal->list.elems[outputs_index++] =
state.allocValue()),
- i->first);
+ for (const auto & o : drv.outputs) {
+ v2 = state.allocAttr(w, state.symbols.create(o.first));
+ mkString(*v2, o.second.path,
+ singleton<PathSet>("!" + o.first + "!" + path));
+ outputsVal->list.elems[outputs_index] = state.allocValue();
+ mkString(*(outputsVal->list.elems[outputs_index++]), o.first);
}
w.attrs->sort();
Value fun;
- 253/376: nix-channel: Add --rollback flag, (continued)
- 253/376: nix-channel: Add --rollback flag, Ludovic Courtès, 2015/01/28
- 289/376: Document functors, Ludovic Courtès, 2015/01/28
- 259/376: Export realiseContext in libnixexpr, Ludovic Courtès, 2015/01/28
- 284/376: SSH.pm: Print a friendlier message if connecting fails, Ludovic Courtès, 2015/01/28
- 278/376: Typo, Ludovic Courtès, 2015/01/28
- 292/376: Add a test for the binary tarball installer, Ludovic Courtès, 2015/01/28
- 296/376: Disable vacuuming the DB after garbage collection, Ludovic Courtès, 2015/01/28
- 298/376: Fix bad operator, Ludovic Courtès, 2015/01/28
- 270/376: Revert "Temporarily disable darwin builds while hydra's darwin is borked", Ludovic Courtès, 2015/01/28
- 283/376: Doh, Ludovic Courtès, 2015/01/28
- 300/376: import derivation: cleanup,
Ludovic Courtès <=
- 264/376: Temporarily disable darwin builds while hydra's darwin is borked, Ludovic Courtès, 2015/01/28
- 291/376: Fix message, Ludovic Courtès, 2015/01/28
- 273/376: Fix more warnings, Ludovic Courtès, 2015/01/28
- 258/376: Fix nix-copy-closure --from, Ludovic Courtès, 2015/01/28
- 260/376: Drop support for pre-c++11 compilers., Ludovic Courtès, 2015/01/28
- 262/376: Revert "Drop support for pre-c++11 compilers.", Ludovic Courtès, 2015/01/28
- 263/376: Fix build on gcc < 4.7, Ludovic Courtès, 2015/01/28
- 244/376: Show total allocations, Ludovic Courtès, 2015/01/28
- 293/376: Remove Hydra build product, Ludovic Courtès, 2015/01/28
- 279/376: Add a launchd configuration file to run nix-daemon, Ludovic Courtès, 2015/01/28