mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-01-31 15:36:47 +02:00
C API: refactor nix_store_realise
This commit is contained in:
parent
1a574c6c60
commit
31fbb24329
1 changed files with 13 additions and 9 deletions
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "path.hh"
|
#include "path.hh"
|
||||||
#include "store-api.hh"
|
#include "store-api.hh"
|
||||||
|
#include "build-result.hh"
|
||||||
|
|
||||||
#include "globals.hh"
|
#include "globals.hh"
|
||||||
|
|
||||||
|
@ -110,16 +111,19 @@ nix_err nix_store_realise(
|
||||||
if (context)
|
if (context)
|
||||||
context->last_err_code = NIX_OK;
|
context->last_err_code = NIX_OK;
|
||||||
try {
|
try {
|
||||||
store->ptr->buildPaths({
|
|
||||||
nix::DerivedPath::Built{
|
const std::vector<nix::DerivedPath> paths{nix::DerivedPath::Built{
|
||||||
.drvPath = nix::makeConstantStorePathRef(path->path),
|
.drvPath = nix::makeConstantStorePathRef(path->path), .outputs = nix::OutputsSpec::All{}}};
|
||||||
.outputs = nix::OutputsSpec::All{},
|
|
||||||
},
|
const auto nixStore = store->ptr;
|
||||||
});
|
auto results = nixStore->buildPathsWithResults(paths, nix::bmNormal, nixStore);
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
for (auto & [outputName, outputPath] : store->ptr->queryDerivationOutputMap(path->path)) {
|
for (const auto & result : results) {
|
||||||
auto op = store->ptr->printStorePath(outputPath);
|
for (const auto & [outputName, realisation] : result.builtOutputs) {
|
||||||
callback(userdata, outputName.c_str(), op.c_str());
|
auto op = store->ptr->printStorePath(realisation.outPath);
|
||||||
|
callback(userdata, outputName.c_str(), op.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue